Hi,
That's my solution. Not elegant, but works.... :P
Now, you can include .jsp partials depending of the theme selected, or
even change all the page HTML structure if you want.
Template
===================
WEB-INF/classes/
|-- theme1.properties
|-- theme2.properties
`-- default.properties
WEB-INF/views/jsp/
`-- template1/
`-- ui/
|-- casConfirmView.jsp
|-- casGenericSuccess.jsp
|-- casLoginView.jsp
|-- casLogoutView.jsp
|-- includes/
| |-- bottom.jsp
| `-- top.jsp
|-- serviceErrorSsoView.jsp
|-- serviceErrorView.jsp
`-- my_includes/
|-- theme1.jsp
|-- theme2.jsp
`-- default.jsp
top.jsp
===================
Add this line:
<c:set var="mytheme">my_includes/<spring:theme
code="theme_view"/>.jsp</c:set>
casLoginView.jsp
===================
<jsp:include page="${mytheme}"/>
theme1.properties
===================
...
theme_view=theme1
...
theme2.properties
===================
...
theme_view=theme2
...
default.properties
===================
...
theme_view=default
...
Cheers!
El mar, 23-03-2010 a las 23:35 -0400, Scott Battaglia escribió:
> I don't believe Spring's Theme Resolver supports the notion of
> swapping views.
>
>
> You'd probably need to write a custom ViewResolver to do that (unless
> Spring has a dynamic one).
>
>
> Cheers,
> Scott
>
>
>
> 2010/3/23 Juan José Vidal <[email protected]>
> Hi,
>
> How can I get different views for different services?
>
> - I've two themes: theme1 and theme2
> - theme1 as default (cas.properties)
> - I've two services: service1 and service2
> - theme1 for service1 (Service Manager)
> - theme2 for service2 (Service Manager)
>
> When I access to service2 I see the theme1, but <spring:theme
> code='css' /> show me theme2 in the JSP. Well... themes are
> OK, but
> views doesn't work! Any ideas?
>
>
> My Structure
> **************************************************
>
> 1) WEB-INF/view/jsp/
> ------------------------------------------
>
> `-- theme1
> `-- ui
> |-- casConfirmView.jsp
> |-- casGenericSuccess.jsp
> |-- casLoginView.jsp
> |-- casLogoutView.jsp
> |-- includes
> | |-- bottom.jsp
> | `-- top.jsp
> |-- serviceErrorSsoView.jsp
> `-- serviceErrorView.jsp
>
> `-- theme2
> `-- ui
> |-- casConfirmView.jsp
> |-- casGenericSuccess.jsp
> |-- casLoginView.jsp
> |-- casLogoutView.jsp
> |-- includes
> | |-- bottom.jsp
> | `-- top.jsp
> |-- serviceErrorSsoView.jsp
> `-- serviceErrorView.jsp
>
>
>
> 2) cas.properties
> ------------------------------------------
> [...]
>
> cas.themeResolver.defaultThemeName=theme1
> cas.viewResolver.basename=theme1_views <---- default value
>
> [...]
>
>
>
>
> 3) cas-servlet.xml
> ------------------------------------------
>
> [...]
>
> <!-- Theme Resolver -->
> <bean id="themeResolver"
> class="org.jasig.cas.services.web.ServiceThemeResolver"
> p:defaultThemeName="${cas.themeResolver.defaultThemeName}"
> p:servicesManager-ref="servicesManager"
> p:argumentExtractors-ref="argumentExtractors" />
>
> <!-- View Resolver -->
> <bean id="viewResolver"
>
> class="org.springframework.web.servlet.view.ResourceBundleViewResolver"
> p:order="0">
> <property name="basenames">
> <list>
>
> <value>${cas.viewResolver.basename}</value> <------------- A
> constant????
> <value>protocol_views</value>
> </list>
> </property>
> </bean>
>
> [...]
>
>
>
> 4) WEB_INF/classes/theme1_views.properties
> ------------------------------------------
>
>
> ### Login view (/login)
> casLoginView.(class)=org.springframework.web.servlet.view.JstlView
> casLoginView.url=/WEB-INF/view/jsp/theme1/ui/casLoginView.jsp
>
> [...]
>
>
> 5) WEB_INF/classes/theme2_views.properties
> ------------------------------------------
>
> ### Login view (/login)
> casLoginView.(class)=org.springframework.web.servlet.view.JstlView
> casLoginView.url=/WEB-INF/view/jsp/theme2/ui/casLoginView.jsp
>
> [...]
>
>
> 6) WEB_INF/classes/theme1.properties
> ------------------------------------------
> css=theme1
>
>
>
> 7) WEB_INF/classes/theme2.properties
> ------------------------------------------
> css=theme2
>
>
> 8) WEB_INF/views/jsp/theme1/ui/casLoginView.jsp
> ------------------------------------------
> <h1><spring:theme code='css' /></h1>
>
>
> 9) WEB_INF/views/jsp/theme2/ui/casLoginView.jsp
> ------------------------------------------
> <h1><spring:theme code='css' /></h1>
>
>
> I've read this thread
> http://www.mail-archive.com/[email protected]/msg06161.html
> , but I don't see any solution.
>
>
>
> Thanks in advance!
>
> --
> Juan José Vidal Agustín
> ATICA - Sección de Telemática
> Universidad de Murcia
> Tlf: +34 868888742
> Fax: +34 868888337
> [email protected]
>
>
> --
> You are currently subscribed to [email protected] as:
> [email protected]
> To unsubscribe, change settings or access archives, see
> http://www.ja-sig.org/wiki/display/JSG/cas-user
>
>
> --
> You are currently subscribed to [email protected] as: [email protected]
> To unsubscribe, change settings or access archives, see
> http://www.ja-sig.org/wiki/display/JSG/cas-user
--
Juan José Vidal Agustín
ATICA - Sección de Telemática
Universidad de Murcia
Tlf: +34 868888742
Fax: +34 868888337
[email protected]
--
You are currently subscribed to [email protected] as:
[email protected]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/cas-user