myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Bashan <guy.bas...@gmail.com>
Subject Pretty urls
Date Sun, 04 May 2008 12:54:17 GMT
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