From: <jue...@we...> - 2003-07-02 15:46:00
|
Hi JP, Bean parents already work, e.g.: example.class=3Dcom.interface21.web.servlet.view.JstlView example.requestContextAttribute=3Drc example1.parent=3Dexample example1.url=3D/example1.jsp example2.parent=3Dexample example2.url=3D/example2.jsp There's even a defaultParentView property in ResourceBundleViewResolver, = so that you can omit the ".parent=3D" lines above, e.g.: <bean id=3D"viewResolver" = class=3D"com.interface21.web.servlet.view.ResourceBundleViewResolver"> <property name=3D"basename"><value>views</value></property> <property = name=3D"defaultParentView"><value>example</value></property> </bean> Both solutions should make RequestContext setup quite convenient. Regards, Juergen -----Original Message----- From: jp....@ti... [mailto:jp....@ti...] Sent: Wednesday, July 02, 2003 5:32 PM To: j=FCrgen h=F6ller [werk3AT] Cc: springframework-developer Subject: RE: [Springframework-developer] Theme issue Hi Juergen, Ok, as I have a way to retrieve the current theme in the view, I'm = happy. Nevertheless, as Rod sayed one day that the view definition file will = have to be reviewed, adding a 'parent' property could be useful for = avoiding repetitive properties. Regards, Jean-Pierre ---------- Initial Header ----------- From : j=FCrgen h=F6ller [werk3AT] <jue...@we...> To : "JP Pawlak" = <jp....@ti...>,<spr...@li...> Cc :=20 Date : Wed, 2 Jul 2003 16:02:56 +0200 Subject : RE: [Springframework-developer] Theme issue Hi JP, I can see what you were aiming at. But unfortunately you've = misunderstood the purpose of the CookieThemeResolver's request = attribute: It is only there to override the cookie value if changed in = the course of the current request, to avoid reading the stale value from = the cookie in the request object. It was never meant to be used by = application developers, not in controllers and not in views. The = attribute name contained the full CookieThemeResolver class name on = purpose, as it is just an implementation detail. The proper way to retrieve the name of the current theme is = RequestContext.getTheme(), as used by ThemeTag underneath the hood. You = can instantiate a RequestContext yourself, or instruct the View = implementation to add an instance under a specified model attribute = name, like as follows: example.class=3Dcom.interface21.web.servlet.view.InternalResourceView example.requestContextAttribute=3Drc example.url=3D/example.jsp With this configuration, a model attribute "rc" of type RequestContext = is available for the view. With JSTL, you can simply access the current = theme name via "${rc.theme.name}" then (specifying no scope simply = searches page -> request -> session -> application). I guess I haven't made RequestContext obvious enough. I'll revert the = changes promptly, and add a respective comment to CookieThemeResolver. Regards, Juergen -----Original Message----- From: JP Pawlak [mailto:jp....@ti...] Sent: Tuesday, July 01, 2003 10:15 PM To: spr...@li... Subject: [Springframework-developer] Theme issue Hi Juergen, everybody, I tried to test the current theme and locale in a view for avoiding links to current choices. I encountered these issues and committed changes. 1) The request attribute containing dots forces to use the brackets syntax, but we can leave with this. 2) The request attribute is a bit long: <c:when test=3D"${requestScope['com.interface21.web.servlet.theme.CookieThemeReso= l ver.THEME'] =3D=3D 'xxx'}"> 3) The request attribute contains the implementation class name of the resolver. If we change it in the configuration, the JSP have to be changed accordingly :-(. For the point 2 and 3, I have changed the request attribute name to the fixed String 'com.interface21.web.THEME' defined now in ThemeResolver. I am aware that it breaks the backward compatibility, but it solves this issue from this point (I think especially on point 3). 4) When the theme is set, all is ok. But for next views, the current theme name is no longer available, so the default is returned. I added a new method 'makeThemeNameAvailable' in the ThemeResolver called by a new else clause in ThemeChangeInterceptor. So, when an interceptor is used, the request attribute is always set. Regards, Jean-Pierre ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer ********** SPECIAL ADSL ********** L'ADSL =E0 partir de 15,95 EUR/mois et le modem ADSL offert ? C'est en = exclusivit=E9 chez Tiscali ! Pour profiter de cette offre, cliquez ici: = http://register.tiscali.fr/adsl/ Offre soumise =E0 conditions. |