java系统故障,一个:“登陆系统出现故障”的调试方法

请教高手一个:“登陆系统出现故障”的调试方法。

高手,您好:

小弟弄了一个通信系统,遇到了一个故障。故障如下:

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String errorMessage=(String)request.getAttribute("errorMessage");

%>

//八

html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

远程技术交流平台-登陆
 
账 户:
密 码:
用户类型:医生用户患者用户 

if(errorMessage!=null){  %>

%>

高手,上面是小弟我的登录页面。

package com.rems.struts;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;

import org.apache.struts.actions.DispatchAction;

import com.rems.service.DoctorService;

import com.rems.service.PatientService;

import com.rems.vo.DoctorVO;

import com.rems.vo.PatientVO;

//三

public class LoginAction extends DispatchAction {

private DoctorService doctorService;

private PatientService patientService;

public void setDoctorService(DoctorService doctorService) {

this.doctorService = doctorService;

}

public void setPatientService(PatientService patientService) {

this.patientService = patientService;

}

public ActionForward loginUI(ActionMapping mapping, ActionForm form,

HttpServletRequest request, HttpServletResponse response)

throws Exception {

return mapping.findForward("loginView");

}

/**

* 注销方法

* @param mapping

* @param form

* @param request

* @param response

* @return

* @throws Exception

*/

public ActionForward logout(ActionMapping mapping, ActionForm form,

HttpServletRequest request, HttpServletResponse response)

throws Exception {

request.getSession().invalidate();

response.sendRedirect("login.jsp");//返回到登录页面

return null;

}

public ActionForward doLogin(ActionMapping mapping, ActionForm form,

HttpServletRequest request, HttpServletResponse response)

throws Exception {

String username=request.getParameter("username");

String password=request.getParameter("password");

String userType=request.getParameter("userType");

String errorMessage="";

String fwdUrl="indexView";

if(userType.equals("doctor")){

//如果是医生用户

DoctorVO intvo=new DoctorVO();

intvo.setSysname(username);

intvo.setSyspass(password);

DoctorVO outvo=doctorService.findDoctorByLogin(intvo);

if(outvo!=null){

request.getSession().setAttribute("doctorVO", outvo);

}else{

errorMessage="您输入的用户名或者密码不正确,请重新输入!";

fwdUrl="loginView";

request.setAttribute("errorMessage", errorMessage);

}

}else{

//如果是患者用户

PatientVO intvo=new PatientVO();

intvo.setUsername(username);

intvo.setPassword(password);

PatientVO outvo=patientService.findPatientByLogin(intvo);

if(outvo!=null){

request.getSession().setAttribute("patientVO", outvo);

}else{

errorMessage="您输入的用户名或者密码不正确,请重新输入!";

fwdUrl="loginView";

request.setAttribute("errorMessage", errorMessage);

}

}

request.getSession().setAttribute("userType", userType);

return mapping.findForward(fwdUrl);

}

}

高手,上面的代码,是小弟进行“用户具体功能的初步加工。

在经过上文两段代码的运行后,运行的结果如下:

0953294.png

高手小弟感谢您的过目!!

不多说了,100分,奉上!!

------解决思路----------------------

报错了就看错误信息啊,你DAO类中的SQL查询语句不能被正确执行啊~~~~

------解决思路----------------------

查询语句出错了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值