File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Is this illegal in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Is this illegal in JSP" Watch "Is this illegal in JSP" New topic

Is this illegal in JSP

Sree Mami
Ranch Hand

Joined: Jul 13, 2006
Posts: 75
Hi all,

I have problem forwarding request to other JSP pages from my current jsp page. My code includes:




Please clarify, as I am getting NullPointerException in the line forwarding page to Form1.jsp.
nizams uddin

Joined: Jul 31, 2006
Posts: 15
check whether the hidden variable is between form tags
Sree Mami
Ranch Hand

Joined: Jul 13, 2006
Posts: 75
Ya that may be true, I just tried and got success.

Thanks for the valuable information..
Shilpa Tendulkar
Ranch Hand

Joined: Jul 29, 2001
Posts: 75
best way to avoid any future NPE, check
if(fname != null && fname.equals("FORM1")){ .... }

Stefan Evans

Joined: Jul 06, 2005
Posts: 1518
Another way to do it is to write the logic like this:

It will never result in a null pointer exception, and has the same effect at the end of the day.
I agree. Here's the link:
subject: Is this illegal in JSP
It's not a secret anymore!