views:

31

answers:

1

Hi,

I'm trying to rewrite some Spring 1.2 code to Spring 3.0 one. Currently I'm stuck with JSP resolved by URL problem. Application uses separate JSP files with different layouts for serving the same model from the same controller. The JSP is switched using interceptor, that intercepts the url and changes the view.

For example:

/design_one/mypage.htm -> MyPageController -> /design_one/mypage.jsp
/design_two/mypage.htm -> MyPageController -> /design_two/mypage.jsp

Is there a way to make same or similar functionality using something better than raw interceptors?

A: 

Well, I've found a way to do it, but not sure if it's the optimal way.

What I did, I defined a name for each theme in their resource bundle, like "name=design_one". And then using it in JSP to include some other JSP's inside.

Something like this:

<spring:theme code="theme.name" var="themeName"/>
<jsp:include page="${themeName}/head.jsp"/>
<jsp:include page="${themeName}/foot.jsp"/>
Max