Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Convert int to String using jstl tags  RSS feed

 
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,
 
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
%>
 
Bartender
Posts: 2856
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?
 
What a stench! Central nervous system shutting down. Save yourself tiny ad!
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!