This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event Handlers

 
Prakash Nathan
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could you please suggest a way to implement the following requirement in JSP?
Consider the following text is present in a JSP Page.

"This is a sample text"

When the user do a "double click" on any of the above words, i need to invoke a servlet. Is there any way to capture the 'double click' event.

Thanks!
Prakash A
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, as with everything else on an HTML page, with Javascript.

Moved to the HTML forum.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wrap it in a span tag and add ondblclick and call a function that posts back the page.

Eric
 
Rob Hunter
Ranch Hand
Posts: 832
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric,
Do you have a listing of browsers that support the span tag? Thanks.

Rob
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ALL current day browsers....It is an HTML element just like the div and table elements
 
Prakash Nathan
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies.

Let me explain wat exactly my requirement is.

JSP file has the following senetence.
"parameter1 parameter2 parameter3"

If the user, double clicks on any of the parameter i need to invoke a servlet and pass that particular parameter to the servlet.

How to accomplish it?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surround them with spans as I suggested

<span ondblclick="alert("bar");">foo</span>

Eric
 
Prakash Nathan
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Wrapping the text with SPAN tag is fine.
But, i really have a lots of information to be displayed in the page.
Example, 5-6 paragraphs.

In this case, it would not be fair to wrap each & every word in the paragraph. Is there any global way to accomplish this?

Prakash A
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic