在ssh项目中,提交form不能转到相应的Action上,应该不是struts.jar的问题,我已经加到了lib目录下,web.xml配置文件不知道哟没有问题,请各位同僚帮忙看看。
web.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.localizationContext
</param-name>
<param-value>ApplicationResources</param-value>
</context-param>
<filter>
<filter-name>encoding filter</filter-name>
<filter-class>
com.bluedot.web.filter.EncodiingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding filter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encoding filter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<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>login.jsp</welcome-file>
</welcome-file-list>
<jsp-config>
<taglib>
<taglib-uri>/html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/menu</taglib-uri>
<taglib-location>/WEB-INF/struts-menu.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
struts-config.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans >
<form-bean name="userInfo" type="com.bluedot.web.forms.UserForm"/>
<form-bean name="studentForm" type="com.bluedot.web.forms.StudentForm"/>
<form-bean name="localLanguage" type="org.apache.struts.action.DynaActionForm">
<form-property name="country" type="java.lang.String"/>
<form-property name="language" type="java.lang.String"/>
<form-property name="page" type="java.lang.String"/>
</form-bean>
<form-bean name="paginationForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="rowsPerPage" type="java.lang.String"/>
<form-property name="currentPageNo" type="java.lang.String"/>
</form-bean>
</form-beans>
<global-exceptions />
<global-forwards >
</global-forwards>
<action-mappings >
<action path="/main" forward="/login.jsp"/>
<action path="/SwitchLocale" type="org.apache.struts.actions.LocaleAction" name="localLanguage"/>
<action path="/login"
type="org.springframework.web.struts.DelegatingActionProxy"
name="userInfo"
scope="session"
input="/login.jsp"
validate="true"
>
<forward name="success" path="mother.layout"/>
</action>
<action path="/toStudentManager" forward="student.manage.layout"/>
<action path="/manageStudent"
type="org.springframework.web.struts.DelegatingActionProxy"
name="studentForm"
scope="session"
input="/studentManager.jsp"
validate="false"
parameter="action">
<forward name="success" path="student.manage.layout"/>
</action>
<action path="/toManageStudent"
type="org.springframework.web.struts.DelegatingActionProxy"
name="studentForm"
scope="session"
validate="false">
<forward name="success" path="student.manage.layout"/>
</action>
<action path="/studentPagination"
type="org.springframework.web.struts.DelegatingActionProxy"
name="paginationForm">
<forward name="success" path="student.manage.layout"/>
</action>
</action-mappings>
<!-- Tiles框架请求处理器 -->
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" contentType="text/html;charset=UTF-8"/>
<message-resources parameter="ApplicationResources"/>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/myvlidation.xml" />
</plug-in>
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config"
value="/WEB-INF/myTiles.xml" />
<set-property property="definitions-debug" value="2" />
<set-property property="definitions-parser-details" value="2" />
<set-property property="definitions-parser-validate"
value="true" />
</plug-in>
<plug-in className="net.sf.navigator.menu.MenuPlugIn">
<set-property property="menuConfig"
value="/WEB-INF/menu-config.xml" />
</plug-in>
<plug-in className="com.bluedot.plugin.HibernatePlugIn">
<set-property property="configFilePath" value="/WEB-INF/classes/hibernate.cfg.xml"/>
<set-property property="storeInServletContext" value="true"/>
</plug-in>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="classpath:applicationContext.xml,/WEB-INF/action-servlet.xml"/>
</plug-in>
</struts-config>
请求页面如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/html" prefix="html"%>
<%@ taglib uri="/bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<div style="text-align:center">
<h1><html:errors property="userInfo"/></h1>
<html:form action="login.do">
<p><bean:message key="user.username"/>:<html:text property="userName"/><html:errors property="userName"/></p>
<p><bean:message key="user.password"/>:<html:password property="password"/><html:errors property="password"/></p>
<p><html:submit><bean:message key="button.submit"/></html:submit></p>
</html:form>
<html:link href="SwitchLocale.do?country=CN&language=zh&page=/main.do"><bean:message key="language.chinese"/></html:link><br>
<html:link href="SwitchLocale.do?country=US&language=en&page=/main.do"><bean:message key="language.english"/></html:link>
</div>
</body>
</html>
分享到:
相关推荐
cn.itcast.elec.web.action:系统控制层,负责页面和项目后台的跳转 cn.itcast.elec.web.form:封装值对象(VO对象),对应页面传递的表单值的属性 junit:测试类 * 配置文件 放置到src的目录下: beans.xml:...
在一个jsp页面中,定义了一个用户登录界面(以form表单定义),但要达到检验输入的信息的合法性,就需要对输入的...有的页面可以用action传参来得到form中输入的信息值,但有的页面却不适用,必须在跳转前就进行检验。
sp页面的form表单里面有一个属性值action,当提交jsp页面上的form表单时,系统会根据action的值来找到servlet里面具体的action,(这里的servlet是在web.xml配置文件里面),然后调用action里面的execute()方法,...
详细的资料上传ssh代码在页面上写上struts的文件标签,注意enctype="multipart/form-data" method="post",action里要求有3个属性 private File file; private String fileContentType; private String ...
structs的总控制器ActionServlet在用户提交请求时将数据放到对应的form对象中的成员变量中。 第四步:派发请求;控制器根据配置信息,对象ActionConfig将请求派发到具体的Action,对应的formBean一并传给这个
用SSH框架做的一个小小的登录例子!! public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { LoginForm loginForm = ...
文件数据存储在Blob类型的FILE_CONTENT表字段上,在Spring中采用OracleLobHandler来处理Lob字段(包括Clob和Blob),由于在程序中不需要引用到oracle数据驱动程序的具体类且屏蔽了不同数据库处理Lob字段方法上的...
<form-beans > <form-bean name="addForm" type="com.lmf118.struts.form.AddForm" /> </form-beans> <action-mappings > <action attribute="addForm" input="/add.jsp" --错误时跳转的页面 name=...
这是个SSH整合的简单例子,Action是继承自DispatchAction,多个JSP页面或是form可以跳转到这一个Action中调用同一个或是不同滴方法,有兴趣滴可以看一下,绝对无误!
│ │ │ ├─action │ │ │ │ ├─common │ │ │ │ │ CommonAction.java │ │ │ │ │ GlobalExceptionProcessor.java │ │ │ │ │ LoginAuthentication.java │ │ │ │ │ ...
实验环境 创建工程 添加 Struts 支持 添加 Spring 支持 整合 Struts 和 Spring 添加 Hibernate 支持 建立目录架构 生成 Hibernate 反向工程 编写 Service 创建 Form、Action 和 JSP 给初学者一个参考
ssh框架搭建实例; charset=utf-8" pageEncoding="utf-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ; charset=utf-8"> <title></title> <s:form action="Useradd"> ...
在MVC框架中,Struts属于VC层次,负责界面表现,负 责MVC关系的分发。(View:沿用 JSP,HTTP,Form,Tag,Resourse ;Controller:ActionServlet,struts-config.xml,Action) Hibernate: Hibernate是一个持久层...
<form name="form1" action="login.do" method="post"> <td colspan="2"><bean:message key="login.page.title" /> <td><bean:message key="login.page.username" /> <td><logic:present name=...
用过jspSmartUpload这个组件来上传和下载图片,但是现在做的是SSH整合的项目,而struts又提供了一个FormFile类来做文件的上传和下载,如果还用jspSmartUpload来做的话,有点说不过去,于是试着使用FormFile,在把我...
python入门到高级全栈工程师培训视频学习资料;本资料仅用于学习,请查看后24小时之内删除。 【课程内容】 第1章 01 计算机发展史 02 计算机系统 03 小结 04 数据的概念 05 进制转换 06 原码补码反码 07 物理层和...
由于本人的eclipse版本有点老 ,所以用了struts1.1+spring1.2+hibernate3.0+mysql5.0开发的学生信息的CRUD操作 用到了 动态的action 动态的form表单,EL语言,简单的javascript操作 dao用的是spring的事务管理。...
1.手工struts实现登陆 2.form组件和action组件 3.strust迭代标签和注册 4.分页-批量删除
struts+spring+hibernate就是这样一种规范 ...它由三种java类组件jsp、Form、Action分别实现前台页面展示、后台业务处理类、数据传递类。(所谓组件,就是对一种专门实现某种功能的java类的称呼)
Struts+Hibernate+Spring面试题合集及答案 Struts+Hibernate+Spring面试题合集 1 1. Hibernate部分 2 1.1. Hibernate工作原理 2 1.2. 什么是Hibernate的并发机制?怎么处理并发问题?...4.4. 项目中为什么使用SSH 23