我的第一个JSP程序,出错,请大家帮忙看看 在第一行加入<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%@ page contentType="text/html; charset=gb2312" language="java" %>把它加上就行了! 对咯,我装的JSP的web引擎为RESIN(resin-2.1.14) 不行啊!这样:<%!String strtochin(String str){ byte[] byte1=str.getBytes(); String temp=""; try { temp=new String(byte1,"iso-8859-1"); } catch(Exception e){ } return temp;}%>加上它;并且将String title = "Hello, world!这是我改的第一个JSP程序";写为:String title = "Hello, world!这是我改的第一个JSP程序"; title=strtochin(title);试试!希望行!! 还是不行<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %><%//// Scripts between the scriptlet tags are simply executed.//String title = "Hello, world!这是我改的第一个JSP程序"; title=strtochin(title);%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><!-- The expression tags interpolate script variables into the HTML --><title><%= title %></title></head><body bgcolor=white><h1><%= title %></h1></body><%!String strtochin(String str){ byte[] byte1=str.getBytes(); String temp=""; try { temp=new String(byte1,"iso-8859-1"); } catch(Exception e){ } return temp;}%> <%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>你加了这个以后就不要再多此一举的来title=strtochin(title);这个转换了。 <%@ page contentType="text/html; charset=gb2312" language="java"%><%String title = "Hello, world!这是我改的第一个JSP程序";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title><%=title%></title></head><body bgcolor=white><h1><%=title%></h1></body>不好意思!这样就行了!不用去转换! 各位大虾门,走过的、路过的瞧瞧呗。 struts2 有一些问题 TomCat 不能显示刚刚上传的图片啊? 连接数据库的错误 BeanUtils.populate(bean,propertyMap) 这个方法什么意思啊? 我用的是resin服务器运行jsp,但总是找不到com.*; 有哪些大虾做过表单设计器的或者有相关资料的进来一下,也希望各位同学进来共同讨论学习! 求一个WEB项目经常出现的漏洞? 基础基础! 请问大家,现在都用什么来配置jsp环境的呀? 关于getLastModified()方法 数据类型转换的问题
把它加上就行了!
这样:
<%!
String strtochin(String str)
{
byte[] byte1=str.getBytes();
String temp="";
try
{
temp=new String(byte1,"iso-8859-1");
}
catch(Exception e){
}
return temp;
}
%>加上它;并且将String title = "Hello, world!这是我改的第一个JSP程序";
写为:String title = "Hello, world!这是我改的第一个JSP程序";
title=strtochin(title);试试!希望行!!
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<%
//
// Scripts between the scriptlet tags are simply executed.
//
String title = "Hello, world!这是我改的第一个JSP程序";
title=strtochin(title);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><!-- The expression tags interpolate script variables into the HTML --><title><%= title %></title>
</head><body bgcolor=white><h1><%= title %></h1></body>
<%!
String strtochin(String str)
{
byte[] byte1=str.getBytes();
String temp="";
try
{
temp=new String(byte1,"iso-8859-1");
}
catch(Exception e){
}
return temp;
}
%>
你加了这个以后就不要再多此一举的来title=strtochin(title);这个转换了。
<%
String title = "Hello, world!这是我改的第一个JSP程序";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=title%></title>
</head><body bgcolor=white><h1><%=title%></h1></body>
不好意思!
这样就行了!
不用去转换!