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

mihai lacusteanu mihailacusteanu at gmail.com
Tue Mar 14 15:43:26 CET 2017


But is there a way to modify the content? I need to change a field from the
resource type any time another field gets modified.
I have 2 fields: *folder*, and *listOfFiles* and I need to update the
*listOfFiles* field any time the *folder* field gets modified.
I don't know how to do that in the formatter..or there is another place for
putting my code?(I guess that regenerating the *listOfFiles* any time the
page loads is not a good idea)

On Tue, Mar 14, 2017 at 4:20 PM, Patric Dosch <
patric.dosch at virtual-identity.com> wrote:

> 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@
> 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> 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@
> opencms.org] *Im Auftrag von *mihai lacusteanu
> *Gesendet:* Dienstag, 7. März 2017 16:49
> *An:* 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
>
>
>
>
> _______________________________________________
> 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/77e11211/attachment.htm>


More information about the opencms-dev mailing list