users@woodstock.java.net

Re: How to get request params easily?

From: Andrey Siver <andrey.siver_at_gmail.com>
Date: Wed, 18 Jun 2008 18:44:26 +0400

Dear Ryan,

Possibly I formulated the question not very good :).
So: is it possible to get request param (sending to JSP page) easily then:
>>>
Map params = getExternalContext().getRequestParameterMap();

Double param1;
if (params.get("param1") != null)
        param1 =
(Double.parseDouble(params.get("param1").toString()));
<<<

It would be great if every bean field in RequestBean1 set up automatically
from the request.
So it would be enough just right >>>Double param1 =
RequestBean1.getParam1(); <<< (and requestBean1.param1 should be set
somewhere during initialization).

Thanks,

-Andrey

2008/6/18 Ryan Lubke <Ryan.Lubke_at_sun.com>:

> I'm guessing RequestBean1 is a JSF managed bean?
> If so, you can leverage managed properties to set the value like so:
>
> (this is a child element of managed-bean)
>
> <managed-property>
> <property-name>param1</property-name>
> <value>#{param.param1}</value>
> </managed-property>
>
> When RequestBean1 is instantiated, it will pass the value of the request
> parameter
> 'param1' to your setter, setParam1() for you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_woodstock.dev.java.net
> For additional commands, e-mail: users-help_at_woodstock.dev.java.net
>
>