日期:2014-05-17 浏览次数:20682 次
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'addNewBasicUser.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <form action="rootuser/addOneNewBranch" method="post"> 用户名:<input type="text" name="username"/><br/> 密码:<input type="text" name="password"/><br/> 支行名称:<input type="text" name="branchbankname"/><br/> <input type="submit" value="提交"/> </form> </body> </html>
package com.actions; import javax.annotation.Resource; import com.dao.interfaceImp.BasicUserDaoImp; import com.xu.model.BasicUser; import com.xu.utils.MD5; public class AddNewBranchBank { private String username; private String password; private String branchbankname; private BasicUserDaoImp budi; public BasicUserDaoImp getBudi() { return budi; } @Resource(name="BasicUserDaoImp") public void setBudi(BasicUserDaoImp budi) { this.budi = budi; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getBranchbankname() { return branchbankname; } public void setBranchbankname(String branchbankname) { this.branchbankname = branchbankname; } public String execute(){ System.out.println(branchbankname+":"+username+":"+password); try{ BasicUser bu = new BasicUser(); bu.setBranchBankName(branchbankname); bu.setUsername(username); bu.setPassword(MD5.encrypeMd5(password)); budi.addNewBasicUser(bu); } catch(Exception e){ e.printStackTrace(); return "input"; } return "success"; } }
<package name="rootuser" namespace="/rootuser" extends="struts-default"> <interceptors> <interceptor name="rootUserTypeCheck" class=&quo