• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

forward from one JSP to another JSP

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever I submit or forward from one jsp to
another jsp I cannot use the passed variables
correctly. Example...
<%String event = request.getParameter("EVENT");
out.print(event);
if (event="Test") {
out.print("Check");
}%>

If I call this file and pass in event="Test", it will
print it correctly, but when I use it in a conditional
statement it doesn't understand it. It will not print
the word "Check".
Please help.
 
Jayant Shirkhedkar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey JaiPei,
Try using this
if (event.equals("Test")
out.print...
OR
if (event.equalsIgnoreCase("Test")
out.print...
These are methods given by String of Java.
look up on http://java.sun.com/j2se/1.4/docs/api/index.html
for more info.
FYI the syntax
if(event="Test") would always equate event to Test
the comparison is done using "=="

all the best
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic