JSTL and String manipulation

M

Mick

Hello,

I have following code in my JSP. I would like to code it nicer if JSTL
can really do it. I would like to avoid scriplet code if possible.

br

-MP

// selectedOnes is a String that is concatenated

<c:if test="${forwardingEnabled}">
<% selectedOnes = "1"; %>
</c:if>
<c:if test="${ccIncomingEnabled}">
<%
if(selectedOnes.length() == 0)
selectedOnes = "2";
else
selectedOnes += ";2";
%>
</c:if>
<c:if test="${ccOutgoingEnabled}">
<%
if(selectedOnes.length() == 0)
selectedOnes = "3";
else
selectedOnes += ";3";
%>
</c:if>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top