?? loginuseraction.java
字號:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.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 org.apache.struts.action.DynaActionForm;
import com.web.model.UserInfo;
import com.web.servic.UserInfo_Intef;
/**
* MyEclipse Struts
* Creation date: 09-03-2008
*
* XDoclet definition:
* @struts.action path="/loginUser" name="loginUserForm" input="/loginUser1.jsp" scope="request" validate="true"
*/
public class LoginUserAction extends Action {
/*
* Generated Methods
*/
private UserInfo_Intef userInfo_Intef ;
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DynaActionForm lf = (DynaActionForm) form;// TODO Auto-generated method stub
//System.out.print(userInfo_Intef.findById("美麗")) ;
String userid = lf.getString("userid") ;
if(userInfo_Intef.findById(userid)!=null)
{
return mapping.findForward("login") ;
}
else
{
UserInfo ui = new UserInfo() ;
ui.setUId(lf.getString("userid")) ;
ui.setUPassword(lf.getString("userpassword")) ;
ui.setUTele(lf.getString("tele")) ;
ui.setULinkMan(lf.getString("realname")) ;
ui.setUSex(Integer.parseInt(lf.getString("sex"))) ;
ui.setUAddr(lf.getString("addr")) ;
ui.setUMemo(lf.getString("memo")) ;
try{
userInfo_Intef.save(ui) ;
}catch (Exception e)
{System.out.println("error") ;}
request.getSession().setAttribute("userinfo", ui) ;
return mapping.findForward("index") ;
}
}
public UserInfo_Intef getUserInfo_Intef() {
return userInfo_Intef;
}
public void setUserInfo_Intef(UserInfo_Intef userInfo_Intef) {
this.userInfo_Intef = userInfo_Intef;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -