问题描述
struts-config.xml<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstruts-configPUBLIC"-//ApacheSoftwareFoundation//DTDStrutsConfiguration1.2//EN""http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config><data-sources/><form-beans><form-beanname="usersForm"type="com.web.form.UsersForm"/></form-beans><global-exceptions/><global-forwards/><action-mappings><actionattribute="usersForm"input="/login.jsp"name="usersForm"parameter="lg"path="/login"scope="request"type="org.springframework.web.struts.DelegatingActionProxy"><forwardname="success"path="/index.jsp"/></action></action-mappings><message-resourcesparameter="com.web.ApplicationResources"/><plug-inclassName="org.springframework.web.struts.ContextLoaderPlugIn"><set-propertyproperty="contextConfigLocation"value="/WEB-INF/applicationContext.xml"/></plug-in></struts-config>------------------------------------------web.xml<?xmlversion="1.0"encoding="UTF-8"?><web-appxmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"version="2.5"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"><servlet><servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param><init-param><param-name>debug</param-name><param-value>3</param-value></init-param><init-param><param-name>detail</param-name><param-value>3</param-value></init-param><load-on-startup>0</load-on-startup></servlet><servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>----------------------------action/**GeneratedbyMyEclipseStruts*Templatepath:templates/java/JavaClass.vtl*/packagecom.web.action;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;importorg.apache.struts.actions.DispatchAction;importcom.biz.UsersBiz;importcom.entity.Users;importcom.web.form.UsersForm;/***MyEclipseStruts*Creationdate:01-11-2011**XDocletdefinition:*@struts.actionpath="/login"name="usersForm"input="/login.jsp"parameter="lg"scope="request"validate="true"*@struts.action-forwardname="success"path="/index.jsp"*/publicclassLoginActionextendsDispatchAction{privateUsersBizubiz;publicUsersBizgetUbiz(){returnubiz;}publicvoidsetUbiz(UsersBizubiz){this.ubiz=ubiz;}publicActionForwarduserLogin(ActionMappingmapping,ActionFormform,HttpServletRequestrequest,HttpServletResponseresponse){UsersFormusersForm=(UsersForm)form;//TODOAuto-generatedmethodstubUsersusers=newUsers();users.setLoginId(usersForm.getUsers().getLoginId());users.setLoginPwd(usersForm.getUsers().getLoginPwd());booleanflag=false;try{flag=this.ubiz.isLogin(users);if(flag){request.getSession().setAttribute("name",users.getName());returnmapping.findForward("success");}else{returnmapping.findForward("");}}catch(Exceptione){e.printStackTrace();returnmapping.findForward("");}}}----------------------------------------<%@pagelanguage="java"import="java.util.*"pageEncoding="utf-8"%><html><head><title>用户登录</title></head><body><formaction="login.do?lg=userLogin"method="post"name="myform">用户名:<inputtype="text"name="users.loginId">密码:<inputtype="password"name="users.loginPwd"><inputtype="submit"value="保存"></form></body></html>-------------------------页面报错404
解决方案
解决方案二:
请求地址没找到啊看看是跳转到哪个请求是不是写得有问题
解决方案三:
上百度文库,里面啥都有
解决方案四:
我自己已经解决了,一共三个错导致404错误1:数据库主外键表问题导致ssh集成报错"sessionfactory"defind致使ssh没有完全启动2:form没有实例化3:实体类和HQL语句参数大小写问题都属于自己没有注意细节
解决方案五:
引用3楼zq003003的回复:
我自己已经解决了,一共三个错导致404错误1:数据库主外键表问题导致ssh集成报错"sessionfactory"defind致使ssh没有完全启动2:form没有实例化3:实体类和HQL语句参数大小写问题都属于自己没有注意细节
细节决定成败
解决方案六:
Remark
解决方案七:
都是细节惹得祸。。
解决方案八:
自己去看看404错误是什么意思再来问吧。。。哎
解决方案九:
喔喔解决了就可以了
解决方案十:
404,你懂的
解决方案十一:
跳转时出错了啊,findforward(“”),肯定会报404错误,找不到页面