On 1/11/06, Garner, Shawn <[EMAIL PROTECTED]> wrote:
>
> First thing I did was to create a helper base class with methods like the
> following
>
> public Object getRequestParameter(String key)
> {
>         return
> FacesContext.getCurrentInstance
> ().getExternalContext().getRequestParameterMa
> p().get(key);
> }
>
> Doesn't seem very hard to me.


It is indeed pretty easy ... and you'll see that Shale builds a whole bunch
of useful utility methods into its optional base classes for backing beans.

On the particular case of request parameters, however, my view is that most
web developers get themselves in trouble by worrying about such a low level
detail.  You should be programming in terms of the *values* that were
submitted, not the *method* by which they were submitted.  Whatever
framework you are using should take care of the mapping between parameters
and values for you.  Unfortunately, peoples's existing experiences with
frameworks sets the bar too low.

This issue doesn't have much to do with what framework you are using, or
even what language (pretty much every Java or PHP or PERL "framework" is
implemented in these same low-level ways).  But, if you want to improve your
own productivity, look for solutions that get you out of having to deal with
all this stuff.

Someone earlier on this thead mentioned that they would deal with this using
managed beans and the dependency injection mechanism it supports to inject
request parameters (not associated with a component) into the backing bean.
Great idea!  By far the simplest thing to do.  But, picture the lament that
started this thread ("JSF is more complex and/or not documented well
enough") and think about what it would mean if the Hello, World program for
JSF required you to understand IoC :-).

Shawn


Craig

Reply via email to