I have two JSP pages. One of them is call validate.jsp
and the code is as below:
String username = request.getParameter("username");
String password = request.getParameter("password");
String referrerURL = request.getParameter("referrerURL");
if(userFacade.validate(username, password) == false){
throw new Exception(userFacade.getMsg());
}
// Extract the Auser object of the user and stores it in the HttpSession object
Auser auser = userFacade.get(username, true);
if (auser == null) {
throw new Exception("Invalid user.");
}
String usertype = auser.getAusertype();
I have another JSP called email.jsp
and I want to call the variable in validate.jsp
<%@include file = "../../../login/validate.jsp" %>
Auser auser = userFacade.get(username, true);
My directory for include file is definitely correct but however it couldn't resolve username
in this JSP.
Can anyone point out any mistake I made?
EDIT:
Found out that username
is inside a try catch block and if i placed it outside, I can call the variable. Is there a way to call it inside a try catch from another jsp?