|
From: =?iso-8859-1?Q?<jp....@ti...> - 2003-07-02 15:32:26
|
Hi Juergen,=0D=0A=0D=0AOk, as I have a way to retrieve the current theme =
in the view, I'm happy.=0D=0A=0D=0ANevertheless, as Rod sayed one day tha=
t the view definition file will have to be reviewed, adding a 'parent' pr=
operty could be useful for avoiding repetitive properties.=0D=0A=0D=0AReg=
ards,=0D=0AJean-Pierre=0D=0A=0D=0A---------- Initial Header -----------=0D=
=0A=0D=0AFrom : j=FCrgen h=F6ller [werk3AT] <juergen.hoeller@werk3at=
.com>=0D=0ATo : "JP Pawlak" <jp....@ti...>,<springframew=
ork...@li...>=0D=0ACc : =0D=0ADate :=
Wed, 2 Jul 2003 16:02:56 +0200=0D=0ASubject : RE: [Springframework-devel=
oper] Theme issue=0D=0A=0D=0AHi JP,=0D=0A=0D=0AI can see what you were ai=
ming at. But unfortunately you've misunderstood the purpose of the Cookie=
ThemeResolver's request attribute: It is only there to override the cooki=
e 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 mean=
t to be used by application developers, not in controllers and not in vie=
ws. The attribute name contained the full CookieThemeResolver class name =
on purpose, as it is just an implementation detail.=0D=0A=0D=0AThe proper=
way to retrieve the name of the current theme is RequestContext.getTheme=
(), as used by ThemeTag underneath the hood. You can instantiate a Reques=
tContext yourself, or instruct the View implementation to add an instance=
under a specified model attribute name, like as follows:=0D=0A=0D=0A ex=
ample.class=3Dcom.interface21.web.servlet.view.InternalResourceView=0D=0A=
example.requestContextAttribute=3Drc=0D=0A example.url=3D/example.jsp=0D=
=0A=0D=0AWith this configuration, a model attribute "rc" of type RequestC=
ontext is available for the view. With JSTL, you can simply access the cu=
rrent theme name via "${rc.theme.name}" then (specifying no scope simply =
searches page -> request -> session -> application).=0D=0A=0D=0AI guess I=
haven't made RequestContext obvious enough. I'll revert the changes prom=
ptly, and add a respective comment to CookieThemeResolver.=0D=0A=0D=0AReg=
ards,=0D=0AJuergen=0D=0A=0D=0A=0D=0A-----Original Message-----=0D=0AFrom:=
JP Pawlak [mailto:jp....@ti...]=0D=0ASent: Tuesday, July 01, 200=
3 10:15 PM=0D=0ATo: spr...@li...=0D=0A=
Subject: [Springframework-developer] Theme issue=0D=0A=0D=0A=0D=0AHi Juer=
gen, everybody,=0D=0A=0D=0AI tried to test the current theme and locale i=
n a view for avoiding=0D=0Alinks to current choices. I encountered these =
issues and committed=0D=0Achanges.=0D=0A=0D=0A1) The request attribute co=
ntaining dots forces to use the brackets=0D=0Asyntax, but we can leave wi=
th this.=0D=0A2) The request attribute is a bit long: <c:when=0D=0Atest=3D=
"${requestScope['com.interface21.web.servlet.theme.CookieThemeResol=0D=0A=
ver.THEME'] =3D=3D 'xxx'}">=0D=0A3) The request attribute contains the im=
plementation class name of the=0D=0Aresolver. If we change it in the conf=
iguration, the JSP have to be=0D=0Achanged accordingly :-(. For the point=
2 and 3, I have changed the=0D=0Arequest attribute name to the fixed Str=
ing 'com.interface21.web.THEME'=0D=0Adefined now in ThemeResolver. I am a=
ware that it breaks the backward=0D=0Acompatibility, but it solves this i=
ssue from this point (I think=0D=0Aespecially on point 3).=0D=0A4) When t=
he theme is set, all is ok. But for next views, the current=0D=0Atheme na=
me is no longer available, so the default is returned. I added a=0D=0Anew=
method 'makeThemeNameAvailable' in the ThemeResolver called by a new=0D=0A=
else clause in ThemeChangeInterceptor. So, when an interceptor is used,=0D=
=0Athe request attribute is always set.=0D=0A=0D=0ARegards,=0D=0AJean-Pie=
rre=0D=0A=0D=0A=0D=0A=0D=0A=0D=0A=0D=0A----------------------------------=
---------------------=0D=0AThis SF.Net email sponsored by: Free pre-built=
ASP.NET sites including=0D=0AData Reports, E-commerce, Portals, and Foru=
ms are available now.=0D=0ADownload today and enter to win an XBOX or Vis=
ual Studio .NET.=0D=0Ahttp://aspnet.click-url.com/go/psa00100006ave/direc=
t;at.asp_061203_01/01=0D=0A______________________________________________=
_=0D=0ASpringframework-developer mailing list=0D=0ASpringframework-develo=
pe...@li...=0D=0Ahttps://lists.sourceforge.net/lists/listin=
fo/springframework-developer=0D=0A=0A=0A********** SPECIAL ADSL *********=
*=0AL'ADSL =E0 partir de 15,95 EUR/mois et le modem ADSL offert ? C'est =
en exclusivit=E9 chez Tiscali !=0APour profiter de cette offre, cliquez i=
ci: http://register.tiscali.fr/adsl/=0AOffre soumise =E0 conditions.=0A
|