I want to output the value of the xzy variable into the value of the abc variable.
<c:set var="abc" value="<c:out value="${xyz}"/>"/>
I'm getting an error (unterminated <c:set> tag
) when I do this.
How do you do this?
JSTL Core Tags c:set allows to set the result of an expression in a variable within a given scope. Using this tag helps to set the property of 'JavaBean' and the values of the 'java. util. Map' object.
It is used to set the result of an expression evaluated in a 'scope'. The <c:set> tag is helpful because it evaluates the expression and use the result to set a value of java. util. Map or JavaBean. This tag is similar to jsp:setProperty action tag.
JSTL - Core <c:set> Tag The <c:set> tag is JSTL-friendly version of the setProperty action. The tag is helpful because it evaluates an expression and uses the results to set a value of a JavaBean or a java. util. Map object.
No, you must have well-formed markup. <c:set/>
can have body content instead of a value
attribute though:
<c:set var="abc"><c:out value="${xyz}" /></c:set>
I would only use this to take advantage of the XML-escaping provided by <c:out/>
. Otherwise it's simpler just to set the value="${xyz}"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With