<%
String date;
int y, m, d;
Calendar cal = Calendar.getInstance();
y = cal.get(Calendar.YEAR);
m = cal.get(Calendar.MONTH) + 1;
d = cal.get(Calendar.DATE);
Date date2 = new Date();
cal.setTime(date2);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
if (w < 0){
w = 0;
}
String week = "";
if(w == 1){
week = "星期一";
}else if(w == 2){
week = "星期二";
}else if(w == 3){
week = "星期三";
}else if(w == 4){
week = "星期四";
}else if(w == 5){
week = "星期五";
}else if(w == 6){
week = "星期六";
}else if(w == 7){
week = "星期日";
}
date = "" + y + "年" + m + "月" + d + "日 "+week+"";
if(date.contains("1月1日")){
date = "今天是元旦!";
}else if(date.contains("10月1日")){
}
%>
这样显示详细日期 <%=date %>
在删除按钮中添加确认 οnclick="return confirm('是否删除?')"
input框中显示当前时间:
<%
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd");
java.util.Date currentTime = new java.util.Date();//得到当前系统时间
String time = formatter.format(currentTime); //将日期时间格式化
%>
<%=time %>
下拉框的默认选中
<select name="" id="" style="width:105px">
<option value="男" <c:if test='${jdr.sex =="男"}'>selected='selected'</c:if>></option>
<option value="女" <c:if test='${jdr.sex =="女"}'>selected='selected'</c:if>></option>
</select>
String date;
int y, m, d;
Calendar cal = Calendar.getInstance();
y = cal.get(Calendar.YEAR);
m = cal.get(Calendar.MONTH) + 1;
d = cal.get(Calendar.DATE);
Date date2 = new Date();
cal.setTime(date2);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
if (w < 0){
w = 0;
}
String week = "";
if(w == 1){
week = "星期一";
}else if(w == 2){
week = "星期二";
}else if(w == 3){
week = "星期三";
}else if(w == 4){
week = "星期四";
}else if(w == 5){
week = "星期五";
}else if(w == 6){
week = "星期六";
}else if(w == 7){
week = "星期日";
}
date = "" + y + "年" + m + "月" + d + "日 "+week+"";
if(date.contains("1月1日")){
date = "今天是元旦!";
}else if(date.contains("10月1日")){
}
%>
这样显示详细日期 <%=date %>
在删除按钮中添加确认 οnclick="return confirm('是否删除?')"
input框中显示当前时间:
<%
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd");
java.util.Date currentTime = new java.util.Date();//得到当前系统时间
String time = formatter.format(currentTime); //将日期时间格式化
%>
<%=time %>
下拉框的默认选中
<select name="" id="" style="width:105px">
<option value="男" <c:if test='${jdr.sex =="男"}'>selected='selected'</c:if>></option>
<option value="女" <c:if test='${jdr.sex =="女"}'>selected='selected'</c:if>></option>
</select>