aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Event Handlers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Event Handlers" Watch "Event Handlers" New topic
Author

Event Handlers

Prakash Nathan
Greenhorn

Joined: Sep 11, 2005
Posts: 6
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

Joined: Jan 10, 2002
Posts: 61224
    
  66

Yes, as with everything else on an HTML page, with Javascript.

Moved to the HTML forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
wrap it in a span tag and add ondblclick and call a function that posts back the page.

Eric
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 819
Eric,
Do you have a listing of browsers that support the span tag? Thanks.

Rob
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
ALL current day browsers....It is an HTML element just like the div and table elements
Prakash Nathan
Greenhorn

Joined: Sep 11, 2005
Posts: 6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
Surround them with spans as I suggested

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

Eric
Prakash Nathan
Greenhorn

Joined: Sep 11, 2005
Posts: 6
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
 
subject: Event Handlers