100分急问:如何在jsp中将字符串后的某串字符去掉?
如题:
用的是struts
<bean:write property="beginDate" name="trainingRecordForm"/>
将trainingRecordForm表单中的属性beginDate取出,假设beginDate的值
是“2004-08-10 00:00:00.0”。
那么我想在屏幕上输出时的格式是“2004-08-10”,即不要后面的一段。
我开始想这样做:
<%
String beginDate=<bean:write property="beginDate" name="trainingRecordForm"/>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%>
...
<td class="list"><%=beginDate.substring(0,10)%></td>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
不过编译通不过。
想请教各位大虾,如何解决这个问题?非常感谢!