Hello, 

We want to access the different paragraphs of a page to print it. We have 
written a servlet that is being called with a page parameter. But when 
accessing the page, and browsing the paragraphs we don't get any children.

If we do the opposite. We directly go to the paragraph and walk up through the 
containers we can access the page.

I copy the code in this email. If somebody could tell us what is wrong in the 
code.

Many thanks

// In the JSP tag of the source page
String page = 
info.magnolia.cms.util.Resource.getActivePage(request).getHandle();
// Then I call the servlet with the page parameter

// The servlet code
Content content = 
MgnlContext.getHierarchyManager(ContentRepository.WEBSITE).getContent(request.getParameter("page"));
log.debug("Page handle : " + content.getHandle()) ;  // OK it return the page 
handle
if (content.getChildren().iterator().hasNext()) {
log.debug("Page children handle : " + ((Content) 
content.getChildren().iterator().next()).getHandle());  // KO No children found
} else {
log.debug("Page children not found");
}

There is no children in my iterator. It's strange because when I try to browse 
nodes from the paragraph to the paragraph container I can reach the children :

// In the JSP tag of the source paragraph
String paragraph = 
info.magnolia.cms.util.Resource.getLocalContentNode(request).getHandle();
// Then I call the servlet with the paragraph parameter

// The Servlet code
Content content = 
MgnlContext.getHierarchyManager(ContentRepository.WEBSITE).getContent(request.getParameter("paragraph"));
log.debug("Paragraph handle : " + content.getHandle()) ;  // OK return the 
paragraph handle
log.debug("Paragraph container handle : " + content.getParent().getHandle()) ;  
// OK return the paragraph container handle
if (content.getParent().getChildren().iterator().hasNext()) {                   
        
log.debug("Paragraph container children : " + ((Content) 
content.getParent().getChildren().iterator().next()).getHandle());  // OK 
return the paragraph handle
} else {
log.debug("Paragraph container children not found");
}

but if I try to reach the children of the page (the content is the paragraph)

log.debug("Page handle : " + content.getParent().getParent().getHandle()) ;  // 
OK return the page handle
if (content.getParent().getParent().getChildren().iterator().hasNext()) {       
        
log.debug("Page children handle : " + ((Content) 
content.getParent().getParent().getChildren().iterator().next()).getHandle());  
// KO No children found
} else {
log.debug("Page children not found");
}

One more time there is no children in my iterator.

What is wrong in my code? Any Idea?

System configuration

Java platform : jdk1.5.0_09

Apache Tomcat : 5.5.20

---------------------------------------------
MAGNOLIA LICENSE
---------------------------------------------
Version number : 3.0 RC1
Build          : 2. November 2006
Edition        : Enterprise Edition

Thanks a lot.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 17, 2006 7:53 AM
To: [email protected]
Subject: Re: [magnolia-user] (Head)Banner with a link

hey guillaume & co.

thank you for your help and patience. it works!

cheers,
sam


--- Guillaume Pichenot <[email protected]>
schrieb:

> Let me answer in line...
> 
> 
> Sam a écrit :
> > ...
> > <div id="img">
> >     <a
> >
>
href="${pageContext.request.contextPath}/index.html"><img
> >
> >
>
src="${pageContext.request.contextPath}/.resources/imgs/banner.jpg"
> > /></a>
> > </div>
> > </jsp:root>
> >
> > and the tiny part of my "main.css":
> > #img {
> > border: none;}
> >   
> The way you're doing it, it' the div that gets its
> border set to none. 
> #img in CSS means "select the tag whose id is img",
> and that, in what I 
> see, is a <div>. Whereas I actually think it is the
> img that should have 
> a border: none; CSS property.
> So, I guess, without changing your JSP, using
> #img img {border: none;}
> as your CSS should work. Because then, we say select
> an <img> html 
> object that is a child of #img (the tag whose id is
> "img").
> 
> 
> > I'm so pi**ed that I perhaps don't see the
> exception. 
> > By the way: the "<c:import
> > url="/templates/samples/templates/inc/banner.jsp"
> />"
> > hast to be insert in the <head> part, right? I've
> done
> > it like this:
> >  <head>
> >     
> >     <c:import
> > url="/templates/samples/templates/inc/banner.jsp"
> />
> >   
> Well, it depends, but as I see it, it shouldn't be
> there. If a jsp, any 
> jsp for that matters, writes HTML code that belongs
> to <body>, then it 
> shouldn't be called in the head. Because it's like
> writing <body> 
> content in the <head>. It's wrong. <div> and <img>
> tags belong in body, 
> not in head.
> 
> I hope this helps. This looks like a pure HTML/CSS
> issue, nothing 
> magnolia centered.
> 
> 
> 
> 
> > --- Guillaume Pichenot <[email protected]>
> > schrieb:
> >
> >   
> >> If validation matters, you can CSS like this to
> hide
> >> border around 
> >> images that are in a link :
> >>
> >> a img {border: none}
> >>
> >> Salman Elahi a écrit :
> >>     
> >>> Hi Sam
> >>>
> >>> use border ="0" in img tag
> >>>
> >>> --Salman
> >>>
> >>> -----Original Message-----
> >>> From: [email protected]
> >>>       
> >> [mailto:[EMAIL PROTECTED] 
> >>     
> >>> Sent: 16 November 2006 11:12
> >>> To: [email protected]
> >>> Subject: Re: [magnolia-user] (Head)Banner with a
> >>>       
> >> link
> >>     
> >>> Hey Vasko,
> >>>
> >>> that's exactly what I meant!! Thank's! But for
> >>>       
> >> some reason I have a border around the banner. Do
> >> you know a way to delete this?
> >>     
> >>> I tried it with the border tag but nothig
> >>>       
> >> happend.. 
> >>     
> >>> Cheers,
> >>> Sam
> >>>
> >>> --- Vasko Gjurovski <[email protected]>
> >>>       
> >> schrieb:
> >>     
> >>>   
> >>>       
> >>>> Try this:
> >>>>
> >>>> <a
> >>>>
> >>>>     
> >>>>         
> >
>
href="${pageContext.request.contextPath}/homepage.html"><img
> >   
> >>>   
> >>>       
> >>>>     
> >>>>         
> >
>
src="${pageContext.request.contextPath}/.resources/imgs/banner.jpg"/></a>
> >   
> >>>   
> >>>       
> >>>> You can put this in a different jsp (banner.jsp
> >>>>         
> >> for
> >>     
> >>>> example) and
> >>>> c:import it in the main template..
> >>>>
> >>>> Hope this is what you have been lookong for...
> >>>>
> >>>> Vasko
> >>>>     
> >>>>         
> >>>>> Hi salman,
> >>>>>
> >>>>> well, it seems not to be that easy ;) the
> banner
> >>>>>           
> >> is in a container 
> >>     
> >>>>> and i can't insert
> >>>>>       
> >>>>>           
> >>>> the <a
> >>>>     
> >>>>         
> >>>>> href> tag in there.. there's no effect.
> >>>>>
> >>>>> cheers,
> >>>>> Sam
> >>>>>
> >>>>>
> >>>>> --- Salman Elahi <[email protected]>
> >>>>>       
> >>>>>           
> >>>> schrieb:
> >>>>     
> >>>>         
> >>>>>   
> >>>>>       
> >>>>>           
> >>>>>> Hi Sam,
> >>>>>>
> >>>>>> As I understand your query...I think if you
> >>>>>>             
> >> wrap your banner in <a> 
> >>     
> >>>>>> in your template where href
> >>>>>>         
> >>>>>>             
> >>>> for
> >>>>     
> >>>>         
> >>>>>> <a> is pointing to "index"... That should do
> >>>>>>             
> >> the job.
> >>     
> >>>>>> Cheers,
> >>>>>>
> >>>>>> --Salman
> >>>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: [email protected]
> >>>>>> [mailto:[EMAIL PROTECTED]
> >>>>>> Sent: 14 November 2006 13:40
> >>>>>> To: [email protected]
> >>>>>> Subject: [magnolia-user] (Head)Banner with a
> >>>>>>             
> 
=== message truncated ===



                
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

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

************************************************************************************
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error, please notify the system manager 
([EMAIL PROTECTED]) and delete the message with any attached files from your 
system.
The confidentiality and integrity of this message cannot be guaranteed on the 
Internet and the sender does not accept liability for its content.

***********************************************************************************


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

Reply via email to