• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP expression

 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a doubt about <%=some expression%>. I always thought this returns the String of the actual value returned by the expression, but I also saw that in some cases, a value of the original type was returned. So, can someone please help..?
Thanks.
 
Felix Ulrich
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you explain a bit more? Where was the original type returned, what type was it, etc.
 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes the original type was returned. I used a BodyTagSupport to iterate through a list of items, and I returned a list.
<%
// Normally we don't declare variables, in JSPs,
// but this example should be self-contained
java.util.List names = new java.util.LinkedList();
names.add("Rod");
names.add("Isabelle");
names.add("Bob");
%>
<examples:hellos names="<%=names%>"> <==== here
Hello <%=name%>. You're entry <%=index%> in my list.<br/>
</examples:hellos>
 
SoonAnn Lim
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think this is dependent on the implementation of the server you use. Some jsp/servlet engine will do the autoconversion but some do not. You need to consult the server API for more information. I think tomcat has done a good job in this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!