|
From: <jue...@we...> - 2004-11-09 18:05:45
|
Hi Alessandro, Spring's view names are supposed to be global for the scope of a = DispatcherServlet. Hence, all controllers in the same dispatcher will = share a single view namespace. There is no support for having "local" = view names that just apply to a specific controller, with different = controllers returning the same view names but referring to different = views. Essentially, Spring does not use the same view name semantics as WebWork = here, where view names are usually local: for example, "success" or = "form". View names in Spring are rather meant to refer to shared = physical resources, thus being global (for the scope of a dispatcher): = for example, "orderForm" or "orderList". If you still want to use local-style view names, you could collect some = of your controllers into a separate DispatcherServlet context, having = their own view namespace there. Or you could use controller-specific = prefixes for view names. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Alessandro Di Bella Sent: Tuesday, November 09, 2004 6:29 PM To: spr...@li... Subject: [Springframework-developer] Using multiple view resolvers <posted & mailed> Hi, I apologize for posting this in the developer list but i did not get any answer in the users one and I'm stuck. I'm trying to put together a web app and I'm trying to understand how to = use the view resolver. I should to get the XmlViewResolver to work but i = don't understand how I can associate a specific resolver with a controller. I'll explain better. I have a MultiActionController e several SimpleFormController(s) that are mapped to different paths. I would like to be able to say that if the request is handled by the MultiActionController, the views sholuld be resolved by the = XmlViewResolver while if the request if handled by SimpleFormController foo, the views should be resolved by the resolver bar. Is this possible? Thanks Alessandro ------------------------------------------------------- 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 |
|
From: Alessandro Di B. <al...@fu...> - 2004-11-10 09:11:09
|
Hi J=FCrgen=20 I understand now. A solution I thought of is to create my own ViewResolver= =20 that acts as a proxy and depending on some criteria it will delegate to the= =20 appropriate ViewResolver. I still have a problem though, if I have more tha= n=20 a bean that implements org.springframework.web.servlet.ViewResolver, how do= I=20 tell the servlet which one to use? Thanks Alessandro j=FCrgen h=F6ller [werk3AT] wrote: > Hi Alessandro, >=20 > Spring's view names are supposed to be global for the scope of a > DispatcherServlet. Hence, all controllers in the same dispatcher will > share a single view namespace. There is no support for having "local" view > names that just apply to a specific controller, with different controllers > returning the same view names but referring to different views. >=20 > Essentially, Spring does not use the same view name semantics as WebWork > here, where view names are usually local: for example, "success" or > "form". View names in Spring are rather meant to refer to shared physical > resources, thus being global (for the scope of a dispatcher): for example, > "orderForm" or "orderList". >=20 > If you still want to use local-style view names, you could collect some of > your controllers into a separate DispatcherServlet context, having their > own view namespace there. Or you could use controller-specific prefixes > for view names. >=20 > Juergen >=20 >=20 > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...]On Behalf > Of Alessandro Di Bella > Sent: Tuesday, November 09, 2004 6:29 PM > To: spr...@li... > Subject: [Springframework-developer] Using multiple view resolvers >=20 >=20 > <posted & mailed> >=20 > Hi, >=20 > I apologize for posting this in the developer list but i did not get any > answer in the users one and I'm stuck. >=20 >=20 > I'm trying to put together a web app and I'm trying to understand how to > use the view resolver. I should to get the XmlViewResolver to work but i > don't understand how I can associate a specific resolver with a > controller. I'll explain better. I have a MultiActionController e several > SimpleFormController(s) that are mapped to different paths. > I would like to be able to say that if the request is handled by the > MultiActionController, the views sholuld be resolved by the > XmlViewResolver while if the request if handled by SimpleFormController > foo, the views should be resolved by the resolver bar. >=20 > Is this possible? >=20 > Thanks >=20 > Alessandro >=20 >=20 >=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 >=20 >=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_idU88&alloc_id=12065&opclick |
|
From: Colin S. <col...@ex...> - 2004-11-10 14:06:14
|
I added a an enhancement request in Jira a while ago http://opensource.atlassian.com/projects/spring/browse/SPR-236 which is about this issue. I see two possible solutions. One is a general view resolver that itself contains a list of other view resolvers, and delegates approproately based on a regex. The other way to approach it is to just put the regex code itself in either UrlBasedViewResolver or InternalResourceViewResolver, where the resolver would just skip its own execution if the regex didn't match, and you would just chain one or more resolvers normally, but now InternalResourceViewResolver could be something other than the last one. I should be able to get this in for 1.2... Colin Alessandro Di Bella wrote: >Hi Jürgen >I understand now. A solution I thought of is to create my own ViewResolver >that acts as a proxy and depending on some criteria it will delegate to the >appropriate ViewResolver. I still have a problem though, if I have more than >a bean that implements org.springframework.web.servlet.ViewResolver, how do I >tell the servlet which one to use? > >Thanks > >Alessandro > > >jürgen höller [werk3AT] wrote: > > > >>Hi Alessandro, >> >>Spring's view names are supposed to be global for the scope of a >>DispatcherServlet. Hence, all controllers in the same dispatcher will >>share a single view namespace. There is no support for having "local" view >>names that just apply to a specific controller, with different controllers >>returning the same view names but referring to different views. >> >>Essentially, Spring does not use the same view name semantics as WebWork >>here, where view names are usually local: for example, "success" or >>"form". View names in Spring are rather meant to refer to shared physical >>resources, thus being global (for the scope of a dispatcher): for example, >>"orderForm" or "orderList". >> >>If you still want to use local-style view names, you could collect some of >>your controllers into a separate DispatcherServlet context, having their >>own view namespace there. Or you could use controller-specific prefixes >>for view names. >> >>Juergen >> >> >>-----Original Message----- >>From: spr...@li... >>[mailto:spr...@li...]On Behalf >>Of Alessandro Di Bella >>Sent: Tuesday, November 09, 2004 6:29 PM >>To: spr...@li... >>Subject: [Springframework-developer] Using multiple view resolvers >> >> >><posted & mailed> >> >>Hi, >> >>I apologize for posting this in the developer list but i did not get any >>answer in the users one and I'm stuck. >> >> >>I'm trying to put together a web app and I'm trying to understand how to >>use the view resolver. I should to get the XmlViewResolver to work but i >>don't understand how I can associate a specific resolver with a >>controller. I'll explain better. I have a MultiActionController e several >>SimpleFormController(s) that are mapped to different paths. >>I would like to be able to say that if the request is handled by the >>MultiActionController, the views sholuld be resolved by the >>XmlViewResolver while if the request if handled by SimpleFormController >>foo, the views should be resolved by the resolver bar. >> >>Is this possible? >> >>Thanks >> >>Alessandro >> >> |