日期:2014-05-18  浏览次数:20716 次

请求一个好的struts例子,小弟我正在学习struts中,
那位大哥有的话
发我邮箱fym053@126.com

------解决方案--------------------
我对 struts 也挺感兴趣的,有好的例子请也给我发一份到邮箱里哦。
cyf_mz@163.com
------解决方案--------------------
struts自己带的例子就非常好。
------解决方案--------------------
regdit.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 regditForm form </title>
</head>
<body>
<html:form action= "/regdit.do ">
id : <html:text property= "id "/> <br/>
useraddr : <html:text property= "useraddr "/> <br/>
username : <html:text property= "username "/> <br/>
<html:submit/> <html:cancel/>
</html:form>
</body>
</html>


RegditAction.java

//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.0.0/xslt/JavaClass.xsl

package org.eimhe.struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.eimhe.struts.form.RegditForm;

/**
* MyEclipse Struts
* Creation date: 01-10-2007
*
* XDoclet definition:
* @struts.action path= "/regdit " name= "regditForm " input= "/regdit.jsp " scope= "request " validate= "true "
*/
public class RegditAction extends Action {

// --------------------- Instance Variables

// --------------------- Methods

/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
RegditForm regditForm = (RegditForm) form;
// TODO Auto-generated method stub
return mapping.findForward( "show ");
}

}

RegditForm.java

//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.0.0/xslt/JavaClass.xsl

package org.eimhe.struts.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

/**
* MyEclipse Struts
* Creation date: 01-10-2007
*
* XDoclet definition:
* @struts.form name= "regditForm "
*/
public class RegditForm extends ActionForm {

// --------------------- Instance Variables

/** useraddr property */
private String useraddr;

/** username property */
private String username;

/** id property */
private String id;