81,092
社区成员
发帖
与我相关
我的任务
分享
<form method="post" action="Task1.do" ">
<table align="center">
<tr>
<td>UserID:</td><td><input type="text" id="user_id" name="${userInfo.UserInfo.Userid}"
onblur="out_chkNumber('user_id','show_UserId','ERR:UserId hava to be Number format and more than 3 digits and be number! ')" />
<span style="display: show" id="show_UserId" > </span ></td>
</tr>
<tr>
<td>UserName:</td><td><input type="text" id="user_name" name="${userInfo.UserInfo.Username}"
onblur="out_chkLength('user_name','show_UserName','ERR:UserName length have to less than 20 digits!','0','21')" />
<span style="display: show" id="show_UserName" > </span ></td>
</tr>
<tr>
<td>Group:</td><td><input type="text" id="user_group" name="${userInfo.UserInfo.Group_}"
onblur="out_chkLength('user_group','show_Group','ERR:Group length have to less than 10 digits!','0','11')" />
<span style="display: show" id="show_Group"> </span ></td>
</tr>
<tr>
<td>Telephone_No:</td><td><input type="text" id="user_telephone" name="${userInfo.UserInfo.Telephone_No}"
onblur="out_chkPhone('user_telephone','show_Telephone','ERR:Telephone have to fulfil telephone format!')" />
<span style="display: show" id="show_Telephone" > </span ></td>
</tr>
<tr>
<td>Status:</td><td><input type="text" id="user_status" name="${userInfo.UserInfo.Status}"
onblur="out_chkLength('user_status','show_Status','ERR:Status have to less than 10 digits!','0','11')" />
<span style="display: show" id="show_Status" > </span ></td>
</tr>
<tr>
<td>Address:</td><td><input type="text" id="user_address" name="${userInfo.UserInfo.Address}"
onblur="out_chkLength('user_address','show_Address','ERR:Address have to less than 31 digits!','0','32')" />
<span style="display: show" id="show_Address" > </span ></td>
</tr>
<tr><td><input type="submit" value="Submit" onclick="action='Task1.do?actionMethod=saveAction'" /> </td><td><input type="reset" value="Clear"></td> </tr>
</table>
</form>
public class Task1Action extends DispatchAction {
public UserInfo userInfo= new UserInfo();
public ITask1Service task1Service;
public ActionForward saveAction(ActionMapping mapping , ActionForm form ,
HttpServletRequest request , HttpServletResponse response) throws Exception {
if (task1Service.findUser(userInfo.getUserid()) != null) {
task1Service.update(userInfo);
} else {
task1Service.insert(userInfo);
}
return mapping.findForward("success");
}