This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hyperlink click error processing

 
James Winfrey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys

I have a jsp on which I dispaly table of hyperlinks.

On click of hyperlink I have to do some processing in a servlet and display an error mesage on jsp if something goes wrong.

but the control should remain on the same jsp.

Is this possible without submitting the page?

Thanks


 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a perfect application for AJAX. Libraries like Prototype and jQuery make it easy to kick off a request, collect the result, and update the HTML page accordingly without actually leaving the page.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Example using jQuery:

Or, you could write a couple of pages of raw JavaScript to do the same...

The example code above doesn't account for error handling, but that's just a few more lines (which I didn't add for clarity) that we can discuss if you go this route.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic