var a = "技术问题";
var b = escape(a);
var c = unescape(b);
var b = escape(a);
var c = unescape(b);
解决方案 »
- parent.document.getElementById
- java脚本如何实现与当前系统时间进行比较?
- 网页上文本编辑框,在获得焦点的情况下,禁止用户进行输入怎么实现?
- 救命,是腾迅TT的问题吗?
- HTML中的javascript于SVG的互连问题
- 如何让一个网页中的框架只显示纵向的滚动条,不显示横向的滚动条?
- 视频播放的实现
- 如何能切换全fullscreen=1模式
- 不学JAVASCRIPT可不可以
- About HTML+TIME
- javascript语法参考手册
- 在javascrip同一函数中,可不可以执行了一部分语句,中间的一句再重新将window.location重新load一次,紧接着执行函数后面全部的语句,这
public static String unencode (String src)
{
try
{
return new String(src.getBytes("iso8859-1"),"UTF-8").trim();//按utf-8解码,编码为unicode
}
catch (Exception e)
{
System.out.println("无法重新编码 >>"+src+"<<\n"+e.getMessage());
e.printStackTrace();
return src ; //不编码直接送回
}
} public static String encode (String src)
{
try
{
return new String(src.getBytes("UTF-8"),"iso8859-1").trim();//按unicode解码,编码为utf-8
}
catch (Exception e)
{
System.out.println("无法重新编码 >>"+src+"<<\n"+e.getMessage());
e.printStackTrace();
return src ; //不编码直接送回
}
}当然也可以先escape了再放进url,servlet里面再用我上面贴的函数unescape回去。
String ss = new String(para.getBytes("UTF-8"),"ISO-8859-1");
System.out.println("----------ss----------------"+ss);还是不行,一样的结果请问如果不用javascript提供的方法,而是用java提供的方法(就如你上面所写的一样),如何直接在外面用上面的方法转换javascript里面的参数的,不知道怎样写,例如:function getPara(){
var a = document.form1.para.value;
<% 这里应怎样写,好像java与javascript不能混合写在一起的 %>
...
}
http://www.csdn.net/expert/topic/1043/1043280.xml?temp=.5397608秋水:真有你的,那么大一个编码表你也写到js里面去了呵呵。
var para = document.form1.para.value;
<% 怎写 %>
...
}
------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>emu</title>
</head>
<body>
<form name=form1>
<input name=text1 value="秋水无恨">
<input name=text2 value="是个大坏蛋">
<button onclick="location='http://localhost:8080/jsp/look.jsp?para1='+escape(text1.value).replace(/%/g,'%25')+'¶2='+escape(text2.value).replace(/%/g,'%25')">test</button>
</form>
</body>
</html>
------------------------------------------------------------
look.jsp
------------------------------------------------------------
<%@ page session="true" %>
<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="com.PUBLIC.Functions"%>
<html>
<head>
<title>测试页面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
out.println(Functions.unescape(request.getParameter("para1")));
out.println(Functions.unescape(request.getParameter("para2")));
%>
</body>
</html>
------------------------------------------------------------其中Functions.java定义了escape和unescape函数。
在tmocat下通过。
而前者已经有数以万计的帖子讨论过了,只要你不是白痴或者懒汉,肯定可以解决的。
function getPara(){
<%
String x1 = request.getParameter("para");
if(x1 != null){
%> getPara3();<% }else{ %>
//在这里定向返回到窗口的这一页,假如地址是:... gotopage,则下面
//在地址后面加上一个参数para,形式如:
...gotopage?para="+para;
//然后在这里就执行定向
//请问要怎样实现,即先想得到自己传给自己的参数,最后再提交不带参数的表单,
} function getPara3(){
<% String x = request.getParameter("para"); %>
<% InsideServlet.getParaValue = x; %>
fo.action="gotoservlet";
fo.submit();
}可不可以的?
前几次问同样的问题,有些说不能同时上传文件和同时得到参数的,还叫我用smartUpload组件,这怎么能算是解决问题呢,至于一般的中文参数问题,我不知看了多少次,但还是不能解决这一个!!!!!!
但还想问一下,我这一个jsp页是共用的,只有一个table和一个form的,是要被其他页包含的,请问如何在这个共用的jsp页中,在javascrip中将地址重新指向当前显示的页......
--------------------------------------------------------------
jsp放在内嵌框架(iframe)里面,
jsp中的表单定义的时候:
<form target="_parent"......或者script重定向页面的时候
<script>
...
parent.location=......
...
</script>