Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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 ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

post back page  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way in JSP to tell if a page is a post back or not?
for example if I have a form and it submits to itself. Is there a way in jsp to determine if its the first time the page has come up or if it is from pushing the submit button?
 
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could set a variable in the session and check to see if it exists, or you could set a hidden field in the form and then check it in the request obj.
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the methods Phil mentions are excellent -- and probably the most popular. You can also use HttpServletRequest.getHeader() and get the referer -- that will tell you which page the user came from. You can see if they came from this same page.
 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark
u can try this as well,
if u have a submit button with name say btnSubmit
then at very bigning or ur jsp u can check
if(request.getParameter("btnSubmit")==null)
{
this means submit button is not clicked
and still ur here..!!!
}
regards
Praful
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!