1、用LoginAction.do的方式运行;
2、为何输入输出、正确不正确都转发到Login.jsp?
input="/Login.jsp" scope="request">
<forward name="success" path="/Login.jsp" />
<forward name="failure" path="/Login.jsp" /> 3、可试试JavaWebStudio的Struts文件向导,熟悉后再自己写。
http://dev.csdn.net/user/kui
http://javaweb.51.net/
http://javawebStudio.51.net/下载《Struts开发实例》地址:
http://www.infoxa.com/asp/book/xxnr.asp?id=1333
2、为何输入输出、正确不正确都转发到Login.jsp?
input="/Login.jsp" scope="request">
<forward name="success" path="/Login.jsp" />
<forward name="failure" path="/Login.jsp" /> 3、可试试JavaWebStudio的Struts文件向导,熟悉后再自己写。
http://dev.csdn.net/user/kui
http://javaweb.51.net/
http://javawebStudio.51.net/下载《Struts开发实例》地址:
http://www.infoxa.com/asp/book/xxnr.asp?id=1333
解决方案 »
- java 大量数据导出为Excel 内存溢出
- JAVA 如何 使用Hsql 用Memory-Only Databases方式链接
- 文件上传问题
- 求助 !!!!关于poi将JSP导出EXCEL的问题!!!!!![
- Myeclipse跑TOMCAT报错 HTMLManager: 后页面服务死掉,IE打不开
- variable rs might not have been initialized
- struts多模块下有时候认不到<% %>符号?
- JAVA怎么从数据库中取出来的中文字符,急
- Tomcat连接池
- shiro行和列级别的数据权限控制
- J2ee初学者应该看些什么书,请大家推荐几本吧
- 使用SSLSocket时,要提供certificate吗?
实际的是:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="LoginActionForm" type="elective.LoginActionForm" />
</form-beans>
<action-mappings>
<action path="/LoginAction" type="elective.LoginAction" name="LoginActionForm" input="/Login.jsp" scope="request">
<forward name="success" path="/Login.jsp" />
<forward name="failure" path="/Login.jsp" />
</action>
</action-mappings>
</struts-config>我的struts-config是用Jbuilder9.0配置的。
<html:form>, ActionMappings and Actionforms. This one took me a few days to figure out. When using the <html:form> tag, either JBoss or Tomcat will not create / parse the struts-config.xml document until *after* a post to the ActionServlet. Now that I'm typing this out it makes total sense but I still wasted a few days on it nonetheless.
If you are getting the Cannot find ActionMappings or ActionformBeans collection exception when accessing a JSP page, manually make a request to the ActionServlet. Most example code suggests this URL would be something like http://localhost/your_web_app/action/blah
http://localhost/your_web_app/some/nested/url/your_action.do You don't need to send this manual request to a real Action - so long as the container maps the request to the ActionServlet you're OK. In my environment I simply use an Ant <get> task to hit http://localhost:8080/my_web_app/action/dumbHackToAvoidThisProblemSmileyFace Also, anytime the web application is reloaded this procedure needs to be repeated. Doh!. After all that, I just learnt that all you need to do is direct the servlet container to load the servlet on startup by adding a <load-on-startup>5</load-on-startup> directive to the <servlet> section in web.xml. org.apache.jasper.JasperException: Cannot find ActionMappings or ActionformBeans collection
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) Resource Bundles. So, you've played with Struts and everything is working nicely. Like a regular developer you left resource bundles till the end. But, now you want to use <html:errors>, but when you do you get:
javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:530)
at org.apache.jsp.createCustomer_jsp._jspService(createCustomer_jsp.java:126)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432) You'll need to create your Resource bundle. A fact I had to track down was how do you tell Struts where your resource bundle is? It's one of the servlet initialization parameters in web.xml.
<servlet>
<servlet-name>credux</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>net.threebit.credux.struts.CreduxResources</param-value>
</init-param>
</servlet>
Struts1.1版本与1.0版本有些不同,另外,当前的1.2.4版本又与1.1版本有些不同,可参考http://dev.csdn.net/user/kui,《Struts 1.2.1新特点简介(1) 》.如果找到了问题之处,应进一步从源程序分析其原因,以备以后工作之用。