Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem With jsp:forward

 
Shashank Acharya
Greenhorn
Posts: 21
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

INDEX.JSP


VALIDATION.JSP


WELCOME.JSP


Thanks In Advance
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shashank Acharya wrote:Please Reply Faster

You might want to rethink posting things like this.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<% %> and <%= %> are different things.
 
Prasad Krishnegowda
Ranch Hand
Posts: 667
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic