- 浏览: 40432 次
- 性别:
- 来自: 北京
最新评论
由于工作需要,需要经多个表单在最后一部进行操作,觉得spring的AbstractWizardFormController最适合在这里使用,我自己做的一个完整的小例子。以下是全部的代码:
1)配置文件:web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.3" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_3.xsd">
<servlet>
<servlet-name>heheapp</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>heheapp</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
</web-app>
2)heheapp-servlet.xml
这个名字是由web.xml中的<servlet-name>属性来的,spring中是这样默认的。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="registerController" class="com.kang.test.RegisterController">
<property name="successView"><value>success</value> </property>
<property name="cancelView"><value>main</value> </property>
<property name="commandClass"><value>com.kang.test.RegisterInfor</value></property>
<property name="pages">
<list>
<value>main</value>
<value>register1</value>
<value>register2</value>
<value>register3</value>
</list>
</property>
</bean>
<!--InternalResourceViewResolver-->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<!--SimpleUrlHandlerMapping-->
<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/hehe.htm">registerController</prop>
</props>
</property>
</bean>
</beans>
在这个配置文件里,所有的舰艇都来自web.xml文件,这里进一步进行监听,凡是以/hehe.htm作为提交目的的都将被registerController进行处理。
3)RegisterController
package com.kang.test;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractWizardFormController;
public class RegisterController extends AbstractWizardFormController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(RegisterController.class);
private String successView;
private String cancelView;
public RegisterController(){
logger.info("--------RegisterController init----start--");
//setPages(new String[] {"main.jsp", "register1.jsp", "register2.jsp", "register3.jsp"});
//this.successView="success.jsp";
//this.cancelView="main.jsp";
logger.info("--------RegisterController init----end----");
}
public String getSuccessView() {
logger.info("--------RegisterController getSuccessView()------");
return successView;
}
public void setSuccessView(String successView) {
this.successView = successView;
}
public String getCancelView() {
logger.info("--------RegisterController getCancelView()------");
return cancelView;
}
public void setCancelView(String cancelView) {
this.cancelView = cancelView;
}
public ModelAndView processFinish(HttpServletRequest req, HttpServletResponse res, Object command, BindException errs) throws Exception {
logger.info("-----processFinish-----start-----");
RegisterInfor registerInfor = (RegisterInfor) command;
logger.info("-----processFinish-----registerInfor:"+registerInfor);
logger.info("-----processFinish-----end-----");
return new ModelAndView(this.getSuccessView(), "registerInfor", registerInfor);
}
public ModelAndView processCancel(HttpServletRequest req, HttpServletResponse res, Object command, BindException errs) throws Exception {
logger.info("-----processCancel-----");
return new ModelAndView(this.getCancelView());
}
}
4)RegisterInfor 是一个普通的bean,负责存贮整个流程中需要提交的信息,他在多个步骤中使用。
package com.kang.test;
import java.io.UnsupportedEncodingException;
import org.apache.log4j.Logger;
public class RegisterInfor {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(RegisterInfor.class);
private String name;
private int age;
private char sex;
private String adress;
private String phone;
private String email;
private String favor;
public RegisterInfor(){
logger.info("--------RegisterInfor init------");
}
public String getAdress() {
logger.info("--------getAdress()------");
return adress;
}
public void setAdress(String adress) {
logger.info("--------setAdress------adress:"+adress);
this.adress = StringUtil.changeStringCharSet(adress, "ISO-8859-1", "GBK");
logger.info("--------adress:"+this.adress);
}
public int getAge() {
logger.info("-------getAge-------");
return age;
}
public void setAge(int age) {
logger.info("-------setAge-------age:"+age);
this.age = age;
}
public String getEmail() {
logger.info("-------getEmail-------");
return email;
}
public void setEmail(String email) {
logger.info("-------setEmail-------email:"+email);
this.email = email;
}
public String getFavor() {
logger.info("-------getFavor-------");
return this.favor;
}
public void setFavor(String favor) {
this.favor=StringUtil.changeStringCharSet(favor, "ISO-8859-1", "GBK");
logger.info("-------setFavor-------favor:"+this.favor);
}
public String getName() {
logger.info("-------getName-------");
return this.name;
}
public void setName(String name) {
this.name = StringUtil.changeStringCharSet(name, "ISO-8859-1", "GBK");
logger.info("-------setName-------name:"+this.name);
}
public String getPhone() {
logger.info("--------getPhone------");
return phone;
}
public void setPhone(String phone) {
logger.info("-------setPhone-------phone:"+phone);
this.phone = phone;
}
public char getSex() {
logger.info("-------getSex-------");
return sex;
}
public void setSex(char sex) {
logger.info("-------setSex-------sex:"+sex);
this.sex = sex;
}
}
5)mian.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
<FORM action="hehe.htm" method="post" name="dsada">
<TABLE>
<TBODY>
<TR>
<TD>
注册信息,请认真填写!
<input type="submit" value="下一步" name="_target1" align="center"/>
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>
<br>
</body>
</html>
6)register1.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>My JSP 'second.jsp' starting page</title>
</head>
<body>
<table>
<TR>
<TD>
User infor:
</TD>
</TR>
<TR>
<TD>姓名:
<c:out value="${registerInfor.name}" />
</TD>
</TR>
<TR>
<TD>年龄:
<c:out value="${registerInfor.age}" />
</TD>
</TR>
<TR>
<TD>
地址:
<c:out value="${registerInfor.adress}" />
</TD>
</TR>
<TR>
<TD>email:
<c:out value="${registerInfor.email}" />
</TD>
</TR>
<TR>
<TD>电话:
<c:out value="${registerInfor.phone}" />
</TD>
</TR>
<TR>
<TD>喜好:
<c:out value="${registerInfor.favor}" />
</TD>
</TR>
</table>
</body>
</html>
7)register2.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<html>
<head>
<title>My JSP '2.jsp' starting page</title>
</head>
<body>
<FORM action="hehe.htm" method="post" name="dsadas">
<TABLE>
<TBODY>
<TR>
<TD>
地址:
<INPUT name="adress" type="text" />
</TD>
</TR>
<TR>
<TD>
电话:
<INPUT name="phone" type="text" />
</TD>
</TR>
<TR>
<TD>
电子邮件:
<INPUT name="email" type="text" />
</TD>
</TR>
<TR>
<TD align="center">
<INPUT type="submit" value="上一步" name="_target1" />
<INPUT type="submit" value="下一步" name="_target3" />
<INPUT type="submit" value="取消" name="_cancel" />
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</body>
</html>
8)register3.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<html>
<head>
<title>My JSP '3.jsp' starting page</title>
</head>
<body>
<FORM action="hehe.htm" method="post" name="dsadas">
<TABLE>
<TBODY>
<TR>
<TD>
喜好:
<br>
<TEXTAREA cols="40" rows="8" name="favor"
style="background-color:D7F8AB"></TEXTAREA>
</TD>
</TR>
<TR>
<TD align="center">
<INPUT type="submit" value="上一步" name="_target2" />
<INPUT type="submit" value="完成" name="_finish" />
<INPUT type="submit" value="取消" name="_cancel" />
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</body>
</html>
9)success.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>My JSP 'second.jsp' starting page</title>
</head>
<body>
<table>
<TR>
<TD>
User infor:
</TD>
</TR>
<TR>
<TD>姓名:
<c:out value="${registerInfor.name}" />
</TD>
</TR>
<TR>
<TD>年龄:
<c:out value="${registerInfor.age}" />
</TD>
</TR>
<TR>
<TD>
地址:
<c:out value="${registerInfor.adress}" />
</TD>
</TR>
<TR>
<TD>email:
<c:out value="${registerInfor.email}" />
</TD>
</TR>
<TR>
<TD>电话:
<c:out value="${registerInfor.phone}" />
</TD>
</TR>
<TR>
<TD>喜好:
<c:out value="${registerInfor.favor}" />
</TD>
</TR>
</table>
</body>
</html>
10)还有个字符处理的方法:
package com.kang.test;
import java.io.UnsupportedEncodingException;
public class StringUtil {
public static String changeStringCharSet(String str,String oldCharSet,String toCharSet){
String temp="";
try {
temp = new String(str.getBytes(oldCharSet),toCharSet);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return temp;
}
}
全部的代码,发布以下就可以运行!呵呵!
1)配置文件:web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.3" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_3.xsd">
<servlet>
<servlet-name>heheapp</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>heheapp</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
</web-app>
2)heheapp-servlet.xml
这个名字是由web.xml中的<servlet-name>属性来的,spring中是这样默认的。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="registerController" class="com.kang.test.RegisterController">
<property name="successView"><value>success</value> </property>
<property name="cancelView"><value>main</value> </property>
<property name="commandClass"><value>com.kang.test.RegisterInfor</value></property>
<property name="pages">
<list>
<value>main</value>
<value>register1</value>
<value>register2</value>
<value>register3</value>
</list>
</property>
</bean>
<!--InternalResourceViewResolver-->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<!--SimpleUrlHandlerMapping-->
<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/hehe.htm">registerController</prop>
</props>
</property>
</bean>
</beans>
在这个配置文件里,所有的舰艇都来自web.xml文件,这里进一步进行监听,凡是以/hehe.htm作为提交目的的都将被registerController进行处理。
3)RegisterController
package com.kang.test;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractWizardFormController;
public class RegisterController extends AbstractWizardFormController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(RegisterController.class);
private String successView;
private String cancelView;
public RegisterController(){
logger.info("--------RegisterController init----start--");
//setPages(new String[] {"main.jsp", "register1.jsp", "register2.jsp", "register3.jsp"});
//this.successView="success.jsp";
//this.cancelView="main.jsp";
logger.info("--------RegisterController init----end----");
}
public String getSuccessView() {
logger.info("--------RegisterController getSuccessView()------");
return successView;
}
public void setSuccessView(String successView) {
this.successView = successView;
}
public String getCancelView() {
logger.info("--------RegisterController getCancelView()------");
return cancelView;
}
public void setCancelView(String cancelView) {
this.cancelView = cancelView;
}
public ModelAndView processFinish(HttpServletRequest req, HttpServletResponse res, Object command, BindException errs) throws Exception {
logger.info("-----processFinish-----start-----");
RegisterInfor registerInfor = (RegisterInfor) command;
logger.info("-----processFinish-----registerInfor:"+registerInfor);
logger.info("-----processFinish-----end-----");
return new ModelAndView(this.getSuccessView(), "registerInfor", registerInfor);
}
public ModelAndView processCancel(HttpServletRequest req, HttpServletResponse res, Object command, BindException errs) throws Exception {
logger.info("-----processCancel-----");
return new ModelAndView(this.getCancelView());
}
}
4)RegisterInfor 是一个普通的bean,负责存贮整个流程中需要提交的信息,他在多个步骤中使用。
package com.kang.test;
import java.io.UnsupportedEncodingException;
import org.apache.log4j.Logger;
public class RegisterInfor {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(RegisterInfor.class);
private String name;
private int age;
private char sex;
private String adress;
private String phone;
private String email;
private String favor;
public RegisterInfor(){
logger.info("--------RegisterInfor init------");
}
public String getAdress() {
logger.info("--------getAdress()------");
return adress;
}
public void setAdress(String adress) {
logger.info("--------setAdress------adress:"+adress);
this.adress = StringUtil.changeStringCharSet(adress, "ISO-8859-1", "GBK");
logger.info("--------adress:"+this.adress);
}
public int getAge() {
logger.info("-------getAge-------");
return age;
}
public void setAge(int age) {
logger.info("-------setAge-------age:"+age);
this.age = age;
}
public String getEmail() {
logger.info("-------getEmail-------");
return email;
}
public void setEmail(String email) {
logger.info("-------setEmail-------email:"+email);
this.email = email;
}
public String getFavor() {
logger.info("-------getFavor-------");
return this.favor;
}
public void setFavor(String favor) {
this.favor=StringUtil.changeStringCharSet(favor, "ISO-8859-1", "GBK");
logger.info("-------setFavor-------favor:"+this.favor);
}
public String getName() {
logger.info("-------getName-------");
return this.name;
}
public void setName(String name) {
this.name = StringUtil.changeStringCharSet(name, "ISO-8859-1", "GBK");
logger.info("-------setName-------name:"+this.name);
}
public String getPhone() {
logger.info("--------getPhone------");
return phone;
}
public void setPhone(String phone) {
logger.info("-------setPhone-------phone:"+phone);
this.phone = phone;
}
public char getSex() {
logger.info("-------getSex-------");
return sex;
}
public void setSex(char sex) {
logger.info("-------setSex-------sex:"+sex);
this.sex = sex;
}
}
5)mian.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
<FORM action="hehe.htm" method="post" name="dsada">
<TABLE>
<TBODY>
<TR>
<TD>
注册信息,请认真填写!
<input type="submit" value="下一步" name="_target1" align="center"/>
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>
<br>
</body>
</html>
6)register1.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>My JSP 'second.jsp' starting page</title>
</head>
<body>
<table>
<TR>
<TD>
User infor:
</TD>
</TR>
<TR>
<TD>姓名:
<c:out value="${registerInfor.name}" />
</TD>
</TR>
<TR>
<TD>年龄:
<c:out value="${registerInfor.age}" />
</TD>
</TR>
<TR>
<TD>
地址:
<c:out value="${registerInfor.adress}" />
</TD>
</TR>
<TR>
<TD>email:
<c:out value="${registerInfor.email}" />
</TD>
</TR>
<TR>
<TD>电话:
<c:out value="${registerInfor.phone}" />
</TD>
</TR>
<TR>
<TD>喜好:
<c:out value="${registerInfor.favor}" />
</TD>
</TR>
</table>
</body>
</html>
7)register2.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<html>
<head>
<title>My JSP '2.jsp' starting page</title>
</head>
<body>
<FORM action="hehe.htm" method="post" name="dsadas">
<TABLE>
<TBODY>
<TR>
<TD>
地址:
<INPUT name="adress" type="text" />
</TD>
</TR>
<TR>
<TD>
电话:
<INPUT name="phone" type="text" />
</TD>
</TR>
<TR>
<TD>
电子邮件:
<INPUT name="email" type="text" />
</TD>
</TR>
<TR>
<TD align="center">
<INPUT type="submit" value="上一步" name="_target1" />
<INPUT type="submit" value="下一步" name="_target3" />
<INPUT type="submit" value="取消" name="_cancel" />
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</body>
</html>
8)register3.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<html>
<head>
<title>My JSP '3.jsp' starting page</title>
</head>
<body>
<FORM action="hehe.htm" method="post" name="dsadas">
<TABLE>
<TBODY>
<TR>
<TD>
喜好:
<br>
<TEXTAREA cols="40" rows="8" name="favor"
style="background-color:D7F8AB"></TEXTAREA>
</TD>
</TR>
<TR>
<TD align="center">
<INPUT type="submit" value="上一步" name="_target2" />
<INPUT type="submit" value="完成" name="_finish" />
<INPUT type="submit" value="取消" name="_cancel" />
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</body>
</html>
9)success.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>My JSP 'second.jsp' starting page</title>
</head>
<body>
<table>
<TR>
<TD>
User infor:
</TD>
</TR>
<TR>
<TD>姓名:
<c:out value="${registerInfor.name}" />
</TD>
</TR>
<TR>
<TD>年龄:
<c:out value="${registerInfor.age}" />
</TD>
</TR>
<TR>
<TD>
地址:
<c:out value="${registerInfor.adress}" />
</TD>
</TR>
<TR>
<TD>email:
<c:out value="${registerInfor.email}" />
</TD>
</TR>
<TR>
<TD>电话:
<c:out value="${registerInfor.phone}" />
</TD>
</TR>
<TR>
<TD>喜好:
<c:out value="${registerInfor.favor}" />
</TD>
</TR>
</table>
</body>
</html>
10)还有个字符处理的方法:
package com.kang.test;
import java.io.UnsupportedEncodingException;
public class StringUtil {
public static String changeStringCharSet(String str,String oldCharSet,String toCharSet){
String temp="";
try {
temp = new String(str.getBytes(oldCharSet),toCharSet);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return temp;
}
}
全部的代码,发布以下就可以运行!呵呵!
发表评论
文章已被作者锁定,不允许评论。
-
JVM调优的陷阱
2011-10-24 13:01 1981开这帖的目的是想让大家了解到,所谓“标准参数”是件很微妙的事情 ... -
高效的Java异常处理框架
2009-06-23 10:58 1364一、 异常的概念和Java异常体系结构 异常是程序 ... -
六种异常处理的陋习
2009-06-23 10:23 773你觉得自己是一个Java专 ... -
HTML Response ContentType 大全
2009-06-18 13:19 977".*"="applicatio ... -
Oracle入门基本知识一点通
2009-02-11 16:00 1035引自http://www.oraclebbs.com/ ... -
javaFx环境变量配置
2009-02-09 11:01 39991)安装javafx_sdk-1_0_1-windows-i5 ... -
部署Log4j
2009-02-04 17:20 8471、拷贝"log4j-1.2.7.jar" ... -
eclipse debug 入门
2009-02-04 17:20 19901.Step Into (also F5) 跳入 2.Step ... -
学习笔记:DB2 9 管理 - 2
2009-02-04 17:18 947DB2 9 管理 第 1 部分:服务器管理 二、DB2 客 ... -
学习笔记:DB2 9 管理 - 1
2009-02-04 17:17 680DB2 9 管理 第 1 部分:服务器管理 一、DB2 实 ... -
面向对象程序设计的61条原则收藏
2009-02-04 17:16 712(1)所有数据都应该隐藏在所在的类的内部。 (2)类的使 ... -
POI读写Excel文件
2009-02-04 17:15 1649约定:POI项目2.0版现在已经接近正式发行阶段,开发进度迅速 ... -
GBK字符集知识收藏
2009-02-04 17:14 1207GB码与BIG5是中国人常用 ... -
J2EE程序中的SQL语句自动构造方法收藏
2009-02-04 17:12 688INSERT、DELETE、UPDATE 三种SQL语句是数据 ... -
oracle9i存储过程、触发器、函数简单实例(基于PL/SQL7.1)收藏
2009-02-04 17:11 2051第一:已经存在表PUB_T_DIVISION_TEST,可以使 ... -
oracle 函数大全收藏
2009-02-04 17:11 951常用oracle函数 SQL中的单记录函数 1.ASCII ... -
PLSQL循序渐进全面学习教程(全)收藏
2009-02-04 17:08 2129康师傅 2008年01月24日( ... -
oracle系统命令收藏
2009-02-04 17:06 8980 查看表的结构其中的一种做法: select COL ... -
oracle的SQLPLUS命令大全收藏
2009-02-04 17:04 1678Oracle的sql*plus是与oracle ...
相关推荐
如果需要处理多页输入合并到一个表单中,可以继承AbstractWizardFormController类。这些抽象控制器类提供了基础的实现,开发者可以根据实际业务需求进行扩展和定制。 对于配置管理方面,Spring MVC框架提供了丰富的...
当在网页填写表单信息过多的时候,一般会采用向导式的分页填写...该例子前端是easyui+Jsp实现,后台是采用了spirng @SessionAttributes(替代新版本spring不支持AbstractWizardFormController)这个注解实现表单控制器
Spring提供了多种控制器基类,如`AbstractController`、`AbstractCommandController`、`MultiActionController`、`SimpleFormController`和`AbstractWizardFormController`,以适应不同层次的控制需求。与Struts不同...
为了适应复杂的应用场景,Spring提供了多种抽象控制器,如AbstractController、AbstractCommandController、MultiActionController、SimpleFormController和AbstractWizardFormController,允许开发者按需选择。...
Spring还提供了一个控制器层次结构,允许开发者通过继承AbstractFormController或AbstractWizardFormController来处理用户输入表单和多页输入表单。 Spring MVC框架的高级配置包括了如何管理基于Spring的Web应用...
这是一个简单完整的Spring MVC向导控制器(AbstractWizardFormController)的例子,包含所需的类包,可以运行,也是我重新熟悉Spring 的第二例子,明天再上传Spring 的例外个例子,如有问题,我们可以互相学习下.
控制器可以继承 AbstractFormController 或 AbstractWizardFormController,以便处理用户输入表单。例如,LoginBankController 是一个继承自 SimpleFormController 的控制器,它负责处理用户登录请求。 视图 在 ...
它可以是一个简单的控制接口,也可以是一个复杂的控制器,例如 AbstractController、AbstractCommandController、MultiActionController、SimpleFormController 和 AbstractWizardFormController 等。 4. 视图层 ...
控制器可以通过多种方式实现,如AbstractController、AbstractCommandController、MultiActionController、SimpleFormController、AbstractWizardFormController等,根据应用需求选择合适的基类。与Struts相比,...
如`ModelAndView.handleRequest(request, response)`,并支持多种类型的控制器,如AbstractController、AbstractCommandController、MultiActionController、SimpleFormController和AbstractWizardFormController,...
SpringMVC提供了多种Controller实现,如AbstractFormController和AbstractWizardFormController,以方便开发者处理用户输入。 SpringMVC的灵活性还表现在其可扩展的组件体系。例如,DispatcherServlet允许开发者...
AbstractWizardFormController AbstractXmlApplicationContext AbstractXsltView AcceptHeaderLocaleResolver ActionRequestWrapper ActionServletAwareProcessor ActionSupport AdaptableJobFactory ...
PropertiesMethodNameResolver ParameterizableViewController AbstractCommandController AbstractFormController SimpleFormController AbstractWizardFormController ...
- **AbstractWizardFormController**:处理多步骤的表单提交。 - **MultiActionController**:允许在一个控制器中处理多个不同的请求路径。 - **选择合适的控制器**:根据具体需求选择最适合的控制器类型。 **4.4 ...