web.xml:
/form/user.jsp
Set Character Encoding
cn.jane.filters.SetCharacterEncodingFilter
encoding
GBK
Set Character Encoding
/*
action
org.apache.struts.action.ActionServlet
config
/WEB-INF/struts-config.xml
debug
3
detail
3
0
action
*.do
Sturts_config.xml:
attribute="userForm"
input="/form/user.jsp"
name="userForm"
path="/user"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" />
applicationContext.xml:
class="org.apache.commons.dbcp.BasicDataSource">
oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:@localhost:1521:WOLFUNI
scott
mars99
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
org.hibernate.dialect.Oracle9Dialect
org/eimhe/Usertable.hbm.xml
abstract="false" singleton="false" lazy-init="default"
autowire="default" dependency-check="default">
Action:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package cn.jane.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 cn.jane.Usertable;
import cn.jane.UsertableDAO;
/**
* MyEclipse Struts
* Creation date: 11-30-2006
*
* XDoclet definition:
* @struts.action path="/user" name="userForm" input="/form/user.jsp" scope="request" validate="true"
*/
public class UserAction extends Action {
/*
* Generated Methods
*/
private UsertableDAO userdao;
public UsertableDAO getUserdao() {
return userdao;
}
public void setUserdao(UsertableDAO userdao) {
this.userdao = userdao;
}
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Usertable userForm = (Usertable) form;// TODO Auto-generated method stub
userdao.save(userForm);
return null;
}
}
---其他的代码就就自动生成来的
阅读(1624) | 评论(0) | 转发(0) |