Meaningless Drivel is fun!
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
JavaRanch » Java Forums » Java » JSF
Bookmark "new to liferay and jsf 2.0" Watch "new to liferay and jsf 2.0" New topic

new to liferay and jsf 2.0

prashant rathod

Joined: Apr 05, 2012
Posts: 11
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 {}.
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: 17421

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 "{}" is not correct. It should be "#{}".

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: new to liferay and jsf 2.0
It's not a secret anymore!