Hi Bernd

Looking at your code I think the following should give the desired output:

Iterator cCollection = (Content)cIndex.getContent ( "colMessages" ).getChildren().iterator();
while (cCollection.hasNext()) {
        Content tmp = (Content) cCollection.next();
response.getWriter().write ( cCollection.getNodeData ("messageText").getString() );
}


not tested as written above but similarly used on various occations.

hth
Thomas



On 08.09.2006, at 08:57, Bernd Brenner wrote:

Good Morning Sameer,

thanks for your tip! I am happy to be able to get the content of my webpage out of the repository. I tried it sucessfully on a page with a single paragraph (no collection).

But using it on a collection, I am still stuck. I am struggeling with the access to the value of "messageText" in my contentCollection. On my template I have:

--------------------- BEGIN --------------------------------------------
<cms:contentNodeIterator contentNodeCollectionName="colMessages">
        <cms:adminOnly>
                <cms:editBar/>
        </cms:adminOnly>
        <cms:out nodeDataName="messageText"/> <br>
</cms:contentNodeIterator>

<cms:adminOnly>
<cms:newBar contentNodeCollectionName="colMessages" paragraph="parSingleMessage"/>
--------------------- END --------------------------------------------

The dialog "dlgSingleMessage" assigned to the paragraph "parSingleMessage" has only one edit contol called "messageText", which I want to display here.

In my servlet, I open the node for the website according to your instructions:


--------------------- BEGIN -------------------------------------------- HierarchyManager hm = ContentRepository.getHierarchyManager ("website");
Content cIndex = hm.getContent("/index");
--------------------- END --------------------------------------------


Now I want to print all the 0 to n "messageText" fields of the paragraphs entered by the user, but here I get stuck. I tried various ways, my last try was this:


--------------------- BEGIN -------------------------------------------- Content cCollection = (Content)cIndex.getNodeDataCollection ( "colMessages" ); Iterator nodeDataIterator = Collection.getNodeDataCollection ().iterator();
while (nodeDataIterator.hasNext()) {
        NodeData nodeData = (NodeData) nodeDataIterator.next();
response.getWriter().write ( nodeData.getNodeData ("messageText").getString() );
}
--------------------- END --------------------------------------------


I know that this code is wrong :-) because I don't get the data :-)
Maybe I do miss an outer iteration for the paragraphs?

Would you please give me a little hint how to get the information?

Thank you very much in advance.

Best regards from Munich,
Bernd


Sameer Charles schrieb:
Its straight forward
1) If you don't care for access control you can use system session
HierarchyManager hm = ContentRepository.getHierarchyManager ("website");
//then use hm to access any content
Content home = hm.getContent("/home");
2) else use currently logged-in user session
HierarchyManager hm = SessionAccessControl.getHierarchyManager ("website");
Cheers
- Sameer
On Sep 7, 2006, at 10:09 AM, Bernd Brenner wrote:
Hi Sammeer,

thanks a lot for your awnser!

I am sorry, I forgot to say that I use Magnolia Version 2.1.5

Thank you

Bernd


Sameer Charles schrieb:
Hi Bernd,
For jsp-Pages it is a very good solution and every page gets an "Resource" object which serves the repository data in a comfortable way. But for a servlet/manual code it is not so easy :-( After digging deep into the sources, I still could not find out how to get the data out of the repository. I see that accessing the repository manually is a little bit complicated, e.g. using an AccessManager, creating a Session first etc.
My question:
Does anyone (maybe Sameer :-) who developed a lot of magnolia code concering the persistence) have a piece of exsample code or a "howto" for this issue that could help me find my way?
Assuming you are using magnolia 3 RC
You need to set MgnContext if your request goes directly to your custom servlet.
this is how you do it:
WebContext webContext = (WebContext) FactoryUtil.getInstance (WebContext.class);
webContext.init(request);
MgnlContext.setInstance(webContext);
// now you should be able to access HierarchyManager on this context HierarchyManager websiteHierarchy = webContext.getHierarchyManager("website");
Hope this helps
Regards,
Sameer Charles
Magnolia International Ltd.
------------------------------------------------------------------- -------------- [EMAIL PROTECTED] http:// www.magnolia.info
Magnolia®  - Simple Enterprise Content Management
------------------------------------------------------------------- -------------- On Sep 7, 2006, at 9:14 AM, Bernd Brenner wrote:
Hello all,

I am getting slowly in deep trouble, because I have promised my customer a solution which I could not yet implement in magnolia.

There is a template-page with a flash elment embedded. The customer should be able to edit the flash contents via magnolia.

So I configurated a paragraph and a dialog which he will call to enter his data. But how the flash element will get its information to display?

The idea is to develop a servlet which collects the data out of the repository and generates an xml document out of it. When the user requests the jsp-Page, the flash element will call the servlet and "eat" the xml to display the data.

My Problem:
For jsp-Pages it is a very good solution and every page gets an "Resource" object which serves the repository data in a comfortable way. But for a servlet/manual code it is not so easy :-( After digging deep into the sources, I still could not find out how to get the data out of the repository. I see that accessing the repository manually is a little bit complicated, e.g. using an AccessManager, creating a Session first etc.

My question:
Does anyone (maybe Sameer :-) who developed a lot of magnolia code concering the persistence) have a piece of exsample code or a "howto" for this issue that could help me find my way?

Or maybe I am on a completely wrong way with my idea, hopefully not ...

Thanks for any hins,

Bernd

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

----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------
Regards,
Sameer Charles
Magnolia International Ltd.
--------------------------------------------------------------------- ------------ [EMAIL PROTECTED] http:// www.magnolia.info
Magnolia®  - Simple Enterprise Content Management
--------------------------------------------------------------------- ------------ ----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

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


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

Reply via email to