• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setPropertyActionListener

 
Andrei Prodan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Andrei Prodan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic