aspose file tools*
The moose likes JSF and the fly likes setPropertyActionListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "setPropertyActionListener" Watch "setPropertyActionListener" New topic
Author

setPropertyActionListener

Andrei Prodan
Greenhorn

Joined: Jul 07, 2012
Posts: 12
writing this code


it will result with this error: "PWC6033: Error in Javac compilation for JSP PWC6197: An error occurred at line: 144 in the jsp file: /thread.jsp PWC6199: Generated servlet error: string:///thread_jsp.java:278: cannot find symbol symbol : method setValue(int) location: class com.sun.faces.taglib.jsf_core.SetPropertyActionListenerTag" ... any ideas what it means?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16068
    
  21

Yes, it means that you're trying to turn a View template into a program. Don't do that. That's what the backing bean is for.

In JSF, unlike raw JSP, there is not pre-defined object named "request", so that part fails immediately. Even if there was, JSF interacts much differently - it uses repeated postbacks, so the original request is not reliable as a source of information over the life of the page (View).

It's also often a sign of trouble when you freely use Listeners. Listeners are not asynchronous event handlers, they are side diversions invoked as needed when an action is fired (except in JSF2 AJAX, where the AJAX listener acts as an action method). Very often, there's nothing in the listener that the action method itself couldn't have done much more simply.


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

Joined: Jul 07, 2012
Posts: 12
Tim Holloway wrote:Yes, it means that you're trying to turn a View template into a program. Don't do that. That's what the backing bean is for.

In JSF, unlike raw JSP, there is not pre-defined object named "request", so that part fails immediately. Even if there was, JSF interacts much differently - it uses repeated postbacks, so the original request is not reliable as a source of information over the life of the page (View).

It's also often a sign of trouble when you freely use Listeners. Listeners are not asynchronous event handlers, they are side diversions invoked as needed when an action is fired (except in JSF2 AJAX, where the AJAX listener acts as an action method). Very often, there's nothing in the listener that the action method itself couldn't have done much more simply.


ok.. i want to send the parameter from URL to the bean, when i click on submit button... how can i do this? and please show me an example with code
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16068
    
  21

When you click on a commandButton or commandLink, the URL is the URL of the View and the client does a POST of the JSF form containing the bean. You cannot (legitimately) mix POST and GET URL forms in the same request, so a "parameter" on the URL is not valid. The only time a GET works on a JSF View is if a direct non-JSF URL is sent to the server, and the mechanism for handling that corner case is dependent on whether you're using JSF1 or JSF2.

You can, however, include data as part of the POST of the form from JSF input controls contained in that form, including hidden and write-only input controls. If you do that, the JSF lifecycle processor will automatically update the control's corresponding backing bean property (indicated via the "vaiue=" attribute) after first determining that it - and all other inputs on the submitted form - are valid.

There is no JSF or URL-specific coding required for that. The properties are accessed via POJO set/get methods directly from the pre-supplied JSF controllers and the action method is assured that the updated values will be set before the action method is invoked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setPropertyActionListener