[opencms-dev] Custom param for a singleFile

marcio.camurati marcio.camurati.opencms at gmail.com
Thu Mar 6 16:47:48 CET 2008


Hi,

Another option is read it without the taglib only using the scriptlet, like
this example of the OpenCMS Documentation:

[code]
<%@ page session="false" import="org.opencms.jsp.*" %>
<%
	CmsJspXmlContentBean thisPage = new CmsJspXmlContentBean(pageContext,
request, response);
	String path = thisPage.getRequestContext().getFolderUri();
	...
	I_CmsXmlContentContainer contentContainer =
thisPage.contentload("singleFile",  path.concat("simplecontent.html"),
true);
	I_CmsXmlContentContainer elementContainer;

	while (contentContainer.hasMoreContent()) {
	...
		out.write(thisPage.contentshow(contentContainer, "Title"));		
		...
		elementContainer = thisPage.contentloop(contentContainer, "Teaser");
		while (elementContainer.hasMoreContent()) {
		...
			out.write(thisPage.contentshow(elementContainer));	
			...
		}
		...
	}
	...
%>
[/code]

Regards,
Marcio Camurati


Wagner,Aaron wrote:
> 
> I think you can only use macros in the contentload tag.  Use something
> like below.
> 
> <% pageContext.setAttribute("rname", nav.getResourceName()); %>
> 
> <cms:contentload collector="singleFile" param="${pageContext.rname}"
> editable="true">
> 
> Aaron N Wagner
> Web Developer, Office of Public Affairs
> DEQ - Virginia Department of Environmental Quality
> [W] 804.698.4265
>  
> There are 10 types of people in the world: those who understand binary,
> and those who don't. 
> 
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of
> enrarjcob at alum.us.es
> Sent: Thursday, March 06, 2008 9:10 AM
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] Custom param for a singleFile
> 
> Hi,
> 
> I'm trying to read a xml content without using patterns, this an extract
> of my code:
> 
> for (int i = 0; i < navElements.size(); i++) {
> 		CmsJspNavElement nav =
> (CmsJspNavElement)navElements.get(i); 
> 		String resName = nav.getResourceName();
> 		
> 		if(nav.isFolderLink() && oldLevel!=-1){
> 	
> result.append("\""+nav.getParentFolderName()+nav.getFileName()+"\"");
> 			
> 		%>
> 		<cms:contentload collector="singleFile" 
> 
>                         param="<%=nav.getResourceName()%>" 
> 
>                         editable="true">				
> 
> 			<div class="elemento">
> 					<cms:contentshow element="Title"
> />
> 					<cms:contentshow element="Text"
> />
> 					
> 			</div>
> 			</cms:contentload>
> 		
> 	<%	
> 		} %>
> 
> When I execute it, there is an error:
> 
> Error /WEB-INF/jsp/offline/sites/default/ER/recorrido.jsp(44,2)
> According to TLD or attribute directive in tag file, attribute param
> does not accept any expressions
> 
> 
> I think, I cant use this expresion in "param", so How can i do that
> then?
> 
> Thanxs!
> 
> _______________________________________________
> 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
> 
> BEGIN:VCARD
> VERSION:2.1
> N:Wagner;Aaron
> FN:Wagner,Aaron
> ORG:;OEM
> TITLE:(804) 698-4265
> TEL;WORK;VOICE:4265
> ADR;WORK:;652;629 E. Main Street;Richmond;VA;23240;UNITED STATES
> LABEL;WORK;ENCODING=QUOTED-PRINTABLE:652=0D=0A629 E. Main
> Street=0D=0ARichmond, VA 23240=0D=0AUNITED STATES
> EMAIL;PREF;INTERNET:anwagner at deq.virginia.gov
> REV:20060905T140018Z
> END:VCARD
> 
> 
> _______________________________________________
> 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
> 

-- 
View this message in context: http://www.nabble.com/Custom-param-for-a-singleFile-tp15874388p15875658.html
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.




More information about the opencms-dev mailing list