aspose file tools*
The moose likes JSP and the fly likes <jsp:forward page= not working" title="" /> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "<jsp:forward page=""/> not working" Watch "<jsp:forward page=""/> not working" New topic
Author

<jsp:forward page=""/> not working

abhiavi kumar
Greenhorn

Joined: Mar 13, 2013
Posts: 20
This is my .JSP file, there are two <jsp:forward page> in this code, the one in the "else" part works, while the other does not.



Everything actually works as it should, if the required details are entered and correct, the "password" value in the "Login" table of my backend does get updated, but after that, the code <jsp:forward page="home.html"/> does not work, all I see is a white page with nothing on it.

The <jsp:forward page = login.jsp"/> code in my else part does work though, it works as intended if the entered details are wrong or if nothing is entered (The required details are entered in the previous page).

The problem seems to be because of "ResultSet bs = np.executeQuery();", if I remove this, the <jsp:forward page="home.html"/> does work like it should. but I need this code to update the password in my table. so is there any reason for <jsp:forward page> to not work after an update?

thanks...


Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1028
#1: Check your logs for an error message.

#2: None of this code belongs in a JSP. Put java code in a java class. There is absolutely no presentation logic here, it should be in a servlet.

#3: Use a JNDI datasource rather than opening a new database connection every time would be preferable.


jagrutkumar dalwadi
Ranch Hand

Joined: Mar 26, 2009
Posts: 83

Also jsp file is used for showing data/view purpose only. It should not contain Business logic or controller related code.
Controller related code should be in servlet and business logic should be in Pojo.
As per the good programming practise, scriptlets should not be used in jsp file, rather use jsp standard actions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: <jsp:forward page=""/> not working