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.
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.
An IDE is no substitute for an Intelligent Developer.
Joined: Aug 30, 2013
ok how do i trigger the output text upon event=click ?