Hi,
I have a page named "Login" and after entering username and password , a user can enter into a page named "MainMenu".So simple..
I am going to use session so when a user login and enter into a MainMenu and after that close this page,with opening new page the controller set if it is a new session forward it to "Login" , otherwise forward the request to the "MainMenu" or each page that a user was in before closing the page.
Here is my code:
[CODE]
if (session.isNew()){ // the first login
getServletConfig().getServletContext().getRequestDispatcher ("/Login.html").forward(request,response);
currentUrl = getUrl(request);
}
else {
oldUrl =(
String) session.getAttribute("currentUrl");
String servletPath = request.getServletPath(); // /control
if (oldUrl != null) {
// out.println("oldUrl != null");
getServletConfig().getServletContext().getRequestDispatcher("\"servletPath").forward(request,response);
}
}
session.setAttribute("currentUrl",currentUrl);
out.close();
}
[CODE]
but unfortunately it doesn't work and i face to this error:
type: Exception report
message
escription The server encountered an internal error () that prevented it from fulfilling this request.
exception:
java.lang.IllegalArgumentException: Path "servletPath does not start with a "/" character
Thanks in advance
Hany
[ December 23, 2008: Message edited by: Bear Bibeault ]
[ December 24, 2008: Message edited by: hany hashemi ]