2

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:

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

line = "this is my new line"

the result is that value is getting only the first word("this") and not the whole string.

anyone knows why or how to make it right??

1
  • use double quotes Commented Apr 16, 2013 at 6:09

3 Answers 3

3

Put double quotes around the value like this -

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

HTML uses space to separate different attributes/tags.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

1

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?

1 Comment

Welcome :) Mark it as answer,if helpful

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.