Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Executing a servlet without redirecting to it  RSS feed

 
Avinash venna
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

I have a form with lot of fields... on clicking the submit button the action class shud execute and perform the DB operations... but my page should not be redirected to that page... It shud remain in the same page and the values in the fields must also persist.... Is any way there to do this???

Awaiting for your warm responses....

Regards,
Avinash Venna
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use real words when posting to the forums. Abbreviations such as "shud" in place of "should" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please click this link ⇒ UseRealWords for more information.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can forward or redirect back to the same JSP and re-populate the fields with the original values. Or you could simply submit the post via Ajax and not have to worry about refreshing the page at all.
 
Avinash venna
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry I am new to this forum... i wont repeat this from next time....


Could you please tell me how to use ajax button or how to repopulate the values back again???

Regards,
Avinas Venna
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set values into any form control with the value attribute.

You aren't going to learn Ajax from a forum post. Start here.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!