[opencms-dev] Custom param for a singleFile

Wagner,Aaron anwagner at deq.virginia.gov
Thu Mar 6 17:03:27 CET 2008


Correct, I've also used that method.  I guess it's your personal
preferences:

<%@ page session="false" %>
<%@ page import="org.opencms.jsp.CmsJspXmlContentBean,
org.opencms.jsp.CmsJspTagContentLoad" 
%>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<cms:template element="addressBlock">
   <%CmsJspXmlContentBean content = new
CmsJspXmlContentBean(pageContext, request, response);
     CmsJspTagContentLoad contentList = (CmsJspTagContentLoad)
     content.contentload("singleFile",
"/system/modules/gov.va.deq.pao.DEQtemplate_one/elements/addressBlock/ad
dressBlock.html", false);
     contentList.hasMoreContent();
     out.println("<p style=\"margin: 0px 0px 6px 0px\"><strong>" +
content.contentshow(contentList, "Title") + "</strong></p>");
     out.println(content.contentshow(contentList, "AddressTextArea"));
   %>
</cms:template>

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 marcio.camurati
Sent: Thursday, March 06, 2008 10:48 AM
To: opencms-dev at opencms.org
Subject: Re: [opencms-dev] Custom param for a singleFile


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.


_______________________________________________
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Wagner,Aaron.vcf
Type: text/x-vcard
Size: 367 bytes
Desc: Wagner,Aaron.vcf
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080306/dd8d2231/attachment.vcf>


More information about the opencms-dev mailing list