Hello there,
can anyone tell me how to print the int value in a html form.
I tried with <%= i.toString()%> but I get an error.
This's the code:
for(i=0; i<menu; i++) {
%>
<tr>
<td><input type="text" name="source_<%= i.toString()%>" id="source" value=""></td>
<td><input type="text" name="date" id="date" value=""></td>
<td><select name="category" id="category">
<option value="carta_stampata">Carta stampata</option>
<option value="tv">TV</option>....
the error message
int cannot be dereferenced
out.print( i.toString());
^
thanks to everyone
-
[jsp] video print of an int (4 messages)
- Posted by: sandro sandro
- Posted on: March 02 2005 06:16 EST
Threaded Messages (4)
- Primitive datatypes to string. by Stephen Jelfs on March 02 2005 07:35 EST
- Automatic conversion of primitive to string by Stephen Jelfs on March 02 2005 07:40 EST
- Re: [jsp] video print of an int by James Carman on March 02 2005 22:37 EST
- made it by sandro sandro on March 03 2005 03:36 EST
-
Primitive datatypes to string.[ Go to top ]
- Posted by: Stephen Jelfs
- Posted on: March 02 2005 07:35 EST
- in response to sandro sandro
To convert a primitive datatype to a string just use:
int i=7;
String i_str = String.valueOf(i);
:) -
Automatic conversion of primitive to string[ Go to top ]
- Posted by: Stephen Jelfs
- Posted on: March 02 2005 07:40 EST
- in response to sandro sandro
Alternatively the following change should work:
name="source_<%= i.toString()%>"
to:
name="<%="source_" + i%>"
:) -
Re: [jsp] video print of an int[ Go to top ]
- Posted by: James Carman
- Posted on: March 02 2005 22:37 EST
- in response to sandro sandro
How about...
<td><input type="text" name="source_<%=i%>" id="source" value=""></td> -
made it[ Go to top ]
- Posted by: sandro sandro
- Posted on: March 03 2005 03:36 EST
- in response to sandro sandro
this works well
out.print(i);
Thanks for your help