Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÓÃ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);   
     }   
    }   
   &


Ïà¹ØÎĵµ£º

jspÖÐÈ¡µÃ·þÎñÆ÷ʱ¼ä²¢¶¯Ì¬ÏÔʾ


<%
      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ºÍActionÖÐBase64±àÂëת»»

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ÖÐerrorPageµÄÎÊÌâ

           µ±ÔÚJSPµÄpageÖ¸ÁîÖÐÉèÖÃerrorPage="url"¾Í¿ÉÒÔÉèÖô¦ÀíÒ쳣ʼþµÄJSPÎļþ¡£Èç¿ÉÒÔÕâÑùд£º
                <%@ page errorPage="error.jsp" %>
           ÕâÑùµÄ»°£¬µ±Ò³ÃæÖгöÏÖÒì³£µÄÊ ......

Ò»¶Î¿ÉÒÔÔËÐеÄxhtmlµÄ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 ......

JSPÖж¨Ê±¹Ø±ÕÒ³ÃæµÄJS¿Ø¼þ


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
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ