[opencms-dev] get title of resource with jstl

Chapmanl99 at aol.com Chapmanl99 at aol.com
Wed Apr 21 15:56:04 CEST 2010


Thank you so much for your suggestion.  I did finally find a solution  but 
I may experiment with these ideas as well.
 
Lynn
 
 
In a message dated 4/21/2010 2:58:02 A.M. Central Daylight Time, yg at mind.lu 
 writes:

Hi  Lynn,

the cms:titleTag was a hypotethical proposal in my original  question.

Try to use cms:property, that does what you  need:

<cms:property name='Title' file='/en/sitemap.html' />  or
<cms:property name='Title' file='${myVar}' />

read more  about it here:
_http://www.bng-galiza.org/opencms/opencms/alkacon-documentation/documentati
on_taglib/docu_tag_property.html_ 
(http://www.bng-galiza.org/opencms/opencms/alkacon-documentation/documentation_taglib/docu_tag_property.html) 

yves

On 21 April 2010 04:00, chapmanl99 <_chapmanl99 at aol.com_ 
(mailto:chapmanl99 at aol.com) > wrote:


I  would like to use this code but give it a variable containing the  
filename.
I'm trying to produce a list of files in a folder using the  Title property
of each file.  There are several code examples on the  web but none that I
can find work correctly.  This is what I have so  far. I used your 
suggestion
for the two cms tagTitle lines but they  produce an error.

<%@ page session="false" buffer="none"  import="java.sql.*, com.onr.*,
java.util.*,org.opencms.search.*,  org.opencms.flex.*, org.opencms.util.*,
org.opencms.jsp.*,  org.opencms.frontend.templateone.modules.*,
org.opencms.main.*,  org.opencms.file.*" %>
<%@ taglib prefix="cms" uri="_http://www.opencms.org/taglib/cms_ 
(http://www.opencms.org/taglib/cms) "  %>
<jsp:useBean id="cmsUser"  class="org.opencms.jsp.CmsJspActionElement">
<%  cmsUser.init(pageContext, request, response);  %>
</jsp:useBean>
<%

CmsJspActionElement action =  new
CmsJspActionElement(pageContext,request,response);
CmsObject cms =  action.getCmsObject();

try {

List  listFolders =
cms.getSubFolders(_action.info_ (http://action.info/) 
("opencms.request.folder"));
CmsFolder cmsfolder= null;
for(int i=0;i<listFolders.size();i++){
cmsfolder=(CmsFolder)  listFolders.get(i);
%>
"<cms:link  /<%=cmsfolder.getName()%></cms:link>"><%=cmsfolder.getName()%>
<%   out.println("<br>");
}

List listFiles  =
cms.getFilesInFolder(_action.info_ (http://action.info/) 
("opencms.request.folder"));
for(int i=0;i<listFiles.size();i++){
CmsFile cmsfile= (CmsFile)  listFiles.get(i);
String propertyname = "title";
String filename =  cmsfile.getName();
%>

<cms:titleTag file='site-event-reporting.jsp'/>
<cms:titleTag file =  filename/>


"<cms:link  /<%=cmsfile.getName()%></cms:link>"><%=cmsfile.getName()%>
<%   out.println("<br>");
}

}  catch (CmsException e) {
out.println(e);
}
%>

These two lines in the  middle of the code:
<cms:titleTag file='site-event-reporting.jsp'/>
<cms:titleTag file =  filename/>

do not work for me.  I get "No tag "titleTag"  defined in the library
imported with prefix cms" error.  I'm using  opencms 6.  Could that be the
problem.  I would appreciate any  help with this.
Lynn





Yves Glodt-5 wrote:
>
> On Wednesday  18 February 2009, Yves Glodt wrote:
>>  Hello,
>>
>> is there a way to get the title of a resource  with an opencms tag, à la
>> <cms:titleTag  file="/folder/file.html" /> ?
>
> Fool, of course it  is!
>
> <cms:property name='Title' file='/en/sitemap.html'  />
>
> doc-reading helps... :-)
>
>> best  regards,
>> Yves
>>
>>
>>  _______________________________________________
>> 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_ 
(http://lists.opencms.org/mailman/listinfo/opencms-dev) 
>
>
>
>
>  _______________________________________________
> 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_ 
(http://lists.opencms.org/mailman/listinfo/opencms-dev) 
>



--
View this message in context: 
_http://old.nabble.com/get-title-of-resource-with-jstl-tp22080788p28287942.html_ 
(http://old.nabble.com/get-title-of-resource-with-jstl-tp22080788p28287942.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_ 
(http://lists.opencms.org/mailman/listinfo/opencms-dev) 







_______________________________________________
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 --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20100421/744948ec/attachment.htm>


More information about the opencms-dev mailing list