myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Robinson" <andrew.rw.robin...@gmail.com>
Subject Re: Pretty urls
Date Sun, 04 May 2008 13:45:19 GMT
You seem to be ranting about JSF but are not trying to do things that
are designed for JSF. Lazy loading is no more messy than creation of
data in a constructor. There are many ways to do this.
1) use a managed property to set your backing bean from a request
parameter and load your object on set. This gets called when the bean
is created -- same time as the constructor pretty much
2) use Seam request parameter annotation on a setter method
3) use an on-load library (search the myfaces wiki for on-load or
onload, I am on an iPod so I can't copy & paste)

Just don't start ranting about that you can't do things the same way
in JSF as in JSP. JSP sucks for many reasons and it just doesn't do
anyone any good to complain.

On 5/4/08, Guy Bashan <guy.bashan@gmail.com> wrote:
> Hi,
>
>
>
> I read about JSF pretty url solution, for solving JSF post problem, when url
> parameters are getting lost after submitting the page.
>
> As far as I understand, the parameters in the url are injected directly to
> the bean.
>
> The thing that I cannot understand, in what cases this solution is usable?
> In most of the pages, parameters used to load data to the object.
>
> For example, for editing car details I would use: car_details.jspx?carId=5.
>
> The data of the form is being loaded in the constructor.
>
> So I will do something like this in the bean constructor:
>
> Id = getParamFromRequest("carId");
>
> If (Id != null) // Edit existing car
>
> {
>
>   car = loadCar(Id);
>
> }
>
> Else // Enter new car details
>
> {
>
>   Car = new Car();
>
> }
>
>
>
> Now, how can I use prett url? By injecting the parameter directly to the
> bean, the constructor will be activated first, then the setter.
>
> One may say, initialize the Car object in the setter method of the bean.
>
> Is it a trivial solution? (It looks a bit not neat initializing object in a
> setter method).
>
>
>
> Why JSF has never supplied a decent solution to this problem? This is a
> critical issue in web development (not loosing parameters after a post
> operation).
>
> Why are parameters does not stay after post? In regular JSP post operation,
> the parameters are preserved.
>
>
>
> Thanks,
>
> Guy.
>
>

Mime
View raw message