[opencms-dev] How to list files from a folder in opencms?

Patric Dosch patric.dosch at virtual-identity.com
Tue Mar 14 15:20:12 CET 2017


Hey Mihai,

>> I don't know how to read data from the resource type(xml), which I can access using el expression.
But ${value.YourFieldName} is an el expression.
Now you need the value in your java world? Correct?


The best way should be to use a el-function. This https://newfivefour.com/tomcat7-el-custom-function.html seems to be a nice example. As far as I know the web.xml stuff is not needed anymore.


A not so nice way:

<c:set var=”yourVar” value=”${value.YourFieldName}”/>

<%
String yourVar = (String) pageContext.getAttribute(“yourVar”);
%>

Hope to understand your problem correctly.
But that are java questions and not opencms questions 😊

Regards, Patric




Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von mihai lacusteanu
Gesendet: Mittwoch, 8. März 2017 15:09
An: opencms-dev at opencms.org
Betreff: Re: [opencms-dev] How to list files from a folder in opencms?

I don't need the value to be rendered in the HTML, I need to process it in the formatter (in the Java code between <% %>. Any time the resource type is processed via formatter I need to get a url from a field and then process it, not just output it in the HTML using el expressions.
How can I do that?

Thanks!
Mihai

Pe 8 mar. 2017 4:01 p.m., "Patric Dosch" <patric.dosch at virtual-identity.com<mailto:patric.dosch at virtual-identity.com>> a scris:
>> I don't know how to read data from the resource type(xml), which I can access using el expression.
This should help: http://documentation.opencms.org/opencms-documentation/content-in-opencms/formatters-and-their-configuration/index.html#4.2

So ${value.YourFieldName} holds the information

Regards, Patric


Von: opencms-dev-bounces at opencms.org<mailto:opencms-dev-bounces at opencms.org> [mailto:opencms-dev-bounces at opencms.org<mailto:opencms-dev-bounces at opencms.org>] Im Auftrag von mihai lacusteanu
Gesendet: Dienstag, 7. März 2017 16:49
An: opencms-dev at opencms.org<mailto:opencms-dev at opencms.org>
Betreff: [opencms-dev] How to list files from a folder in opencms?

I need to create a new resource type in opencms which have 1 field. The field is for a target folder.
Every time I select a folder from VFS and save the resource(xml) the formatter will render a the list of files from the specified folder.

I managed to create a jsp file which will create the list of files needed, but only with the target folder hardcoded. I don't know how to read data from the resource type(xml), which I can access using el expression.
Can you help me?

_______________________________________________
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/cgi-bin/mailman/listinfo/opencms-dev



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20170314/e30afb80/attachment.htm>


More information about the opencms-dev mailing list