这是struts2.xml配置文件
<action name="*Action" class="Action.LoginAction" method="{1}"><!-- 登录,使用通配符 -->
<result name="success">/main.jsp</result>
<result name="error">/index.jsp</result>
<result name="input">/index.jsp</result>
</action>
在登录页面时<s:form action="loginAction.action">可以指向指定的login方法,但在js里写AJAX方法时就不行了啊,到不了指定的方法:如下
var url="UpTypeAction.action";
xml.open("GET",url,true);
xml.onreadystatechange=dodep;
xml.send(null);
return true;
我试了一下没写ajax方法,就直接在javascript方法里转发,也进不了struts2.xml所指定的方法
是不是要使用struts2的通配符, 或要传递方法只能在<s:form action="???">里面写啊?是吗??求高手解答哦
<action name="*Action" class="Action.LoginAction" method="{1}"><!-- 登录,使用通配符 -->
<result name="success">/main.jsp</result>
<result name="error">/index.jsp</result>
<result name="input">/index.jsp</result>
</action>
在登录页面时<s:form action="loginAction.action">可以指向指定的login方法,但在js里写AJAX方法时就不行了啊,到不了指定的方法:如下
var url="UpTypeAction.action";
xml.open("GET",url,true);
xml.onreadystatechange=dodep;
xml.send(null);
return true;
我试了一下没写ajax方法,就直接在javascript方法里转发,也进不了struts2.xml所指定的方法
是不是要使用struts2的通配符, 或要传递方法只能在<s:form action="???">里面写啊?是吗??求高手解答哦
应该是 struts.xmlAJAX 没有问题的啊! 看抱错是什么?
问题二:var url="UpTypeAction.action"; url的值在这里只是一个字符串,没有相对的访问路径,你否应该在"UpTypeAction.action" 的前面加上 http:// 之类的东西呢?
阁下可以跟踪下程序的逻辑或者程序是否有问题。
2.你的xml怎么定义的.
下面的你是什么意思啊
不能吧?可能是你的方法名大小写写错了,对不上,可能是你的方法返类型不对查查看反正我是没见过有大写字母开头的方法名