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/
*
**/
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
&nb
Ïà¹ØÎĵµ£º
Ò»¡¢¸ÅÊö
»º´æµÄ˼Ïë¿ÉÒÔÓ¦ÓÃÔÚÈí¼þ·Ö²ãµÄ¸÷¸ö²ãÃæ¡£ËüÊÇÒ»ÖÖÄÚ²¿»úÖÆ£¬¶ÔÍâ½ç¶øÑÔ£¬ÊDz»¿É¸ÐÖªµÄ¡£
Êý¾Ý¿â±¾ÉíÓлº´æ£¬³Ö¾Ã²ãÒ²¿ÉÒÔ»º´æ¡££¨±ÈÈ磺hibernate£¬»¹·Ö1¼¶ºÍ2¼¶»º´æ£©
ÒµÎñ²ãÒ²¿ÉÒÔÓлº´æ£¨µ«Ò»°ãÀ´Ëµ£¬ÕâÊÇÒ»¸ö¹ý³ÌÓò£¬²»»áÉ軺´æ£©¡£
&nbs ......
ʵÑ鱨¸æ
Ò». »ù±¾Ë¼Â·¼°ÊµÑé½á¹û£¨¼Ç¼¸÷ÖÖÔËÐÐÇé¿ö»òÒ³ÃæµÄÔËÐÐЧ¹û£©£»
1¡¢Ê¹ÓÃTOMCAT·þÎñÆ÷ÅäÖÃjspÓ¦ÓÃ
1£©´ò¿ªTOMCAT/webapps×ÓĿ¼£¬´´½¨Ò»webÓ¦Óã¨Èçmyweb£©£¬½«example0.jspÓëexample1.jspÎļþ¸´ÖÆÈëÄÚ£¬²¢ÔÚ¸ÃĿ¼ÏÂÉèÖÃWEB-INFĿ¼¼°web.xmlÅäÖÃÎļþ£»
2£©ÔÚä¯ÀÀÆ÷µØÖ·À¸ÊäÈëhttp://localhost:8080/myweb/ex ......
Ò»¡¢ÊµÑéÄ¿µÄ
1¡¢ ÕÆÎÕ±íµ¥µÄʹÓ÷½·¨£¬ÒÔ¼°·þÎñÆ÷¶Ë´¦Àí±íµ¥ÇëÇóµÄ·½·¨£»
2¡¢ Àí½âForwardµÄ×÷Óã»
3¡¢ ÊìÁ·ÔËÓÃJSPµÄµäÐÍÄÚÖöÔÏó
¶þ¡¢ÊµÑéÄÚÈݼ°²½Öè
1¡¢±íµ¥µÄʹÓü°ÆäµÝ½»¡¢´¦Àí¹ý³Ì
ÔÚÔ´´½ÌÎñϵͳÖУ¬ÏµÍ³»á¸ù¾ÝÓû§ÀàÐÍ(½Ìʦ/ѧÉú)ÏÔʾ²»Í¬µÄÒ³Ã档ΪģÄâ¸Ã¹¦ÄÜ£¬ÐèÒª¶¨ÒåÉè¼ÆÈçÏÂҳà ......
½«²ÎÊýд³É java.net.URLEncoder.encode(sContent,"gb2312")ºóÔÙ´«µÝ¡£
±ÈÈçurlÊÇ"/accept.do?content=<%=java.net.URLEncoder.encode(sContent,"UTF-8")%>";
¶Áȡʱ£¬Ê¹ÓÃ
String sc = new String(request.getParameter("content").getBytes("iso-8859-1"),"UTF-8"); ......
<%@page import="com.opensymphony.xwork2.util.ValueStack"%><%
ValueStack vs = (ValueStack)request.getAttribute("struts.valueStack");
String aa = (String)vs.findValue("downloadContent");
response. ......