jsp - 从java字符串中设置输入标签(html)的值 [英] jsp - set value of input tag (html) from a java string

查看:444
本文介绍了jsp - 从java字符串中设置输入标签(html)的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里面临一个奇怪的问题。情况是这样的:

我试图从一个java字符串为输入标签设置一个值:

 < input type =textname =linevalue =<%= line%> >< /输入> 

line =这是我的新行

结果是 value 仅获取第一个单词(this)而不是整个字符串。



任何人都知道为什么或如何使它正确?

<%=线%> 中>< /输入>


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??

解决方案

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

这篇关于jsp - 从java字符串中设置输入标签(html)的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆