Win a copy of Practical SVG this week in the HTML/CSS/JavaScript 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
Posts: 42970
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
Posts: 65542
110
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.
 
Onion rings are vegetable donuts. Taste this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!