struts2 JSP页面提交进不去Action的方法 (求大哥帮我看看- -!) 5
问题是JSP页面中提交进不去action中的方法!Action类publicclassUserinfoActionextendsActionSupportBizb=new...
问题是JSP页面中提交 进不去action中的方法!Action类 public class UserinfoAction extends ActionSupport Biz b = new Biz(); (实体中的属性名和页面的一致) public String login(){ System.out.println("into login"); }struts.xml 中
<package name="cadefault" extends="struts-default" namespace="/">
<global-results>
<result name="input">/index.jsp</result>
</global-results>
<action name="login" class="com.edu.action.UserinfoAction" method="login">
<result name="index">/index.jsp</result>
</action>
</package>
<package name="useraction" extends="cadefault" namespace="/userinfo">
<action name="userinfo_*" class="com.edu.action.UserinfoAction" method="{1}">
<result name="input" type="redirectAction">/index.jsp</result>
<result name="main">/main.jsp</result>
</action>
</package>
web.xml中 <welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>MyFilter</filter-name>
<filter-class>com.edu.common.MyFilter</filter-class>
</filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MyFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>jsp页面:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:form action="userinfo_login.action" method="post">
<s:textfield name="info.loginname" label="loginname"></s:textfield>
<s:textfield name="info.loginpass" label="loginpass"></s:textfield>
<s:submit value="login"></s:submit>
</s:form> 展开
<package name="cadefault" extends="struts-default" namespace="/">
<global-results>
<result name="input">/index.jsp</result>
</global-results>
<action name="login" class="com.edu.action.UserinfoAction" method="login">
<result name="index">/index.jsp</result>
</action>
</package>
<package name="useraction" extends="cadefault" namespace="/userinfo">
<action name="userinfo_*" class="com.edu.action.UserinfoAction" method="{1}">
<result name="input" type="redirectAction">/index.jsp</result>
<result name="main">/main.jsp</result>
</action>
</package>
web.xml中 <welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>MyFilter</filter-name>
<filter-class>com.edu.common.MyFilter</filter-class>
</filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MyFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>jsp页面:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:form action="userinfo_login.action" method="post">
<s:textfield name="info.loginname" label="loginname"></s:textfield>
<s:textfield name="info.loginpass" label="loginpass"></s:textfield>
<s:submit value="login"></s:submit>
</s:form> 展开
3个回答
展开全部
get 和set方法呢,亲?
更多追问追答
追问
public List getTrees() { return trees; } public void setTrees(List trees) { this.trees = trees; }
/userinfo/userinfo_login.action我都试了不行 404
追答
你页面传过去的是info这个对象的值,所以在你的action里面应该有info这个对象的get和set方法。
你搞不定的话把action给我,我给你改
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询