dev@jsftemplating.java.net

Re: JSFTemplating: Explanation of form submissions

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Wed, 24 Jan 2007 16:13:21 -0800

Hi Karam,

I know we covered this in our phone conversation earlier today, but for others that may be interested, I'll write a few things.

Q. How do I get form values?

A. You can get access to raw form values by doing:

    facesConfig.getExternalContext().getRequestParameterMap().get("form:field:name");

However, since data is almost always "bound" to something, it's more common to access data from its source (i.e. what it's bound to).

Q. How is this typically done in JSFTemplating?

A. In your .jsf file:

    <sun:textField value="#{some.binding}" />

    <sun:button>
       <!command
          yourProcessDataHandler(someParam="#{some.binding}" output=>$attribute{xyz});
       />
    </sun:button>

Data flows from the textField, to the destination of the binding, to the input of the "yourProcessDataHandler".  This much better than managing request parameters yourself.

Ken

Karam Singh Badesha wrote:
Hi,
I come from using languages like php, perl etc for web programming and
would like to understand the basics of form submissions using jsf. In
other languages, there are ways to get the http GET/POST variables of
form submissions. Now I have been looking at jsf example code and it
seems that I always to declare a variable as something (pageSession,
session, attribute ...) to be able to use it. Is this correct or am I
not understanding this properly. Can someone please explain how to
retrieve the form entries without declaring them using a small example?

thanks,