|
From: <jue...@we...> - 2004-11-10 19:17:01
|
The "redirect:" prefix is checked in UrlBasedViewResolver, so all its =
subclasses (InternalResourceViewResolver, VelocityViewResolver, =
FreeMarkerViewResolver) will recognize it.
=20
Juergen
=20
________________________________
Von: spr...@li... im Auftrag =
von Dion Almaer
Gesendet: Mi 10.11.2004 19:54
An: spr...@li...
Betreff: RE: [Springframework-developer] successView changes
Actually I just have a
org.springframework.web.servlet.view.velocity.VelocityViewResolver right
now.
D
-----Original Message-----
From: Colin Sampaleanu [mailto:col...@ex...]
Sent: Wednesday, November 10, 2004 11:00 AM
To: spr...@li...
Subject: Re: [Springframework-developer] successView changes
No. I am assuming right now you are using InternalResourceViewResolver.
All you would need to do is define the view name literal (which should =
still
be in the config, not hardcoded in the controller) as
redirect:viewFoo.html
in this particular case. Then the controller can just do
return new ModelAndView(getSuccessView(), "id", theId));
InternalResourceViewResolver (or rather its superclass
UrlBasedViewResolver) will see the 'redirect:' prefix, and create and =
use a
RedirectView itself. So the nice thing is that that controller no longer
needs to know that there is a redirect. Now keep in mind that there's
limitations to the opacity though, in terms of whether control will go =
to an
internal view or to a redirect, since on a redirect all the model params
need to go on the URL. So same as before, you can't stick in any =
arbitrary
complex property into the model and expect to be able to do a =
redirect...
Colin
Dion Almaer wrote:
>So to use the new redirect: I would change from onSubmit to
>doSubmitAction right?
>
>And then it will magically put the form object as the model and will
>create the url from that?
>
>Cheers,
>
>Dion
>
>-----Original Message-----
>From: Colin Sampaleanu [mailto:col...@ex...]
>Sent: Wednesday, November 10, 2004 8:08 AM
>To: spr...@li...
>Subject: Re: [Springframework-developer] successView changes
>
>Also, if you're willing to go to CVS code (which will be 1.1.2 in a few
>days), you can rely on the new redirect: prefix support, and get away
>from the controller knowing that a RedirectView is used at all.
>
>
>Dion Almaer wrote:
>
>=20
>
>>Colin -
>>
>>You are the man :)
>>
>>return new ModelAndView(new RedirectView(getSuccessView(), true),
>>"id", theId));
>>
>>Is all I needed.
>>
>>Cheers,
>>
>>Dion
>>
>>
>>-----Original Message-----
>>From: Colin Sampaleanu [mailto:col...@ex...]
>>Sent: Tuesday, November 09, 2004 11:03 PM
>>To: spr...@li...
>>Subject: Re: [Springframework-developer] successView changes
>>
>>Dion,
>>
>>I presume you are actually using this view as a RedirectView? That's
>>the only thing that makes sense, given that you're playing around with
>>the name as if it's a URL, and the fact that it has .html at the end;
>>I presume this is mapped to another controller?
>>
>>In any case, you shouldn't be manipulating the view name at all. What
>>you should be doing is just setting the id as a model object, and
>>letting RedirectView build the URL for you:
>> return new ModelAndView(new RedirectView(getSuccessView(), true),
>>"id", theId));
>>
>>Now do you have a problem with the controller itself knowing the name
>>of the param?
>>
>>Colin
>>
>>
>>Dion Almaer wrote:
>>
>>
>>
>> =20
>>
>>>Hi guys -
>>>
>>>I run into the following use case a lot:
>>>
>>>- Create a new FOO
>>>- On success I want to SHOW that FOO
>>>
>>>Ideally I would want to:
>>>
>>><property
>>>name=3D"successView"><value>viewFoo.html?id=3D$request['id']</value></=
pro
>>>p
>>>e
>>>rty>
>>>
>>>viewFoo.html?id=3D$request['id]
>>>
>>>Could of course be something else like: id=3D$id or
>>>$request.getParameter("id") or whatever.
>>>
>>>But it would be really nice to be able to do something like this
>>>instead of having my controller do a
>>>
>>>.... getSuccessView() + "id=3D" + theId ....
>>>
>>>If there another clean way to do this that I am missing?
>>>
>>>Cheers,
>>>
>>>Dion
>>> =20
>>>
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld =
Reader's
Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=3D5588&alloc_id=3D12065&op=3Dclick
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=3D5588&alloc_id=3D12065&op=3Dclick
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|