Reputation: 887
I want to print the two values by using single jsp expression tag is it possible?
<% int a=5;
int b=10;
int c=a+b;
%>
The values of a,b and c are: <%=a,b,c%>
I have to individually write jsp expression for each variables or the above code is correct.. in jsp.
Thanks..
Upvotes: 1
Views: 3759
Reputation: 1108722
You'd need to String-concatenate them.
<%= a + "," + b + "," + c %>
Or display them individually.
<%= a %>,<%= b %>,<%= c %>
Note that what you're doing is an oldschool way of using JSPs. Consider using EL.
${a},${b},${c}
Update as per the comments, you seem to now want print the comma at all, in contrary to what you initially presented in the question, here are the examples in the same order without printing the comma:
<%= a + "" + b + "" + c %>
<%= a %><%= b %><%= c %>
${a}${b}${c}
Upvotes: 3
Reputation: 133
No it does not. you will have to write them individually in the following manner ......
<%=a%>
<%=b%>
<%=c%>
Upvotes: 0