• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...


 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
#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.


 
Ranch Hand
Posts: 83
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic