浏览 2056 次
锁定老帖子 主题:关于dwr和spring的现象
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2007-07-02
我通过ajax提交后,页面不能迁移。可否帮忙看看是何处有问题好吗? applicationContext.xml <!--Definition of View Resolver --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass"> <value>org.springframework.web.servlet.view.JstlView</value> </property> <property name="prefix"> <value>/jsp/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> <dwr:controller id="dwrController" /> <dwr:configuration> <dwr:convert type="bean" class="org.li.dwr.spring.LoginInfo" /> <dwr:convert type="bean" class="org.springframework.web.servlet.ModelAndView"/> </dwr:configuration> <!--Request Mapping --> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/login.do">LoginAction</prop> <prop key="/dwr/engine.js">dwrController</prop> <prop key="/dwr/util.js">dwrController</prop> <prop key="/dwr/interface/DwrLogin.js">dwrController</prop> <prop key="/dwr/call/**">dwrController</prop> </props> </property> </bean> <!---Action Definition--> <bean id="LoginAction" class="org.li.dwr.spring.LoginAction"> <dwr:remote javascript="DwrLogin"> <dwr:include method="testLogin" /> </dwr:remote> <property name="commandClass"> <value>org.li.dwr.spring.LoginInfo</value> </property> <property name="fail_view"> <value>loginfail</value> </property> <property name="success_view"> <value>main</value> </property> </bean> =============================== login.jsp function bOnClick() { // springUser.getUser($("username").value,callback); DwrLogin.testLogin("test", callback); } function callback(msg) { // var user = msg; } ------------------------------------- LoginAction.java public ModelAndView testLogin(String str) { WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); System.out.println("req-session:" + req.getSession().getAttribute("dwr")); System.out.println("dddd testLogin"); return new ModelAndView("loginfail"); } ---------------------------------------------- dwr.xml <create javascript="DwrLogin" creator="spring"> <param name="beanName" value="LoginAction"></param> <filter class="org.li.dwr.log.DWRLog"></filter> </create> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |