这是一个action配置文件:
<package name="regcode" extends="struts-base" >
<!-- 更新注册码信息 -->
<action name="regcode" class="service.web.RegCodeAction">
<result name="userlist" type="redirect">regcode!getRegCodeList.action</result>
<result name="success">/pages/regcode/index.jsp</result>
</action>
<!-- 添加注册码 -->
<action name="insertRegcodeBean" class="service.web.RegCodeAction">
<result name="success">/pages/regcode/addRegCode.jsp</result>
</action>
<!-- 添加成功后跳到不可修改页 -->
<action name="inserStatic">
<result name="success">/pages/regcode/updRegCodeStatic.jsp</result>
</action>
<!-- 删除注册码 -->
<action name="delRegCode" class="service.web.RegCodeAction">
<result type="redirect">regcode!regcode.action</result>
</action>
<!-- 获取注册码总数 -->
<action name="getCount" class="service.web.RegCodeAction">
<result name="success">/pages/regcode/index.jsp</result>
</action>
<!-- 更新注册码 -->
<action name="saveRegcodeBean" class="service.web.RegCodeAction">
<result name="success">/pages/regcode/updRegCode.jsp</result>
</action>
</package>java 类action:
import java.util.List;
import java.util.Map;import org.omg.CORBA.Request;import com.opensymphony.xwork2.ActionContext;
import com.sun.mail.iap.Response;import base.exceptions.DataAccessException;
import base.web.PaginationAction;
import service.pojo.RegCodeBean;
import service.common.RegCodeService; public class RegCodeAction extends PaginationAction { /**
*
*/
private static final long serialVersionUID = -7788828963466040631L;
private RegCodeService regCodeService ;
private RegCodeBean regCodeBean ;
private List<RegCodeBean> resultList ;
private String id;
private Integer Integer;
/*
* 获得注册码列表
*/
public String getRegCodeList() throws Exception {
try
{
this.setTotalCount(regCodeService.getCount(regCodeBean));
int startPage = this.getStartPage();
setResultList(regCodeService.getRegCodeBeansList(regCodeBean, startPage, pageSize));
}
catch (Exception e) { }
return "success";
}
/**
* 更新注册码信息
*/
public String regCode(RegCodeBean regCodeBean) throws Exception
{
Integer = regCodeService.regCode(getRegCodeBean());
return SUCCESS;
}
/*
* 记录日志信息
*/
public String addEvents()throws Exception{
// System.out.println(getRegCodeBean());
// Map session = ActionContext.getContext().getSession();
// String ver1 = (String)session.get("code");
// session.put("code", session);
// if(regCodeBean.equals(ver1)){
regCodeService.addEvents(getRegCodeBean());
return SUCCESS;
// }else{
// addActionError("添加未成功");
// return ERROR;
// }
}
/**
* 添加注册码
* @param regcode
* @throws DataAccessException
*/
public String insertRegcodeBean()throws Exception
{
System.out.println("aa");
regCodeService.insertRegcodeBean(getRegCodeBean());
return SUCCESS;
}
/**
* 更新注册码
*/
public String saveRegcodeBean()throws Exception
{
this.setId(id);
regCodeService.updateRegcodeBean(getRegCodeBean());
return SUCCESS;
}
/*
* 删除注册码
*/
public String DelRegCodeBean() throws Exception{
regCodeService.deleteRegcodeBean(getRegCodeBean());
return "success";
}
/**
* 获取注册码总数
*/
public String getCount()throws Exception{
Integer = regCodeService.getCount(getRegCodeBean());
return "success";
}
//省略get set方法jsp 有个:
<tr>
<td><a href="insertRegcodeBean.action"><input type="button" name="button" value="添加注册码"/></a></td>
</tr>
跳到addRegCode.jsp:
<form method="post" action="saveRegcodeBean.action">
<table width="499" border="0" align="center">
<tr>
<td colspan="2" align="center">注册码添加</td>
</tr>
<tr>
<td width="130"> 注册码 :</td>
<td><input type="text" name="regcode" /></td>
</tr>
<tr>
<td> 是否已使用 :</td>
<td><s:textfield name="used"/></td>
</tr>
<tr>
<td> 中心系统地址 :</td>
<td><s:textfield name="serveraddress"/></td>
</tr>
<tr>
<td> 模块配置代码 :</td>
<td><s:textfield name="modulestr"/></td>
</tr>
<tr>
<td> 模块唯一代码:</td>
<td><s:textfield name="clientid"/></td>
</tr>
<tr>
<td> 注册时间 :</td>
<td>
<input type="text" name="textfield2"/></td>
</tr>
<tr>
<td> 终端IP地址 :</td>
<td><s:textfield name="ipaddress"/></td>
</tr>
<tr>
<td> 注册次数 :</td>
<td><s:textfield name="regcount"/></td>
</tr>
<tr>
<td> 有效起始时间 :</td>
<td><s:textfield name="efdate"/></td>
</tr>
<tr>
<td> 有效结束时间 :</td>
<td><s:textfield name="expdate"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" name="submit" id="button" value="保存" />
<a href="regcode.action">
<input type="button" name="button2" id="button2" value="返回" />
</a></td>
</tr>
</table>
调一个保存action
可书库库里存不进去值 请大虾帮忙看下 谢谢 我邮箱是:[email protected]
<package name="regcode" extends="struts-base" >
<!-- 更新注册码信息 -->
<action name="regcode" class="service.web.RegCodeAction">
<result name="userlist" type="redirect">regcode!getRegCodeList.action</result>
<result name="success">/pages/regcode/index.jsp</result>
</action>
<!-- 添加注册码 -->
<action name="insertRegcodeBean" class="service.web.RegCodeAction">
<result name="success">/pages/regcode/addRegCode.jsp</result>
</action>
<!-- 添加成功后跳到不可修改页 -->
<action name="inserStatic">
<result name="success">/pages/regcode/updRegCodeStatic.jsp</result>
</action>
<!-- 删除注册码 -->
<action name="delRegCode" class="service.web.RegCodeAction">
<result type="redirect">regcode!regcode.action</result>
</action>
<!-- 获取注册码总数 -->
<action name="getCount" class="service.web.RegCodeAction">
<result name="success">/pages/regcode/index.jsp</result>
</action>
<!-- 更新注册码 -->
<action name="saveRegcodeBean" class="service.web.RegCodeAction">
<result name="success">/pages/regcode/updRegCode.jsp</result>
</action>
</package>java 类action:
import java.util.List;
import java.util.Map;import org.omg.CORBA.Request;import com.opensymphony.xwork2.ActionContext;
import com.sun.mail.iap.Response;import base.exceptions.DataAccessException;
import base.web.PaginationAction;
import service.pojo.RegCodeBean;
import service.common.RegCodeService; public class RegCodeAction extends PaginationAction { /**
*
*/
private static final long serialVersionUID = -7788828963466040631L;
private RegCodeService regCodeService ;
private RegCodeBean regCodeBean ;
private List<RegCodeBean> resultList ;
private String id;
private Integer Integer;
/*
* 获得注册码列表
*/
public String getRegCodeList() throws Exception {
try
{
this.setTotalCount(regCodeService.getCount(regCodeBean));
int startPage = this.getStartPage();
setResultList(regCodeService.getRegCodeBeansList(regCodeBean, startPage, pageSize));
}
catch (Exception e) { }
return "success";
}
/**
* 更新注册码信息
*/
public String regCode(RegCodeBean regCodeBean) throws Exception
{
Integer = regCodeService.regCode(getRegCodeBean());
return SUCCESS;
}
/*
* 记录日志信息
*/
public String addEvents()throws Exception{
// System.out.println(getRegCodeBean());
// Map session = ActionContext.getContext().getSession();
// String ver1 = (String)session.get("code");
// session.put("code", session);
// if(regCodeBean.equals(ver1)){
regCodeService.addEvents(getRegCodeBean());
return SUCCESS;
// }else{
// addActionError("添加未成功");
// return ERROR;
// }
}
/**
* 添加注册码
* @param regcode
* @throws DataAccessException
*/
public String insertRegcodeBean()throws Exception
{
System.out.println("aa");
regCodeService.insertRegcodeBean(getRegCodeBean());
return SUCCESS;
}
/**
* 更新注册码
*/
public String saveRegcodeBean()throws Exception
{
this.setId(id);
regCodeService.updateRegcodeBean(getRegCodeBean());
return SUCCESS;
}
/*
* 删除注册码
*/
public String DelRegCodeBean() throws Exception{
regCodeService.deleteRegcodeBean(getRegCodeBean());
return "success";
}
/**
* 获取注册码总数
*/
public String getCount()throws Exception{
Integer = regCodeService.getCount(getRegCodeBean());
return "success";
}
//省略get set方法jsp 有个:
<tr>
<td><a href="insertRegcodeBean.action"><input type="button" name="button" value="添加注册码"/></a></td>
</tr>
跳到addRegCode.jsp:
<form method="post" action="saveRegcodeBean.action">
<table width="499" border="0" align="center">
<tr>
<td colspan="2" align="center">注册码添加</td>
</tr>
<tr>
<td width="130"> 注册码 :</td>
<td><input type="text" name="regcode" /></td>
</tr>
<tr>
<td> 是否已使用 :</td>
<td><s:textfield name="used"/></td>
</tr>
<tr>
<td> 中心系统地址 :</td>
<td><s:textfield name="serveraddress"/></td>
</tr>
<tr>
<td> 模块配置代码 :</td>
<td><s:textfield name="modulestr"/></td>
</tr>
<tr>
<td> 模块唯一代码:</td>
<td><s:textfield name="clientid"/></td>
</tr>
<tr>
<td> 注册时间 :</td>
<td>
<input type="text" name="textfield2"/></td>
</tr>
<tr>
<td> 终端IP地址 :</td>
<td><s:textfield name="ipaddress"/></td>
</tr>
<tr>
<td> 注册次数 :</td>
<td><s:textfield name="regcount"/></td>
</tr>
<tr>
<td> 有效起始时间 :</td>
<td><s:textfield name="efdate"/></td>
</tr>
<tr>
<td> 有效结束时间 :</td>
<td><s:textfield name="expdate"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" name="submit" id="button" value="保存" />
<a href="regcode.action">
<input type="button" name="button2" id="button2" value="返回" />
</a></td>
</tr>
</table>
调一个保存action
可书库库里存不进去值 请大虾帮忙看下 谢谢 我邮箱是:[email protected]
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货