regedit.jsp
<%@ page language="java"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<html>
<head>
<title>JSP for RegeditForm form</title>
</head>
<body>
<html:form action="/regedit">
useraddr : <html:text property="useraddr"/><html:errors property="useraddr"/><br/>
username : <html:text property="username"/><html:errors property="username"/><br/>
id : <html:text property="id"/><html:errors property="id"/><br/>
<html:submit/><html:cancel/>
</html:form>
</body>
</html>
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>
<data-sources />
<form-beans >
<form-bean name="regeditForm" type="org.rockie.struts.form.RegeditForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="regeditForm"
input="/regedit.jsp"
name="regeditForm"
path="/regedit"
scope="session"
type="org.rockie.struts.action.RegeditAction">
<forward
name="show"
path="/show.jsp"
redirect="true" /> //地址不变
</action>
</action-mappings>
<message-resources parameter="org.rockie.struts.ApplicationResources" />
</struts-config>
RegeditFrom.java
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
return null;
}
/**
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
username="rockie";
id="s00";
useraddr="sz";
}
RegeditAction.java
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
RegeditForm regeditForm = (RegeditForm) form;// TODO Auto-generated method stub
return mapping.findForward("show");
show.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>My JSP 'show.jsp' starting page</title>
</head>
<jsp:useBean id="regeditForm" class="org.rockie.struts.form.RegeditForm" scope="session"/>
<body>
id:<jsp:getProperty property="id" name="regeditForm"/><br>
username:<jsp:getProperty property="username" name="regeditForm"/><br>
useraddr:<jsp:getProperty property="useraddr" name="regeditForm"/><br>
</body>
</html>








