Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

Posts: 20
  • Mark post as helpful
  • send pies
  • 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?


Posts: 1845
  • Mark post as helpful
  • send pies
  • 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
  • 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.
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic