I'm a writing an application using Spring MVC which has to run as a servlet and a portlet. This is fair easy to do in Spring 3 (JSR-286) but I must use portlet 1.0 specification (JSR-168). In order to be compatible with it I downgraded Spring MVC to 2.5 (more information here).
Everything works fine expect I'm not able to generate servlet/portlet compatible URL!
Using Spring 3, I would write:
<spring:url value="/foo">
<spring:param name="action" value="foo"/>
</spring>
In Spring 2.5 there is no spring:url
tag. I tried with c:url
but it only generates servlet compatible URL (not portlet).
How can I achieve servlet/portlet compatible URL generation?
I am not sure about the solution below, but maybe it will help.
You could use the portlet tag for portlet compatible urls :
(I recommend that you to take a look at the Java Portlet 1.0 specification (JSR-168) "Portlet Tag Library" chapter for detailed information about this tag)
Then, to generate either a portlet or a servlet url, you could use a condition that detects if you are currently using Portlet or Servlet (I don't know if it is possible) :