JSP import all the files in a directory

0

Is it possible to import all files in a directory with just one call working with JSP ?

Today I have the following:

<script src="../resources/js/angular/directive/layout/mensagem.js"
    charset="utf-8"></script>
<script src="../resources/js/angular/directive/layout/cabecalho-interno.js"
    charset="utf-8"></script>

I want something of the genre:

<script src="../resources/js/angular/directive/layout/*.js"
    charset="utf-8"></script>
    
asked by anonymous 14.03.2016 / 17:06

2 answers

0

Import all at once I've never seen it, but if it's too many imports, you can isolate them into one file and import.

<%@ include file="imports.html" %>
<jsp:include page="imports.html" />
    
14.03.2016 / 18:32
0

Unfortunately this is not yet supported by the JSP ..

Some contour solutions:

1 - Overwrite method encodeEnd() of ScriptRenderer .. (This is kind of tricky .... and depends also on the JSF version ..)

2 - Put the list of files in bean and make a repeat loop to go through that property and add in head , something like:

<ui:repeat value="#{seuBean.arquivos}" var="arq">
    <h:outputScript library="javascript" name="#{arq}" target="head" />
</ui:repeat>
    
14.03.2016 / 18:49