Calendar(日历)控件出现中文乱码问题
页面为什么显示出来的中文乱码:<%@pagelanguage="java"pageEncoding="gb2312"%><%@pageimport="java.text....
页面为什么显示出来的中文乱码:
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="java.text.SimpleDateFormat,java.util.Calendar"%>
<%@ page import="com.dima.pojo.Khuser"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%
Calendar cal = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String today = format.format(cal.getTime());
String start = (cal.getTime().getYear()+1900)+"-"+(cal.getTime().getMonth()+1)+"-01";
Integer userId=null;
Khuser user = (Khuser)request.getSession().getAttribute("user");
if(user==null)
{
request.setAttribute("message", "登录超时,请重新登录!");
request.getRequestDispatcher("/view/common/errorRedirect.jsp").forward(request, response);
}else{
userId=user.getId();
}
%>
<html>
<head> <script language="jscript" src="<%=request.getContextPath()%>/include/js/calendar.js"></script>
<title>??</title>
<script type="text/javascript">
function pageInit() {
var userid=<%=userId %>;
JobGroupAction.getCustomerByUser(userid,callback);
}
function changed(obj)
{
if(document.getElementById("ts").value==0)
{
calendar.setHook(obj);
}
}
</script>
</head>
<body onload="pageInit();">
<form name="form1" method="post" action="<%=request.getContextPath()%>/packInfo.do?method=PackInfoQuery" target="iframe1">
<div class="sonbody">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="<%=request.getContextPath()%>/include/css/images/m_mpbg.gif">
<tr class="query">
<td style="text-align:right; width:78px;">时间:</td>
<td colspan="3">
<select name="ts" id="ts" onchange="javascript:changedate(this.value)">
<option selected="selected" value="0">指定</option>
<option value="1">当天</option>
<option value="2">本周</option>
<option value="3">本月</option>
<option value="4">本季</option>
<option value="5">今年</option>
</select>
<input name="BeginTime" value="<%=start %>" type="text" id="BeginTime" onfocus="changed(this);" readonly="readOnly" size="10" />
到 <input name="EndTime" value="<%=today %>" type="text" id="EndTime" onclick="changed(this);" readonly="readOnly" size="10" />
</td>
</tr>
</table>
<iframe id="iframe1" name="iframe1" onload="this.height=iframe1.document.body.scrollHeight+20" frameborder="0" marginheight="0" marginwidth="0" width="100%" scrolling="no" src="<%=request.getContextPath()%>/view/common/null.html"></iframe>
</div>
</form>
</body>
</html> 展开
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="java.text.SimpleDateFormat,java.util.Calendar"%>
<%@ page import="com.dima.pojo.Khuser"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%
Calendar cal = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String today = format.format(cal.getTime());
String start = (cal.getTime().getYear()+1900)+"-"+(cal.getTime().getMonth()+1)+"-01";
Integer userId=null;
Khuser user = (Khuser)request.getSession().getAttribute("user");
if(user==null)
{
request.setAttribute("message", "登录超时,请重新登录!");
request.getRequestDispatcher("/view/common/errorRedirect.jsp").forward(request, response);
}else{
userId=user.getId();
}
%>
<html>
<head> <script language="jscript" src="<%=request.getContextPath()%>/include/js/calendar.js"></script>
<title>??</title>
<script type="text/javascript">
function pageInit() {
var userid=<%=userId %>;
JobGroupAction.getCustomerByUser(userid,callback);
}
function changed(obj)
{
if(document.getElementById("ts").value==0)
{
calendar.setHook(obj);
}
}
</script>
</head>
<body onload="pageInit();">
<form name="form1" method="post" action="<%=request.getContextPath()%>/packInfo.do?method=PackInfoQuery" target="iframe1">
<div class="sonbody">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="<%=request.getContextPath()%>/include/css/images/m_mpbg.gif">
<tr class="query">
<td style="text-align:right; width:78px;">时间:</td>
<td colspan="3">
<select name="ts" id="ts" onchange="javascript:changedate(this.value)">
<option selected="selected" value="0">指定</option>
<option value="1">当天</option>
<option value="2">本周</option>
<option value="3">本月</option>
<option value="4">本季</option>
<option value="5">今年</option>
</select>
<input name="BeginTime" value="<%=start %>" type="text" id="BeginTime" onfocus="changed(this);" readonly="readOnly" size="10" />
到 <input name="EndTime" value="<%=today %>" type="text" id="EndTime" onclick="changed(this);" readonly="readOnly" size="10" />
</td>
</tr>
</table>
<iframe id="iframe1" name="iframe1" onload="this.height=iframe1.document.body.scrollHeight+20" frameborder="0" marginheight="0" marginwidth="0" width="100%" scrolling="no" src="<%=request.getContextPath()%>/view/common/null.html"></iframe>
</div>
</form>
</body>
</html> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询