请问这个要怎么解决,我想把默认值设为前一天日期
<%
SimpleDateFormat f=new SimpleDateFormat("yyyyMMdd");
String curdate=f.format(new Date());
%>
<input type="text" name="RQ" style="width:130" value="<%curdate %>">
这样写报错了。
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 23 in the jsp file: /h1-g-new.jsp
Generated servlet error:
Syntax error on token ".", ; expected
要怎么解决。谢谢
------解决方案--------------------
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, -1);
string predate = f.format(c.getTime());
------解决方案--------------------楼上的
SimpleDateFormat f=new SimpleDateFormat("yyyyMMdd");
Calendar c=Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, -1);
String curdate = f.format(c.getTime());
//<%=curdate %>