java - Array literals in JSP Expression Language? -


i've been able array literals in thymeleaf's expression language before (using...ognl?...i think...). using spring/jsp. jsp or spring expression languages support array literals? can't find reference them.

update: i'm trying do:

<c:set var="myurls" value="${new string[] {     mk:geturl(),     mk:getotherurl(),     mk:getdifferenturl() }}" /> 

you hack in scriptlet-less way little of maps, <jsp:usebean> , el 2.2.

<jsp:usebean id="map" class="java.util.linkedhashmap" /> <c:set target="${map}" property="url" value="${mk.url}" /> <c:set target="${map}" property="otherurl" value="${mk.otherurl}" /> <c:set target="${map}" property="differenturl" value="${mk.differenturl}" /> <c:set var="array" value="${map.values().toarray()}" />  <c:foreach items="${array}" var="item">     ${item}<br/> </c:foreach> 

if environment doesn't support el 2.2, stick map , access via map.

<c:foreach items="${map}" var="entry">     ${entry.value}<br/> </c:foreach> 

noted should underlying problem bigger. shouldn't manipulating model directly in view. controller responsible that. should altering model in such way it's view expects. e.g. adding property, or letting controller job.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -