aspose file tools*
The moose likes JSP and the fly likes Convert int to String using jstl tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Convert int to String using jstl tags" Watch "Convert int to String using jstl tags" New topic
Author

Convert int to String using jstl tags

Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171
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,


Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Jun 06, 2007
Posts: 2712
    
    5

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?


SCJP, SCWCD.
|Asking Good Questions|
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert int to String using jstl tags
 
Similar Threads
Declared Variables Not Seen By Compiler
Run time checkbox values
Variable Scope Issue
Why it gets incremented?
problem with converting java.lang.Object to java.lang.String[solved]