spring mvc / opencms integration

View: New views
9 Messages — Rating Filter:   Alert me  

spring mvc / opencms integration

by Andy Thompson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: spring mvc / opencms integration

by Jordi Martí :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We are used to do it with struts, not with spring mvc; but I guess that it
should be the same. In fact, we user spring beans + struts and opencms.

The trick is that JSPs should be in opencms VFS; and then, from your
servlets, you redirect to /opencms/xxxx.jsp, being /opencms/ the name of
your cms servlet.

Don't forget to put your spring libraries inside web-inf/lib of your opencms
container.

HTH  

JORDI MARTI
Email: jmarti AT* theinit xDOTx com
 


_______________________________________________
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

Re: spring mvc / opencms integration

by Martin Höller :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 30 Nov 2007, Andy Thompson wrote:

> anybody have pointers on how to accomplish this?

Not for spring but for struts and I guess it's quite similar:
http://opencms-wiki.org/Struts

It would be nice if you could enhance this articel or write a new one for
spring.

hth,
- martin
--
Martin Höller                   | martin.hoeller@...
*x Software + Systeme           | http://www.xss.co.at/
Karmarschgasse 51/2/20          | Tel: +43-1-6060114-30
A-1100 Vienna, Austria          | Fax: +43-1-6060114-71



_______________________________________________
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

signature.asc (196 bytes) Download Attachment

Re: spring mvc / opencms integration

by Andy Thompson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

i wouldn't mind doing that.  but right now i'd be content with confirmation that's it's possible to use a non opencms mvc framework and still have access to opencms taglibs. 

On Dec 3, 2007 2:42 AM, Martin Hoeller <martin.hoeller@...> wrote:
On 30 Nov 2007, Andy Thompson wrote:

> anybody have pointers on how to accomplish this?

Not for spring but for struts and I guess it's quite similar:
http://opencms-wiki.org/Struts

It would be nice if you could enhance this articel or write a new one for
spring.

hth,
- martin
--
Martin Höller                   | martin.hoeller@...
*x Software + Systeme           | http://www.xss.co.at/
Karmarschgasse 51/2/20          | Tel: +43-1-6060114-30
A-1100 Vienna, Austria          | Fax: +43-1-6060114-71


_______________________________________________
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



--
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

Re: spring mvc / opencms integration

by Martin Höller :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 03 Dec 2007, Andy Thompson wrote:

> i wouldn't mind doing that.  but right now i'd be content with confirmation
> that's it's possible to use a non opencms mvc framework and still have
> access to opencms taglibs.

This is definitely possible!

Aside from the link to the struts-page on opencms-wiki.org see also the
JSF article, which is a bit more detailed:
http://opencms-wiki.org/Java_Server_Faces_%28JSF%29

hth,
- martin
--
Martin Höller                   | martin.hoeller@...
*x Software + Systeme           | http://www.xss.co.at/
Karmarschgasse 51/2/20          | Tel: +43-1-6060114-30
A-1100 Vienna, Austria          | Fax: +43-1-6060114-71



_______________________________________________
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

signature.asc (196 bytes) Download Attachment

Re: spring mvc / opencms integration

by Sebastian Himberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


_______________________________________________
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

Re: spring mvc / opencms integration

by Andy Thompson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

much thnx sir!

On Dec 4, 2007 5:07 AM, Sebastian Himberger <sebastian.himberger@...> wrote:
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


_______________________________________________
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



--
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

Re: spring mvc / opencms integration

by Mathias Lin | SYSVISION :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In recent projects we have used the Spring MVC integrated into OpenCms. This topic is not new to the OpenCms community, as it has already been covered a little in the OpenCms wiki and also Bearingpoint provides an open source submodule in their Commons-Project at Sourceforge.

Nevertheless, we make our small 'getting-started' project available now - it's aimed for developers who want to integrate Spring & Hibernate into OpenCms for the first time and would like to have a ready-to-go starting point/project setup.
The project includes Eclipse and NetBeans project files as well as the ant build file.
We used it for OpenCms7.0.5 and OpenCms7.5. With these OpenCms versions, the versions of the depending lib files used by Spring and OpenCms should not conflict. (We didn't use it with OpenCms6 yet).

SVN:
http://svn.sysvision.net:9027/svn/com.sysvision.opencms.spring/
User: anon, Password: anon

or download as zip from:
http://www.sysvision.de/en/expertise/cms/solutions/opencms_spring_integration.html

The project contains a Readme.pdf how to use it. We hope it's useful to someone and are open for any comments, suggestions and improvements.

(A note regarding Hibernate: we don't use the OpenSessionInViewPattern (OSIV), so you won't find it in the project. If you want/need it, you will find infos about it in the opencms-wiki.org)

Mathias
Mathias Lin
SYSVISION USA, Inc.
http://www.sysvision.com

Re: spring mvc / opencms integration

by Per-Olof Widström-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mathias Lin | SYSVISION wrote:

> In recent projects we have used the Spring MVC integrated into OpenCms. This
> topic is not new to the OpenCms community, as it has already been covered a
> little in the OpenCms wiki and also Bearingpoint provides an open source
> submodule in their Commons-Project at Sourceforge.
>
> Nevertheless, we make our small 'getting-started' project available now -
> it's aimed for developers who want to integrate Spring & Hibernate into
> OpenCms for the first time and would like to have a ready-to-go starting
> point/project setup.
> The project includes Eclipse and NetBeans project files as well as the ant
> build file.

Thanks, I will check it out later.

_______________________________________________
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