[opencms-dev] spring mvc / opencms integration
Sebastian Himberger
sebastian.himberger at gmx.de
Tue Dec 4 11:07:28 CET 2007
Hi Andy,
it's possible. This is from my spring-<servlet>.xml:
<bean
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/user/register/customer=customerRegistrationController
/user/register/business=businessRegistrationController
/user/activate=activationController
/user/login=loginController
/user/account=profileController
</value>
</property>
</bean>
<bean id="opencmsViewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/opencms/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
This is an example JSP inside the OpenCms VFS:
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<cms:include property="template" element="head"/>
<h1>...</h1>
<div class="featureForm">
<form:form>
<form:errors path="*" cssClass="errorBox" />
<cms:include file="base-info.jsp"/>
<fieldset>
<legend>Your data</legend>
<label>Firstname</label><form:input path="firstname"/><br/>
<label>Lastname</label><form:input path="lastname"/><br/>
<cms:include file="/views/commons/address-form.jsp"/>
</fieldset>
<p>... privacy statements ...</p>
<button type="submit">Send</button>
</form:form>
</div>
<cms:include property="template" element="foot"/>
I'm currently doing an EJB3/Acegi/Spring/OpenCms 7 project. If you have
further questions don't bother to ask. I'm a bit busy these weeks but it
is my plan to write an article about this as soon as the project is
finished.
best regards,
Sebastian
Andy Thompson schrieb:
> anybody have pointers on how to accomplish this?
>
> currently we have a single web application. but the view portion of
> the application is divided up into springmvc and opencms. what i'd
> like to do is to migrate the jsps currently being used by spring mvc
> into opencms. but i want to continue to use elements that we're
> currently using (spring:bind).
>
> i'm relatively confident that i could put the jsps inside opencms -
> and then just point the spring mvc application to where opencms
> exports it's jsps. but what i'd really like is to be able to reuse
> the header/footer templates inside opencms in my jsps.
>
> --
> Andrew R. Thompson
> Currently in N.Y *not* Consulting
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list