中文处理方法
来源:互联网 发布:淘宝c店导出库存 编辑:程序博客网 时间:2024/05/17 02:22
<% String title="你好";
byte[] tmpbyte=title.getBytes("ISO8859_1");
title=new String(tmpbyte);
out.print(title); %>
或者<%=title%>
。在asp中经常使用到字符串判断语句如 if state="真是傻瓜" then.....
在java中String变量不是一个简单的变量而是一个类实例,不同的方法会得到不同的结果
a.
String str1="我是傻瓜";
String str2="我是傻瓜"; (or String str2="我是"+"傻瓜"; )
if (str1==str2)
out.print("yes");
else
out.print("no");
结果是"yes"。
大概是编译优化,str1,str2指向同一个类实例;
b.
String str1,str2,str3;
str1="我是傻瓜";
str2="我是";
str3=str2+"傻瓜";
if (str1==str3)
out.print("yes");
else
out.print("no");
结果是"no"。
String str1=new String("我是傻瓜");
String str2=new String("我是傻瓜");
if (str1==str2)
out.print("yes");
else
out.print("no");
结果是"no"。
String str1=new String("我是傻瓜");
String str2=new String("我是傻瓜");
if (str1.compareTo(str2)==0)
out.print("yes");
else
out.print("no");
结果是"yes"。
所以在jsp中判断字符串要使用compareTo方法,用惯传统语言还真一下子适应不过来,熟
悉java的朋友应该没这个问题
getAttribute()是session对象的方法,与session.setAttribute()对应getParameter()是request对象的方法,是用来取得上一页面传过来的表单或querystring的
如下:
a.jsp里
session.setAttribute("aaa","hello");
到b.jsp里就用
String aaaa=session.getAttribute("aaa");来取得hello这个String.
在aa.html里
<form method=post action=bb.jsp>
<input type=text name=id>
<input type=submit name=to>
</form>
bb.jsp就要用request.getParameter("id");来取得
表单中<input type=text name=id>里面输入的数据
- 中文处理方法
- jsp中文处理方法
- python中文处理好方法
- MySQL中文乱码处理方法
- 中文乱码处理方法总结
- jquery ajax中文处理方法
- python中文处理好方法
- JSP正确中文处理方法
- c++ 中文字符串处理方法
- c++ 中文字符串处理方法
- wingide不支持中文,处理方法
- boost::regex处理中文方法
- Eclipse 中文乱码处理方法
- 中文文本处理传统方法
- JavaMail中文附件的处理方法
- 在JSP中处理中文的方法!
- 处理中文乱码的常用方法
- JavaMail中文附件的处理方法
- 3000xp7.32突然显示主数据库不存在的解决一例
- JAVA几个常见错误简析
- 我们该怎样面对这些无法躲避的压力
- 同里古镇百年古建筑深夜被毁
- 时间的查询
- 中文处理方法
- 苏州市市区中低收入家庭住房供应管理实施细则
- 纠纷买房有法解决 十种情况可实现退房、索赔
- SESSION 的使用
- 收藏几段SQL Server语句和存储过程
- 如何去掉空格
- 记录被引用
- JAVA数据类型转换
- SQL Server和Oracle的常用函数对比