jsp - set value of input tag (html) from a java string

前端 未结 3 1448
时光取名叫无心
时光取名叫无心 2021-01-24 07:22

I\'m facing a strange problem here. The situation is like this:

I\'m trying to set a value for an input tag from a java string:

   

        
相关标签:
3条回答
  • 2021-01-24 07:58

    As everybody said use double quotes

    <input type="text" name="line" value=<%=line%>  ></input>
    

    The above line is only for correct your line and,if possible please do not use scriplets.Those are expired.

    Please go through this How to avoid Java code in JSP files?

    0 讨论(0)
  • 2021-01-24 07:59
    <input type="text" name="line" value="<%=line%>"></input>
    
    0 讨论(0)
  • 2021-01-24 08:10

    Put double quotes around the value like this -

    <input type="text" name="line" value="<%=line%>"></input>
    

    HTML uses space to separate different attributes/tags.

    0 讨论(0)
提交回复
热议问题