myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rafa PĂ©rez" <raja...@gmail.com>
Subject Re: Pretty urls
Date Sun, 04 May 2008 14:57:04 GMT
Hi,

if you need all your URLs to be bookmarkables, maybe JSF is not a good
option. I think JSF is a standard that tries to make development of
web applications more in a desktop application development way. Thus,
JSF provides different mechanisms than JSP and therefore a change on
the way it is used is needed.


On Sun, May 4, 2008 at 4:20 PM, Guy Bashan <guy.bashan@gmail.com> wrote:
> First I have to say, I never use JSF navigation mechanism for these reasons:
>  - forward is never an option because the url is not in sync.
>  - you are left with redirect which makes it impossible to pass parameters in
>  a reasonable way.
>   When I say reasonable way, I mean request parameters.
>
>  So when I navigate to a page I use parameters.
>  For example: http://localhost//car_details?carId=5
>  When command is activated on the page (requesting the server), JSF refreshes
>  the view
>  And taking off the parameters of the original request.
>
>  In regular JSP form post, the url parameters are preserved.
>
>  Now, the pretty url as far as I understand, comes to solve this problem in
>  jsf.
>  So beside of being "pretty", there are no request parameters that can
>  "disappear" after a refresh. There is only a url path. Therefore if page is
>  refreshed, parameters are still there. Which is a nice and acceptable
>  solution.
>  But, then we come to the problem of the original post:
>  I do initialization in the constructor. But the pretty url will inject the
>  parameters directly to the bean, causing
>  The constructor to be activated first... So how can I initialize my page
>  objects in proper way?
>
>
>
>
>  -----Original Message-----
>  From: Andrew Robinson [mailto:andrew.rw.robinson@gmail.com]
>  Sent: Sunday, May 04, 2008 4:48 PM
>  To: MyFaces Discussion
>  Subject: Re: Pretty urls
>
>  Why do you say that parameters do not stay put? JSF uses the normal
>  servlet API to handle parameters, the code is excactly the same as JSP
>  which also just uses the servlet container code
>
>  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