我从action中把数据从数据库中查找出来,并且放入到list中去,然后存入到session中!
我能通过struts 标签把 数据显示到页面中,现在的问题是我怎样将显示的文字控制在8个子之内?
一下是JSP中的代码
<logic:iterate id="foodListForPageAll" name="foodListForPageAll">
<bean:write property="foodName"name="foodListForPageAll"/>
</logic:iterate>
我能通过struts 标签把 数据显示到页面中,现在的问题是我怎样将显示的文字控制在8个子之内?
一下是JSP中的代码
<logic:iterate id="foodListForPageAll" name="foodListForPageAll">
<bean:write property="foodName"name="foodListForPageAll"/>
</logic:iterate>
int y=list.size()>8?8:list.size();
for(int i=0;i<y;i++){
}
在头文件引入<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>,先判断数据大小,如果大于8个字符就调用${fn:substring(原数据, 0, 8)}
前台越简单越好,更何况用的是struts标签!
后台确实好处理 但是处理后的放入session中的 都限定在8位了!
<bean:write property="restaurantName" name="restaurantListForPageFive" />
怎么限定 只能输入8个字符