Hi Simon,
            Many thanks for your two replies, I really appreciate it. Yes,
agree I don't want to go down using the magnolia Content object to get my
data out. It's just too messy, and of course too reliant on the CMS for my
liking. I'm trying to create less work when applying the CMS to the front of
my business logic, not create more work!
            Thanks for your sample JSTL page below. Unfortunately, my bit of
data isn't exactly coming from a database, but that's not really the issue I
think for me. It's more like magnolia doesn't realise the results page I am
posting to should actually run the JSTL contained within it, rather than
just thinking the page has just static html content.
             Note I have created a sample web application war, and deployed
it to the same tomcat as my magnolia is installed. This war works fine,
shows the hotel content without any errors. So, from that, I can say with
reasonable confidence my JSTL in the jsps and my servlet is working fine.
The issue really is how to do the same when running the JSTL/jsp view in
magnolia!!!
             Well, I now have two routes to take:

a) Try your example below. Means I'll create a hotel table and datasource,
and just get it working, to prove the JSTL can work in my magnolia view.

b) I have been told by a magnolia consultant I can extend the
JspTemplateRenderer to create my own business logic template renderer.
Please see the attached java file. Here are the steps one would have to make
to do that:

<magnoliaConsultant>
1. Create a class BusinessLogicTemplateRenderer class (see attached file) 
2. Define the renderer in Magnolia: in Configuration add an entry
“businesslogic” to /modules/templating/renderers with class set to
“org.mgnl.cms.spring.renderers.BusinessLogicTemplateRenderer” and type set
to “businesslogic”.
3. Create a Magnolia template and set type to “businesslogic”.

As a result you can enter your business logic in the
BusinessLogicTemplateRenderer before the template will be rendered.

You can try this very easy with the Magnolia samples templates. Just change
the template type.
</magnoliaConsultant>

The latter example is where I probably want to go long term. The reason for
this is that for us here, we have already created numerous spring beans that
contains our business logic. So, we want to package those spring beans into
a jar, deploy to WEB-INF/lib of the magnolia web apps, then create specific
business logic template renderers which call these spring beans to perform
searches/etc, then the spring beans returns objects in collections that I
would then place into page/request/session scope for the magnolia CMS view
to show. Phew, sorry, long description there, but I suspect that's what a
lot of people want from their CMS. Not only to have the initial screens in
CMS, but also the successive screens implemented in CMS, after you've hit
your pre-created business logic components.

Well, if and when I get anywhere, I'll let you know Simon. In fact, if I can
get the latter approach done, I might package it up and post to the magnolia
wiki, as the previous howto I've noted before (i.e.
http://www.magnolia.info/wiki/Wiki.jsp?page=SearchServlet) is using the old
magnolia, plus is totally missing how to create the view and how to
configure magnolia to deploy the servlet and create that view...bigs gaps
have to be filled!
Thanks Simon and best regards,
Conor

p.s. Sorry for the long email, but this isn't an easy topic to discuss
without going into detail to explain where I'm at, plus how I plan to get to
a solution.


Magnolia - User mailing list wrote:
> 
> I'm assuming you are looking to display some data from a db backend
> that's not a part of the repository.  That's easy enough.  Just create a
> paragraph that fetches the data and display's it.  You could then add
> fields to the paragraph's dialog defining different aspects of the data
> to be displayed.  The standard sql taglib could handle the query work
> and then just display it using standard jstl tags.  The following is
> adapted from the jsr-52 spec (JSTL 1.1) document:
> 
> <jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page";
> xmlns:sql="http://java.sun.com/jsp/jstl/sql";
> xmlns:c="http://java.sun.com/jsp/jstl/core";
> xmlns:cms="urn:jsptld:cms-taglib">
> 
> <cms:setNode var="pageProps" />
> <sql:query  var="hotels"
> dataSource="jdbc/myDatabase">${pageProps.query}</sql:query>
> <c:if test="${not empty hotels}">
>   <table>
>     <c:forEach var="hotel" items="${hotels}">
>       <tr>
>         <td><c:out value="${hotel.name}"/></td>
>         <td><c:out value="${hotel.hotelStarRating}" /></td>
>       </tr>
>     </c:forEach>
>   </table>
> </c:if>
> </jsp:root>
> 
> I suspect in the message your cited below, the c:forEach tag couldn't
> find your collection and the block was skipped.
> 
> --David
> 
> Conor wrote:
>> Hi Simon,
>>             Any chance you show me the link to where you posted some
>> sample
>> code? I am in a similiar situation to Dieter, in that I need to request
>> some
>> information in my backend, and want to use magnolia as a pure cms
>> frontend
>> solution. Here's my previous post on the issues I'm having:
>>
>> http://www.nabble.com/Cannot-view-session-information-using-JSTL--tf3290921.html
>>
>> Have a sample solution from magnolia, but it isn't working for me, and it
>> isn't producing any exception to prompt me where I'm going wrong!? Stuck
>> between a rock and a hard place. Seeing I'm not the only person who wants
>> to
>> interact with a different backend to Jackrabbit/JCR, would appreciate it
>> if
>> you could point me in the right way, if you can?
>> Thanks Simon,
>> Conor
>>
>> p.s. Dieter, if you have solved the issue on showing your mysql data
>> using
>> magnolia, can you please explain how you did it? Am sure you're solution
>> would work for me too...thanks in advance.
>>
>> Best,
>> Conor
>>
>>
>> Magnolia - User mailing list wrote:
>>   
>>> Hi Dieter,
>>>
>>> I've just posted some code in response to a similar request which may
>>> help. My recommendation would be to use the Magnolia APIs for all
>>> content creation and manipulation, rather than messing with the
>>> underlying data layer. This way your code should be more insulated for
>>> changes to Magnolia, Jackrabbit, JCR, etc.
>>>
>>> However, Magnolia doesn't currently have a very clean API for external
>>> integration, so it may be tricky to get everything working. I know
>>> there has been talk of a proper CMS API layer, and also a WebServices
>>> layer that would be even better for what you want to do. I don't know
>>> what the status is on either of these though. It would be good to hear
>>> from anyone that's involved in that work actually, as I have need of
>>> these features myself and would happily contribute to the development.
>>>
>>> Simon
>>>
>>> On 02/03/07, dieter <[email protected]> wrote:
>>>     
>>>> Hi,
>>>>
>>>> I have been browsing through the tables on my Magnolia repository and
>>>> have
>>>> been wondering in which tables the actual data is stored.
>>>>
>>>> My reason for asking is i would like to eventually be able to automate
>>>> creating new content externally from Magnolia. Is this possible?
>>>>
>>>> Dieter
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Viewing-MySql-tables-tf3334323.html#a9271918
>>>> Sent from the Magnolia - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>>       
> 
> 
> ----------------------------------------------------------------
> for list details see
> http://www.magnolia.info/en/developer.html
> ----------------------------------------------------------------
> 
> 
http://www.nabble.com/file/6999/BusinessLogicTemplateRenderer.java
BusinessLogicTemplateRenderer.java 
-- 
View this message in context: 
http://www.nabble.com/Viewing-MySql-tables-tf3334323.html#a9343629
Sent from the Magnolia - User mailing list archive at Nabble.com.


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------

Reply via email to