aspose file tools*
The moose likes JSF and the fly likes mouse event issue in primefaces 4.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "mouse event issue in primefaces 4.0" Watch "mouse event issue in primefaces 4.0" New topic
Author

mouse event issue in primefaces 4.0

Sarah Labonne
Greenhorn

Joined: Aug 30, 2013
Posts: 3
i am developing a java web application using primefaces 4.0 and jsf 2.0. i have a text label and it's textbox. when user is in edit mode, and want to modify the value of a particular textbox, the old value of the textbox should be displayed on the right side while the user is entering the new value in the textbox. so i add an output text which rendered false on load. i want to trigger this output text(id="test") when the user click in the textbox(id="customer_customername"). so rendered should be change to equal. anyone can tell me how to do this? in my backend i have an interface with its implementation , dao and service.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Delete the onclick from the inputText control and sensitize the ajax sub-element to 'event="click"'. That will allow you to fire an AJAX listener method in your backing bean which should copy the current value of "CustomerComponent.customer.customername" to a display property such as "CustomerComponent.oldCustomername" and set the "visible" property true. As part of the AJAX re-rendering processs, the the outputText component "test" will become visible and render the value of CustomerComponent.oldCustomername.

As a side note, backing beans are instances, not classes, so you really shouldn't start its name with an upper-case letter. A number of mechanisms (including the annotation processors plus many IDEs) make assumptions and take actions based on the assumed proper use of Java upper/lowercase conventions.


Customer surveys are for companies who didn't pay proper attention to begin with.
Sarah Labonne
Greenhorn

Joined: Aug 30, 2013
Posts: 3
ok how do i trigger the output text upon event=click ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

That's what the ajax event="click" and listener method is for.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: mouse event issue in primefaces 4.0