B
Berlin Brown
I have a jsp jstl question. It is actually kind of simple, but I still
couldnt get an answer. And it is more of a design question.
How do you do 'processing' or manipulation of a string value 'after' it
has been processed through 'el' jstl?
"I am having trouble doing basic view manipulation on data output from
the expression language. I dont 'think' I need custom tags for this,
and dont think this logic should occur at the controller or model? But
for example, if I want to modify a value before it is display to the
user but after it has been evaluated: Ie."
This is my current approach.
Would it have been more logical to place:
"<jsp:useBean id="concatValue"
class="org.spirit.servlet.bean.BotListConcatValue" />
<jsp:setProperty name="concatValue" property="maxLen" value="20" />"
Within the 'forEach' bracket?
Logic in the bean:
public String getWord() {
if (word != null && (word.length() > (maxLen + 3))) {
word = word.substring(0, (maxLen - 1)) + "...";
}
return word;
}
<jsp:useBean id="concatValue"
class="org.spirit.servlet.bean.BotListConcatValue" />
<jsp:setProperty name="concatValue" property="maxLen" value="20" />
<c:forEach items="${linklistings}"
var="listing" varStatus="status">
<c:set target="${concatValue}" property="word"
value="${listing.urlTitle}"/>
<cut value="${concatValue.word}" />
</c:forEach>
couldnt get an answer. And it is more of a design question.
How do you do 'processing' or manipulation of a string value 'after' it
has been processed through 'el' jstl?
"I am having trouble doing basic view manipulation on data output from
the expression language. I dont 'think' I need custom tags for this,
and dont think this logic should occur at the controller or model? But
for example, if I want to modify a value before it is display to the
user but after it has been evaluated: Ie."
This is my current approach.
Would it have been more logical to place:
"<jsp:useBean id="concatValue"
class="org.spirit.servlet.bean.BotListConcatValue" />
<jsp:setProperty name="concatValue" property="maxLen" value="20" />"
Within the 'forEach' bracket?
Logic in the bean:
public String getWord() {
if (word != null && (word.length() > (maxLen + 3))) {
word = word.substring(0, (maxLen - 1)) + "...";
}
return word;
}
<jsp:useBean id="concatValue"
class="org.spirit.servlet.bean.BotListConcatValue" />
<jsp:setProperty name="concatValue" property="maxLen" value="20" />
<c:forEach items="${linklistings}"
var="listing" varStatus="status">
<c:set target="${concatValue}" property="word"
value="${listing.urlTitle}"/>
<cut value="${concatValue.word}" />
</c:forEach>