毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> java技术 >> 正文

EL表达要取的值中包含双引号"" 单引号'' 怎么办

更新时间:2013-5-24:  来源:毕业论文

EL表达要取的值中包含双引号"" 单引号'' 怎么办

EL表达要取的值中有双引号""也有单引号'' 怎么办?
如 <input type="text" value="${user.name}" 这种情况如果name本包含双引号和单引号咋办,用[]来取貌似都不行啊

<input type="text" value=${user.name}

这样试试看 我记得html属性可以不加双引号。

在后台数据查询出来的时候,要返回页面上的值有单双引号的,你可以写个方法转义一下,应该就行了。像这种一样:

Java code?//特殊字符转为Html public static String toHtml(String s) {     s = Replace(s,"&","&amp;");     s = Replace(s,"<","&lt;");     s = Replace(s,">","&gt;");     s = Replace(s,"\t","    ");     s = Replace(s,"\r\n","\n");     s = Replace(s,"\n","<br>");     s = Replace(s,"  "," &nbsp;");     s = Replace(s,"'","&#39;");     s = Replace(s,"\\","&#92;");     return s; } //逆 public static String unHtml(String s){         s = Replace(s,"<br>","\n");     s = Replace(s,"&nbsp;"," ");     s = Replace(s,"&lt","<");     s = Replace(s,"&gt",">");     s = Replace(s,"&amp","&");     return s; }

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。