我试了给textContent设置初植也是一样的问题
解决方案 »
- 需要定义几个10000*300000的数组,但是总是 java.lang.OutOfMemoryError异常
- Exception starting filter struts2
- struts2 过滤器 跳转问题
- 救命啊,我用ssh开发,访问SQL2005时报异常“Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 只有运行该语句,生成的键才”
- 人性是否已经泯灭了
- 如何把JSP中声明的变量传给Action
- 急,高手指点, hibernate 一对多 级联保存问题,谢谢
- apache2 问题... 急
- hinbernate 的多表查询问题
- 如果我在JSP中调用一个oracle中的sp后,如果中途关闭了web页面,会不会对sp的提交有影响
- 关于从oracle数据库clob数据类型读取中文的问题
- 大侠们帮帮分析一下这个代码
description:The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperExceptionjava.lang.NullPointerException
所以你在getBytes("ISO-8859-1");
就不可以就像类型冲突一样懂么
<html>
<body><Font size=1>
<form action="" Method="post">//表单获得字符串
<p>输入姓名:
<Input type=text name="number">
<Input type=submit value="do">
</form>
<%String textContent=null;%>
<%//对输入的中文字符串转换
textContent=request.getParameter("number");
if(textContent!=null){
byte[] b=textContent.getBytes("ISO-8859-1");
textContent = new String(b);
}
%>
<%=textContent%>
</Font>
</body> 这样就对了
<%String textContent="aaa";%>就不需要添加那句if语句了吧、
不过改了后还是有那些异常!
而你紧接着就textContent.getBytes("ISO-8859-1");这时对象textContent为null,当然不能打点了,自然就报NullPointerException错误了
<html>
<body><Font size=1>
<form action="" Method="post">//表单获得字符串
<p>输入姓名:
<Input type=text name="number">
<Input type=submit value="do">
</form>
<%!String textContent=null;%>
<%
//设置request对象要使用的字符集
request.setCharacterEncoding("gb2312");
//下边接受多少个变量都没有中文问题
textContent=request.getParameter("number");
}
%>
<%=textContent%>
</Font>
</body>