论坛首页 入门技术论坛

关于dwr和spring的现象

浏览 2056 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-07-02  
DWR
我的测试页面中有个入力文本框,有个提交按钮,如果点击提交按钮的话,页面经过验证后,能够迁移。
我通过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>
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics