my dog learned polymorphism
The moose likes JSP and the fly likes Problem With jsp:forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem With jsp:forward" Watch "Problem With jsp:forward" New topic

Problem With jsp:forward

Shashank Acharya

Joined: Mar 20, 2010
Posts: 21

Hi Friends,

I am making a web application on project management system.In that I used index.jsp, validation.jsp.

The problem is that when check username & password in validation.jsp,it just sends it welcome.jsp with Username as null without checking whether username or password is null or not.

Here My Each & Every JSP page I used please help me about how to I reslove this problem.Also tell me how to send username to welcome.jsp page using this code or another.




Thanks In Advance
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63867

Shashank Acharya wrote:Please Reply Faster

You might want to rethink posting things like this.

[Asking smart questions] [About Bear] [Books by Bear]
David Newton

Joined: Sep 29, 2008
Posts: 12617

<% %> and <%= %> are different things.
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 662

<h4>Welcome <%request.getParameter("loginname");%></h4>

The above line should be, <%= session.getAttribute("loginname") %>, i guess...

Also, I can't understand why you are checking the username and password null condition in an JSP, you could just check it in an servlet and then forward to welcome.jsp, if the condition is met, which would make the code and logic more clear...
dileep keely
Ranch Hand

Joined: Jun 28, 2010
Posts: 108
Can you try doing this:
In VALIDATION.JSP replace 18th line
<jsp:param name="loginname" value="${param.loginname}"></jsp:param>

with <jsp:param name="loginname" value="${sessionScope.loginname}"></jsp:param>

because "
"param" will act as request.getParameter(String XXXX);
"sessionScope" as session.getAttribute(String XXXX);

The above should solve the problm
I agree. Here's the link:
subject: Problem With jsp:forward
It's not a secret anymore!