But f:setPropertyActionListener doesn't work well with redirects.

Martyn, JSF does require a different view of the world. In many other 
frameworks, html and http are the only supported technologies. JSF instead is 
designed to work with things other than html (eg generating XUL) and 
view<->logic communications other than http. 

So things like "I want data x in the http url" is a little unfair; the better 
way to think is what the actual requirement is.

One of the things that *is* a real requirement is bookmarkable urls. It's not a 
hugely significant goal, as JSF is intended to be used for generating 
interactive webapps, not static sites. And bookmarking an interactive app is 
not *usually* desirable.

But yes there are cases where bookmarking a JSF page with an input parameter is 
desirable - and it is not as easy as it should be.

Back to the original question: if you drop the idea of wanting a specific URL 
format, then the solution is easy: don't do a redirect, do an internal forward. 
And then the data can be stored into the target bean by the action handler 
before the forward occurs.


Regards,
Simon


---- Martin Marinschek <[EMAIL PROTECTED]> schrieb:
> Are you using JSF1.2? Check out f:setPropertyActionListener for
> changing from a list-page to a detail-page.
> 
> regards,
> 
> Martin
> 
> On 2/1/08, Martyn Hiemstra <[EMAIL PROTECTED]> wrote:
> > Hi All
> >
> > My company has chosen to use jsf in a new project. I myself am used to
> > SpringMVC which works perfectly for my needs but I figured, why not try
> > jsf since I have to use. I am running into a problem which is a pretty
> > huge problem in jsf. Maybe someone can explain it to me how to solve my
> > problem. It's also possible that I dont understand the concept correctly.
> >
> > I want to redrect a user to a page where they can edit their address. In
> > Spring MVC I would redirect the user to /editAddress.do?id=persons_id.
> > As you can see I would pass the id of the logged in person to the url
> > and the controller will verify that the passed id is the same as the
> > currently logged in user and then the controller will load the users
> > address and display it on the screen.
> >
> > I want to do the same in jsf. I have a user profile page and on that
> > page, users can edit their address by pressing a button. I have attached
> > an action to the button and created the method in the Page object. This
> > method is editAddress. In jsf if I want to redirect to the edit address
> > page but it turns out that I cant supply parameters in the navigation
> > xml file. I read on the Internet that I have to load the edit address
> > page using it's bean name and then fill in the information in the edit
> > address bean and then return the flow id. That I must return the flow id
> > is great because that way no url's are defioned in page objects but that
> > I must load the page bean with the following code is really and I mean
> > really hard to understand:
> >
> > FacesContext facesContext = FacesContext.getCurrentInstance( );
> > ExpressionFactory factory = facesContext.getApplication(
> > ).getExpressionFactory( );
> > EditAddressPage page = factory.createValueExpression(
> > facesContext.getELContext( ), PAGE_NAME, Object.class
> > ).getValue(FacesContext.getCurrentInstance().getELContext());
> >
> > I then need to fill the edit address page with the address data. I
> > thought jsf was supposed to be easy to use but this is ridiculous. Can
> > someone please tell me if there is a much easier way to pass information
> > onto a page either via a parameter or some other way, preferably via
> > parameters and as a redirect instead of an internal forward.
> >
> > Thanks in advance,
> > Martyn
> >
> >
> >
> >
> >
> >
> 
> 
> -- 
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces

Reply via email to