我想给下拉列表的元素值加空格,测试在Console System.out.println()正常,放到网页下拉列表里面,空格就没有了,不知道在下拉列表里面给name 值加空格怎么加?我的代码是
public String getFillName() {
String result = "";
if (node.length() > 1) {
// 填充空格
int fillLen = (node.length() - 1) / 3 * 2 + this.parentNode.length();
for (int i = 0; i < fillLen; i++) {
result += " ";//这里直接拼上空格,但网页里面显示不出来
}
result += "|____" + this.name;
} else {
result = this.name;
}
this.fillName = result;
return this.fillName;
}
public String getFillName() {
String result = "";
if (node.length() > 1) {
// 填充空格
int fillLen = (node.length() - 1) / 3 * 2 + this.parentNode.length();
for (int i = 0; i < fillLen; i++) {
result += " ";//这里直接拼上空格,但网页里面显示不出来
}
result += "|____" + this.name;
} else {
result = this.name;
}
this.fillName = result;
return this.fillName;
}
解决方案 »
- Ibatis查询方式queryForList,从10W级表中查询返回很慢,求解释
- spring任务调度问题
- Flex与Java通信的问题
- Java awt 如何将输出到屏幕上的图像输出到图片 如果有好思路另开帖子另给分
- 谁帮我下载个东西
- 企业里jsp都用什么数据库,这些数据库哪个好,有什么区别?是不是只要学一个就够了。
- The absolute uri: http://struts.apache.org/tags-html cannot be resolved in either web.xml or the jar files deployed with this ap
- 求命呀,高手帮我看看这个Exception什么意思?
- 请问如何在JbuilderX下调试JSP
- 如何配置visualcafe,
- 关于用了Hibernate里面实体对象问题
- 跳转页面也报这种错?
直接就显示 了。
你用什么显示的? el表达式?
<c:out value="${参数}" escapeXml="false"/>试试这个!
我直接在我的程序里面控制的
for (int i = 0; i < fillLen; i++) {
result += " ";
}
把这个result发到request里,
<c:out value="${result}" escapeXml="false"/>
result += " ";
}代码 是写在pojo类里面的,我传过去的是整个对象,而且传过去的时候fillName字段的值是有空格的,只是在<select>里面显示不了,我在Eclipse里面测试过了,用Console输出看了。
在页面写成下面的方式就可以了
<bean:write name="dpData" property="fillName" filter="false"/><bean:write>标签用于在网页上输出某个Bean或它的属性的内容.其中它有一个filter属性,默认值为true.如果filter属性为true,将把输出内容中的特殊HTML符合作为普通字符串来显示;如果filter属性为false,则不会把输出内容中的热书HTML符号转化为普通字符串.谢谢woming66,让我联想到Struts标签的属性
客气了!!!
<bean:write name="dpData" property="fillName" filter="false"/>
<c:out value="${result}" escapeXml="false"/>
效果是一样的!!