j2ee ssh 框架整合问题
packagecom.yourcompany.struts.action;importjavax.servlet.http.HttpServletRequest;impo...
package com.yourcompany.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 com.wei.crm.Users;
import com.wei.service.Service;
import com.yourcompany.struts.form.LoginForm;
public class LoginAction extends Action {
private Service service;
public Service getService() {
return service;
}
public void setService(Service service) {
this.service = service;
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
LoginForm loginForm = (LoginForm) form;// TODO Auto-generated method stub
Users user=new Users();
user.setPassword((String)loginForm.getUsernamr());
user.setUsernamr((String)loginForm.getPassword());
if(service.isvalid(user))??????为何空指针
return mapping.findForward("success");
return mapping.findForward("fail");
}
} 展开
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 com.wei.crm.Users;
import com.wei.service.Service;
import com.yourcompany.struts.form.LoginForm;
public class LoginAction extends Action {
private Service service;
public Service getService() {
return service;
}
public void setService(Service service) {
this.service = service;
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
LoginForm loginForm = (LoginForm) form;// TODO Auto-generated method stub
Users user=new Users();
user.setPassword((String)loginForm.getUsernamr());
user.setUsernamr((String)loginForm.getPassword());
if(service.isvalid(user))??????为何空指针
return mapping.findForward("success");
return mapping.findForward("fail");
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询