看这个吧,那个有乱字符
------------------receive.jsp---------
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*" %><HTML>
<HEAD>
<TITLE> 接受消息 </TITLE>
<META NAME="Author" CONTENT="jj">
</HEAD>
<meta http-equiv =refresh content= "5; rl=#">
<% String name = (String) session.getValue("userid");
Vector chatwords =
(Vector) application.getAttribute("chatwords");
//获取聊天信息
%>
<BODY bgColor=#99CCFF >
<font color=#669900 size=2 >欢迎
<FONT COLOR=#660066 size=4> <I><B><%= name %></B></I> </FONT>光临JJ聊天室,请注意文明聊天!</font><BR>
<HR>
<% if (chatwords!=null) { // 显示信息
Object[] arraychatwords=chatwords.toArray();
int wordslen=arraychatwords.length;
for (int i=wordslen-1;i>=0;i--) { %>
<font size=2> <%= (String) arraychatwords[i] %></font><% }
}
%>-------------------------------send.jsp-------------------------<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*" %>
<HTML>
<HEAD>
<TITLE> 发送消息 </TITLE>
<META NAME="Author" CONTENT="jj">
</HEAD>
<% int wordslen =0;
String linewords=""; Vector chatwords = (Vector) application.getAttribute("chatwords");
String fontcolor= request.getParameter("fontcolor");
String photo=request.getParameter("photo");
String face=(String) session.getValue("Face"); //获取用户发送信息的个部分 if (fontcolor==null) {fontcolor="black";}
if (face==null) {face="0";};
if (photo==null){photo="0";}; //置默认信息 if (chatwords==null) { // 创建聊天信息列表
chatwords = new Vector();
application.setAttribute("chatwords",chatwords);
} else { //以下完成各部分的拼接得到完整的发送信息
String user1 =request.getParameter("user");
if (user1==null) {;}
String words = request.getParameter("words");
if (words!=null) wordslen = words.length();
if (wordslen >0) {
String act = request.getParameter("act");
String talkto = request.getParameter("talkto");
int i = act.indexOf("B");
if (i != -1) {
act = act.substring(0,i) + "<B><U>" + talkto + " </U></B>" + act.substring(i+1);
}
if (!photo.equals("0")) {
linewords="<p><font size =3 ><B>"+user1+" </B></font><IMG SRC=images/face"+face +".gif WIDTH=25 HEIGHT=25 BORDER=1 > " + act +"<FONT COLOR="+fontcolor+" >" +words+" </FONT>"+" <IMG SRC=images/"+photo+".gif WIDTH='16' HEIGHT='16' BORDER=0 >" ;}
else {
linewords= "<p><font size =3 ><B><I>"+user1+" <IMG SRC=images/face"+face+".gif WIDTH=25 HEIGHT=25 BORDER=1 ></I></B></font> " + act +"<FONT COLOR="+fontcolor+" >"+words+"</FONT>";
}
byte[] temp = linewords.getBytes("iso8859-1");
linewords= new String(temp);
chatwords.add(linewords); //发送信息存入信息列表
}
}
%>
<BODY bgcolor=#99CCFF >
<BR>
<TABLE border=0 cellspacing=0 cellpadding=0 >
<FORM action="#" method=get name="inputform" >
<TBODY><TR><TD colspan="3">
<INPUT type="hidden" name="user" value="<%= (String)session.getValue("userid")%> ">
<FONT SIZE="2" >对象</FONT>
<INPUT name="talkto" value="所有人" size="8"
readonly tabindex=5><SELECT name="act" onchange="words.focus();" tabindex=4>
<option value='向B说道:' selected>说话</option>
<option value='很严肃的问道B:'>请问</option>
<option value='使劲地拍着巴掌向B喊:'>喝采</option>
<OPTION VALUE="抿着嘴向着B:">微笑</OPTION>
<OPTION VALUE="扭过头跟B说:">躲避</OPTION>
</SELECT><SELECT name="fontcolor" onchange="words.focus();" tabindex=3>
<option value="black" STYLE="COLOR: "<%if (fontcolor.equals("black")) out.print("selected");%> >颜 色</option>
<option style="BACKGROUND: #550088" value="#550088" <%if (fontcolor.equals("#550088")) out.print("selected");%>></option>
<option style="BACKGROUND: #55001f" value="#55001f" <%if (fontcolor.equals("#55001f")) out.print("selected");%>></option>
</SELECT>
<SELECT name="photo" onchange="words.focus(); PerformSubmit('fdf');">
<option value="0" selected>贴图</option>
<OPTION VALUE="1">微笑</OPTION>
<OPTION VALUE="3">大笑</OPTION>
<OPTION VALUE="4">爆笑</OPTION>
<OPTION VALUE="2">甜笑</OPTION>
</SELECT>
</TD></TR>
<TR><TD colspan="3">
<FONT SIZE="2" >信息</FONT>
<INPUT name="words" size="45" maxlength="120" tabindex=1 value="">
<INPUT type="submit" value="发 送" name="submit1" class="btnStyle" tabindex=10>
<span class="p9">
<a href="exit.jsp" target='_top'>
<IMG SRC="images/leave.gif" WIDTH="60" HEIGHT="35" BORDER=0 ALT="">
</a></span>
</TD>
</TR></TBODY></FORM></TABLE>
</BODY>
</HTML>
------------------receive.jsp---------
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*" %><HTML>
<HEAD>
<TITLE> 接受消息 </TITLE>
<META NAME="Author" CONTENT="jj">
</HEAD>
<meta http-equiv =refresh content= "5; rl=#">
<% String name = (String) session.getValue("userid");
Vector chatwords =
(Vector) application.getAttribute("chatwords");
//获取聊天信息
%>
<BODY bgColor=#99CCFF >
<font color=#669900 size=2 >欢迎
<FONT COLOR=#660066 size=4> <I><B><%= name %></B></I> </FONT>光临JJ聊天室,请注意文明聊天!</font><BR>
<HR>
<% if (chatwords!=null) { // 显示信息
Object[] arraychatwords=chatwords.toArray();
int wordslen=arraychatwords.length;
for (int i=wordslen-1;i>=0;i--) { %>
<font size=2> <%= (String) arraychatwords[i] %></font><% }
}
%>-------------------------------send.jsp-------------------------<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*" %>
<HTML>
<HEAD>
<TITLE> 发送消息 </TITLE>
<META NAME="Author" CONTENT="jj">
</HEAD>
<% int wordslen =0;
String linewords=""; Vector chatwords = (Vector) application.getAttribute("chatwords");
String fontcolor= request.getParameter("fontcolor");
String photo=request.getParameter("photo");
String face=(String) session.getValue("Face"); //获取用户发送信息的个部分 if (fontcolor==null) {fontcolor="black";}
if (face==null) {face="0";};
if (photo==null){photo="0";}; //置默认信息 if (chatwords==null) { // 创建聊天信息列表
chatwords = new Vector();
application.setAttribute("chatwords",chatwords);
} else { //以下完成各部分的拼接得到完整的发送信息
String user1 =request.getParameter("user");
if (user1==null) {;}
String words = request.getParameter("words");
if (words!=null) wordslen = words.length();
if (wordslen >0) {
String act = request.getParameter("act");
String talkto = request.getParameter("talkto");
int i = act.indexOf("B");
if (i != -1) {
act = act.substring(0,i) + "<B><U>" + talkto + " </U></B>" + act.substring(i+1);
}
if (!photo.equals("0")) {
linewords="<p><font size =3 ><B>"+user1+" </B></font><IMG SRC=images/face"+face +".gif WIDTH=25 HEIGHT=25 BORDER=1 > " + act +"<FONT COLOR="+fontcolor+" >" +words+" </FONT>"+" <IMG SRC=images/"+photo+".gif WIDTH='16' HEIGHT='16' BORDER=0 >" ;}
else {
linewords= "<p><font size =3 ><B><I>"+user1+" <IMG SRC=images/face"+face+".gif WIDTH=25 HEIGHT=25 BORDER=1 ></I></B></font> " + act +"<FONT COLOR="+fontcolor+" >"+words+"</FONT>";
}
byte[] temp = linewords.getBytes("iso8859-1");
linewords= new String(temp);
chatwords.add(linewords); //发送信息存入信息列表
}
}
%>
<BODY bgcolor=#99CCFF >
<BR>
<TABLE border=0 cellspacing=0 cellpadding=0 >
<FORM action="#" method=get name="inputform" >
<TBODY><TR><TD colspan="3">
<INPUT type="hidden" name="user" value="<%= (String)session.getValue("userid")%> ">
<FONT SIZE="2" >对象</FONT>
<INPUT name="talkto" value="所有人" size="8"
readonly tabindex=5><SELECT name="act" onchange="words.focus();" tabindex=4>
<option value='向B说道:' selected>说话</option>
<option value='很严肃的问道B:'>请问</option>
<option value='使劲地拍着巴掌向B喊:'>喝采</option>
<OPTION VALUE="抿着嘴向着B:">微笑</OPTION>
<OPTION VALUE="扭过头跟B说:">躲避</OPTION>
</SELECT><SELECT name="fontcolor" onchange="words.focus();" tabindex=3>
<option value="black" STYLE="COLOR: "<%if (fontcolor.equals("black")) out.print("selected");%> >颜 色</option>
<option style="BACKGROUND: #550088" value="#550088" <%if (fontcolor.equals("#550088")) out.print("selected");%>></option>
<option style="BACKGROUND: #55001f" value="#55001f" <%if (fontcolor.equals("#55001f")) out.print("selected");%>></option>
</SELECT>
<SELECT name="photo" onchange="words.focus(); PerformSubmit('fdf');">
<option value="0" selected>贴图</option>
<OPTION VALUE="1">微笑</OPTION>
<OPTION VALUE="3">大笑</OPTION>
<OPTION VALUE="4">爆笑</OPTION>
<OPTION VALUE="2">甜笑</OPTION>
</SELECT>
</TD></TR>
<TR><TD colspan="3">
<FONT SIZE="2" >信息</FONT>
<INPUT name="words" size="45" maxlength="120" tabindex=1 value="">
<INPUT type="submit" value="发 送" name="submit1" class="btnStyle" tabindex=10>
<span class="p9">
<a href="exit.jsp" target='_top'>
<IMG SRC="images/leave.gif" WIDTH="60" HEIGHT="35" BORDER=0 ALT="">
</a></span>
</TD>
</TR></TBODY></FORM></TABLE>
</BODY>
</HTML>
解决方案 »
- 如何动态修改JAVA类?
- !!!问一个HQL 和SQL 的问题 SQL 可以跑 HQL 出问题!!!急!!
- 如何用java 实现将oracle数据库表导出至access数据库
- struts2 乱码的问题,我知道有人多人提过,但是还是解决不了问题。
- java web程序需要用到哪些weblogic jar包
- 用hibernate的一个问题
- 快救救疯子吧。。。。连接池问题。
- 请教各位高手!!如何使一段代码自动注释掉啊!
- java 都有那些开发平台?JSP的开发平台呢?来者加分?
- 请问一个令我困惑的问题,Up……
- 急!!!哪位大侠能在线救急?求jsp数据库查询语句的写法,查询条件是动态获取表单中的参数得到的?
- 一个注册文件连带MS SQL的代码调试通不过
<%@ page import="java.util.*" %>
<HTML>
<HEAD>
<TITLE> fa xinxi</TITLE></HEAD>
<% int wordslen =0;
String linewords=""; Vector chatwords = (Vector) application.getAttribute("chatwords");
String fontcolor= request.getParameter("fontcolor");
String photo=request.getParameter("photo");
String face=(String) session.getValue("Face"); //get user msg
if (fontcolor==null) {fontcolor="black";}
if (face==null) {face="0";};
if (photo==null){photo="0";}; //set default if (chatwords==null) { // creat chat msg list
chatwords = new Vector();
application.setAttribute("chatwords",chatwords);
} else { //put msg together
String user1 =request.getParameter("user");
if (user1==null) {;}
String words = request.getParameter("words");
if (words!=null) wordslen = words.length();
if (wordslen >0) {
String act = request.getParameter("act");
String talkto = request.getParameter("talkto");
int i = act.indexOf("B");
if (i != -1) {
act = act.substring(0,i) + "<B><U>" + talkto + " </U></B>" + act.substring(i+1);
}
if (!photo.equals("0")) {
linewords="<p><font size =3 ><B>"+user1+" </B></font><IMG SRC=images/face"+face +".gif WIDTH=25 HEIGHT=25 BORDER=1 > " + act +"<FONT COLOR="+fontcolor+" >" +words+" </FONT>"+" <IMG SRC=images/"+photo+".gif WIDTH='16' HEIGHT='16' BORDER=0 >" ;}
else {
linewords= "<p><font size =3 ><B><I>"+user1+" <IMG SRC=images/face"+face+".gif WIDTH=25 HEIGHT=25 BORDER=1 ></I></B></font> " + act +"<FONT COLOR="+fontcolor+" >"+words+"</FONT>";
}
byte[] temp = linewords.getBytes("iso8859-1");
linewords= new String(temp);
chatwords.add(linewords); //send msg save msg list
}
}
%><BR> <FORM action="#" method=get name="inputform" >
<TBODY><TR><TD colspan="3">
<INPUT type="hidden" name="user" value="<%= (String)session.getValue("userid")%> ">
<FONT SIZE="2" >dui xiang</FONT>
<INPUT name="talkto" value="all" size="8"
readonly tabindex=5><SELECT name="act" onchange="words.focus();" tabindex=4>
<option value='to B say' selected>say</option>
<option value='srs ask B£º'>ask</option>
<option value='hand to B han£º'>hand</option>
<OPTION VALUE="smile B£º">smile</OPTION>
<OPTION VALUE="hide B say£º">hide</OPTION>
</SELECT><SELECT name="fontcolor" onchange="words.focus();" tabindex=3>
<option value="black" STYLE="COLOR: "<%if (fontcolor.equals("black")) out.print("selected");%> >color</option>
<option style="BACKGROUND: #550088" value="#550088" <%if (fontcolor.equals("#550088")) out.print("selected");%>></option>
<option style="BACKGROUND: #55001f" value="#55001f" <%if (fontcolor.equals("#55001f")) out.print("selected");%>></option>
</SELECT>
<SELECT name="photo" onchange="words.focus(); PerformSubmit('fdf');">
<option value="0" selected>tie tu</option>
<OPTION VALUE="1">smile1</OPTION>
<OPTION VALUE="3">smile2</OPTION>
<OPTION VALUE="4">smile3</OPTION>
<OPTION VALUE="2">smile4</OPTION>
</SELECT>
</TD></TR><FONT SIZE="2" >msg</FONT>
<INPUT name="words" size="45" maxlength="120" tabindex=1 value="">
<INPUT type="submit" value="·¢ ËÍ" name="submit1" class="btnStyle" tabindex=10> <a href="exit.jsp" target='_top'>
exit </a>
</TD>
</TR></TBODY></FORM>
<%
String name = (String) session.getValue("userid");
application.getAttribute("chatwords");
//get chat msg
%>welcome
<%= name %>in our chatroom
<br>
<% if (chatwords!=null) { // showmsg
Object[] arraychatwords=chatwords.toArray();
wordslen=arraychatwords.length;
for (int i=wordslen-1;i>=0;i--) {
%><%= (String) arraychatwords[i] %><% }
}
%> </BODY>
</HTML>