大家请看:
我要显示jsp页面该标签输出的值的前2位,如何得到??
<c:out value=”${user.username}” >
也就是说${user.username}的值的前2位,在jsp上如何实现? 该标签里能用substring(0,2)吗? 各位请支招
我要显示jsp页面该标签输出的值的前2位,如何得到??
<c:out value=”${user.username}” >
也就是说${user.username}的值的前2位,在jsp上如何实现? 该标签里能用substring(0,2)吗? 各位请支招
用这样吧
<%=user.username.substring(0,2)%>
只要你确定有user这个类的实例
好像jsp里面只能用replace来
String userName=request.parameter("username").substring(0,2);
<c:out value="S{userName}" />