Topic: 看Spring附带jpetstore(Spring as web tier)登入过程,请指点 |
Print this page |
1.看Spring附带jpetstore(Spring as web tier)登入过程,请指点 | Copy to clipboard |
Posted by: yeafee Posted on: 2005-11-23 16:36 今天开始看Spring附带的samples中的jpetstore,我配置的是选用Spring作为web tier. 在index.html页面中,有"shop/signonForm.do",根据petstore-servlet.xml中的配置,
进入到/WEB-INF/jsp/Spring/SignonForm.jsp页面;然后在SignonForm.jsp中登录Form有action="<c:url value="/shop/signon.do"/>".此后,有几个地方不明白,
问题①: SignonController.java主要代码如下:
上面的UserSession对象是在从哪里来的呢?找了长久没有所获。 还有forwardAction,那个参数是从SignonForm.jsp中的下边代码处来的??可为什么要用一个if语句呢?不解!!!
--------------------------------------------------------------------------------------------------- 问题②:发现在petstore-servlet.xml中有好几处都有: <property name="petStore" ref="petStore"/> 好像是个引用什么的吧?只是这个petstore在哪里呢?有何用呢? ------------------------------------------------------- ------------------------------------------------------- 问题完毕! 呵呵,刚开始Spring的学习,一上来就碰到这么多的问题了,还请各路不吝指导哇!多谢先!附上 petstore-servlet.xml. petstore-servlet.xml (4.79k) |
2.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: yeafee Posted on: 2005-11-23 17:03 Koders.comhttp://www.koders.com/java/fid98C29E37C029B7258FFD1F2229459813CE5DE3F0.aspx?s=iso+3166 .这个网站是卖源码的么? 其中有好多的java程序源码?好像有的还有价格的. |
3.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: yeafee Posted on: 2005-11-23 17:03 好像系统有点问题,刷新后就提交两次了的 |
4.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: floater Posted on: 2005-11-24 02:55 UserSession is in org.springframework.samples.jpetstore.web.spring package. That if check is just to make sure it's well defined, it's a double check. petStore bean is define in jpetstore\attributes\WEB-INF\applicationContext.xml. This is the central place for the entire application logic. Hmm, I am a little bit surprised about these code, it could be done in a better way. Maybe it's a little old. |
5.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: yeafee Posted on: 2005-11-24 09:31 感谢floater,我在黑暗中摸索着,你在前方不远处燃亮了一点星火.给我指引了方向,也有一些温暖.(这里让我想想了巴金先生的<<灯>>,怀念巴金先生,巴金走了,灯仍在) |
6.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: yeafee Posted on: 2005-11-24 12:45 <c:if test="${!empty signonForwardAction}"> 这个signonForwardAction值从何而来呢?和下面的SignonInterceptor.java有关联的?它们是如何联系的呢?我的意思是如何从SignonController.java又到了SignonInterceptor.java??还请不烦再次指点. public class SignonInterceptor extends HandlerInterceptorAdapter { |
7.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: floater Posted on: 2005-11-24 14:24 In petstore-servlet.xml, which is the web config file and loaded from web.xml, this interceptor is assigned to four urls. So when you hit those 4 urls, this interceptor will intercept your request and check the user session, if it's not there, it reroutes you to SignonForm(in the above code). Once your submit from that form, the SignonController is called, and then reroute you back to where you originally come from. |
8.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: yeafee Posted on: 2005-11-24 20:33 3kx,floter的指点总是那么及时。 Hmm,I must walk along,then i can have a same light. Continue..... |
9.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: yeafee Posted on: 2005-11-29 11:54 嗯,我现在才发现这个.
不得不,作为一个热切的初学者,我得先放一放这个petstrore.尽管它比较精典.先看完这个再说. A tutorial for Spring Web |
10.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: floater Posted on: 2005-11-29 12:11 Yea, but it's a little bit old, I just don't have time to update it, translate it into chinese. But the basic ideal is still there, though I really want to add the ideas and logic between web frameworks and consequently why Struts is a crap, and it should not be used for any new projects at all, given the choice of Spring mvc. Oh, there are other iBATIS, core, and ejb docs too, yes, I wrote them, --- 老王卖瓜,自卖自夸, :-),just to save you some time, really. |
11.Re:看Spring附带jpetstore(Spring as web tier)登入过程,请指点 [Re: yeafee] | Copy to clipboard |
Posted by: yeafee Posted on: 2005-11-29 17:04 老王卖瓜,自卖自夸,或许这个更通俗些了, 王婆卖瓜,自卖自夸,呵呵,或许我这个已经有此之嫌了.$_$.我们都该如此才好呀,尽可能的把自己的所长及所能及有益之事展示出来才好. 呵呵,英文的tutorial也差不多可以看了,写的很好,于我有益,尤其是下面这个:
那个this.getViewFilename(),真是用的很好呀.受教了. |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |