ÓÃServlet¹ýÂËÆ÷È¥³ýJSPÒ³ÃæÖеÄÂÒÂë
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class SetCharacterEncodingFilter implements Filter {
protected String encoding = null;
protected FilterConfig filterConfig = null;
protected boolean ignore = true;
// ÉèÖÃÉêÇë¶ÔÏóµÄֵΪ¿Õ£¬ÓÐÀûÓÚÄÚ´æ×ÊÔ´µÄ¿ìËÙÊÍ·Å
public void destroy() {
this.encoding = null;
this.filterConfig = null;
}
// filterµÄÖ÷Ìå²Ù×÷
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
// ÅжÏÊÇ·ñÐèÒª½øÐбàÂëµÄÉèÖÃ
if (!ignore || request.getCharacterEncoding() == null) {
// µÃµ½ÅäÖÃÎļþÖеıàÂëÀàÐÍ
String encoding = setEncoding(request);
if (encoding != null) {
request.setCharacterEncoding(encoding);
}
}
&
Ïà¹ØÎĵµ£º
<%
Calendar rightNow = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String sysdate = format.format(rightNow.getTime());
int week = rightNow.get(rightNow.DAY_OF_WEEK);
String weekar ......
jspÖÐÓÃjavascript½«ÖÐÎÄBase64תÂë, ActionÖÐÔÙÓÃBase64½âÂë
javascriptÖÐʹÓÃwebtoolkit.base64.js,ÏÂÔØµØÖ·http://www.webtoolkit.info/djs/webtoolkit.base64.js
Ïà¹Ø½éÉÜ http://www.webtoolkit.info/javascript-base64.html
/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/ ......
µ±ÔÚJSPµÄpageÖ¸ÁîÖÐÉèÖÃerrorPage="url"¾Í¿ÉÒÔÉèÖô¦ÀíÒ쳣ʼþµÄJSPÎļþ¡£Èç¿ÉÒÔÕâÑùд£º
<%@ page errorPage="error.jsp" %>
ÕâÑùµÄ»°£¬µ±Ò³ÃæÖгöÏÖÒì³£µÄÊ ......
<?xml version="1.0" encoding="UTF-8"?>
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*" errorPage="" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+pat ......
JS´úÂë
<script
type="text/javascript">
function closewindow(){
window.returnValue = true;
window.close();
}
function clock(){
i = i -1;
if(document.getElementById("info")){
document.getElementById("info").innerHTML
......