struts标签 <s:form/>怎么用
【struts.xml】<actionname="dao"class="com.DAO.OprAction"><resultname="loginSuccess">/in...
【struts.xml】
<action name="dao" class="com.DAO.OprAction">
<result name="loginSuccess" >/index.jsp</result>
</action>
【login.jsp】
<%@ taglib uri="/struts-tags" prefix="s"%>
<s:form action="dao!login.action">
<s:textfield name="xh" label="学号:"></s:textfield>
<s:textfield name="kl" label="口令:"></s:textfield>
<s:submit value="登录"></s:submit>
</s:form>
【OprAction.java】
public String login(){
String path = "loginSuccess";
System.out.println("--------->进入登录操作");
return path;
}
【index.jsp】
<a href="login.jsp" style="color: red;text-decoration: none;padding-left: 50px;">登录</a>
我点登录,它就报错[jar包没问题]:
[浏览器]:org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 10
[java:console]
2013-7-4 14:53:21 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:52)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)
at org.apache.jsp.login_jsp._jspx_meth_s_005fform_005f0(login_jsp.java:104)
at org.apache.jsp.login_jsp._jspService(login_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
。。。。。。。。。。。。。。。。
【1】求大神指点,本人新手来着。
【2】怎么提交到Action里的定制方法里来处理。我的filter:<url-pattern>*.action</url-pattern>。
谢过了哈。。急呀 展开
<action name="dao" class="com.DAO.OprAction">
<result name="loginSuccess" >/index.jsp</result>
</action>
【login.jsp】
<%@ taglib uri="/struts-tags" prefix="s"%>
<s:form action="dao!login.action">
<s:textfield name="xh" label="学号:"></s:textfield>
<s:textfield name="kl" label="口令:"></s:textfield>
<s:submit value="登录"></s:submit>
</s:form>
【OprAction.java】
public String login(){
String path = "loginSuccess";
System.out.println("--------->进入登录操作");
return path;
}
【index.jsp】
<a href="login.jsp" style="color: red;text-decoration: none;padding-left: 50px;">登录</a>
我点登录,它就报错[jar包没问题]:
[浏览器]:org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 10
[java:console]
2013-7-4 14:53:21 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:52)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)
at org.apache.jsp.login_jsp._jspx_meth_s_005fform_005f0(login_jsp.java:104)
at org.apache.jsp.login_jsp._jspService(login_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
。。。。。。。。。。。。。。。。
【1】求大神指点,本人新手来着。
【2】怎么提交到Action里的定制方法里来处理。我的filter:<url-pattern>*.action</url-pattern>。
谢过了哈。。急呀 展开
2个回答
展开全部
和form标签的用法一样.
追问
求写个可运行的简单例子,行进入Action类即可
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询