package com.loan.action; import java.util.HashMap; import java.util.Map; import net.sf.json.JSONObject; import org.apache.struts2.json.annotations.JSON; import com.loan.action.base.BaseAction; import com.loan.entity.Person; public class RegisterAction extends BaseAction { /** * */ private static final long serialVersionUID = 1L; private String u; private String p; private String result; public String getU() { return u; } public void setU(String u) { this.u = u; } public String getP() { return p; } public void setP(String p) { this.p = p; } @JSON() public String getResult() { return result; } public void setResult(String result) { this.result = result; } /** * 验证用户名是否存在 */ @Override public String execute() throws Exception { Map<String,Object> map = new HashMap<String,Object>(); JSONObject json = null; if(mgr.validateName(u,"login")){ map.put("rcode", "0"); }else{ map.put("rcode", "1"); } json = JSONObject.fromObject(map); result = json.toString();//给result赋值,传递给页面 return SUCCESS; } /** * 保存注册用户信息 * @return * @throws Exception */ public String save() throws Exception { Person person = new Person(); person.setPassword(p); if(u.contains("@") || u.contains(".")){ person.setEmail(u); }else{ person.setTelephone(u); } if(mgr.addUser(person) > 0){ return SUCCESS; } return "fail"; } }

微信网友_7000012089643008 LV4
2024年5月24日
JohnAlex LV9
2022年2月19日
wanglinddad LV55
2021年12月5日
1029162867 LV13
2021年9月25日
ericxu1116 LV24
2021年5月20日
ym111111111 LV3
2021年3月18日
王伟杰 LV2
2021年2月25日
clz123456 LV6
2020年12月21日
yguyue LV8
2020年12月15日
ExamplesDYC LV13
2020年11月21日

quartz LV8
2024年7月1日
柳咪华沙 LV7
2024年6月28日
微信网友_7000012089643008 LV4
2024年5月24日
WBelong LV8
2024年3月8日
2017143155 LV12
2023年5月22日
泓鼎168 LV20
2023年3月30日
95959595959 LV13
2023年2月13日
upup996 LV6
2022年12月14日
uni-code_0123 LV1
2022年11月16日
maniheim LV7
2022年9月30日