File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes new to liferay and jsf 2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "new to liferay and jsf 2.0" Watch "new to liferay and jsf 2.0" New topic
Author

new to liferay and jsf 2.0

prashant rathod
Greenhorn

Joined: Apr 05, 2012
Posts: 11
hi
i am new to liferay and jsf 2.0.
i have one managebean class having id and name as parameters. and one submit button.
i am taking the name and the id from the user using the xhtml page like {#user.name}.
i want to call the add method which is in managebean class after clicking the submit button.
how can i do it.?
i tried many things but it didnt worked.
i have also implemented actionlistener in managebean class.
how to call add method after the click of the submit button?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15639
    
  15

ManagedBeans don't have "parameters", they have properties. According to the JavaBean convention, these properties are normally private and accessed via get/set methods whose names consist of the prefix "get" or "set" followed by the property name, whose first character has been folded to upper-case.

You don't "call" beans. You fire actions on them. These actions are fired when the client submits a Request, usually by clicking a commandLink or commandButton control.

JSF will then process the request by pipelining it through the JSF lifecycle. The lifecycle is a series of processing phases, and for more info on them, I recommend you read the manual.

The important thing to note is that if a request successfully passes through the validation phase, all of the properties referenced by input controls on the submitted JSF form will be updated by the JSF framework to whatever values were entered in that form, then ActionListeners will be invoked, followed by the Action Method.

Most of the time, Action Listeners are not recommended, since the Action Method can do everything that's needed and, unlike the Listeners, it can do it using POJO code.

Finally, a note on your EL: The form "{#user.name}" is not correct. It should be "#{user.name}".


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: new to liferay and jsf 2.0
 
Similar Threads
multiple forms in JSP
How can I close a JSF page from the Java Bean
alert message in JSF
struts2 + jsp problem - ognl.MethodFailedException: Method "setId" failed for object