[jsp] video print of an int


Web tier: servlets, JSP, Web frameworks: [jsp] video print of an int

  1. [jsp] video print of an int (4 messages)

    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++) {
      <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

    Threaded Messages (4)

  2. Primitive datatypes to string.[ Go to top ]

    To convert a primitive datatype to a string just use:

    int i=7;
    String i_str = String.valueOf(i);

  3. Alternatively the following change should work:

    name="source_<%= i.toString()%>"


    name="<%="source_" + i%>"

  4. Re: [jsp] video print of an int[ Go to top ]

    How about...

    <td><input type="text" name="source_<%=i%>" id="source" value=""></td>
  5. made it[ Go to top ]

    this works well


    Thanks for your help