Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert int to String using jstl tags

 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Let's say I have a variable,


which is an int and I want to create a new String variable, having the same value as id. How can I accomplish that?

thanks in advance,
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Manuel,

i prefer converting stuff(int to String or string to int ) you do in your java class or servlet. then you pass to jsp.


scriplet in jsp is deprecated.and EL is used for presentation purpose.

FYI,
<%
int i=8;
String s=(""+i).trim();//there are 2 more way available
%>
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by seetharaman venkatasamy
scriplet in jsp is deprecated.

FYI,
<%
int i=8;
String s=(""+i).trim();//there are 2 more way available
%>


But the code is a scriptlet, right?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic