users@woodstock.java.net

Re: How to get request params easily?

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Wed, 18 Jun 2008 06:44:07 -0700

Andrey Siver wrote:
>
>
> Dear list members,
>
> I'm newby in Woodstock framework...
>
> Is there any simple way how to set the request params of RequestBean1
> object from the request?
>
> This way is too long and awful:
>
> Map params = getExternalContext().getRequestParameterMap();
>
> if (params.get("param1") != null)
>
> getRequestBean1().setParam1(Double.parseDouble(params.get("param1").toString()));
>
>
> Thanks in advance,
> Regards,
>
> -Andrey
>
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.