Win a copy of Rust Web Development this week in the Other Languages 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 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

Refresh everything in jsp and start over

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am writing a jsp code where it displays cities upon selecting a state, which is through JDBC. I have placed a start over button in the end so that I could start the page again from the beginning. Is there anyway we could do this? Please let me know how i would approach. I tried removing attributes but that doesn't seem to be the solution. Any solution is appreciated. Thanks.
 
Sheriff
Posts: 67618
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just reload the window. That will reset everything to its initial state.
 
yudi raj
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Bear.
I tried reloading the window through javascript like the one below:

I am actually using Websphere Portal on JSR 168 API. After clicking on the button above, I get the error from the server console as:

"WARNING: Cannot set header. Response already committed."

I tried to invalidate the session and redirect the page back to the jsp (now assuming all the session attributes were gone). But upon running and clicking on that button, the browser displays "Page cannot be found". I have set up a button at the end of my jsp saying "Start Over" so that upon clicking on that button, I should get the page as I first loaded from the server. I tried removing attributes but that doesn't seems to be the solution. I am new to programming so please bear with me if this looks stupid to you. Any reply is appreciated. Thank you.
 
Bear Bibeault
Sheriff
Posts: 67618
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

"WARNING: Cannot set header. Response already committed."


That's a sign of poor practices on the server.

Is there Java code in the JSP?
 
yudi raj
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its a long code. This is how it works:
I click on a state, and the page displays its related cities.
I click on a city and it displays their zip codes.
I click on a zip code and it displays the temperature for all days.
I just made the connection and linked these tables with the help of SQL. I am not retreiving actual temperature.
In the end, I have a Start Over button. Upon clicking it, the page should redirect me to enter the state again (from beginning)

Here is my state.jsp code


And here is my Portlet class




I know its a very long code. If I don't get a reply on this, its fine because nobody wants to waste their time reading a long code. If you do, I would really appreciate your help.


 
I like tacos! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic