日期:2014-05-17  浏览次数:20798 次

新手,javaweb运行错误
[code=Java][/code]
inputcontent.html
<html>
<body>
<form name ="my" method="post">
请发表你的评论
<br><br>
<table border="0">
<tr>
<td>评&nbsp;论:</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><textarea id="pinglun" rows="8" cols="20"></textarea></td>
</tr>
<tr>
<td>用户名:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="center"><input type="button" value="发表评论" onclick="goto()"></td>
</tr>
</table>
<script>
function goto(){
var uname = document.my.username.value;
var ucontent = document.getElementById("pinglun").innerHTML;
location.href ="showcontent.jsp?uid ="+uname+"&content="+ucontent;
}
</script>
</body>
</html>






showcontent.jsp

<%@ page contentType="text/html;charset=gb2312" import="java.util.*"%>
<% 
integer i =(integer)application.getAttribute("num");
int m =1;
if(i!=null){
m = i.intValue();
m++;
}
Integer j = new Integer(m);
application.setAttribute("num",j);
String uid =(String)request.getParameter("uid");
if(uid = null||uid.equals(" ")){
out.println("<script>alert('请输入用户名');history.back();</script>");
}
String content = (String)request.getParameter("content");
content = new String(content.getBytes("iso8859-1"));
out.println("评论编号:");
out.println(m);
%>
<br>
<table border="0" width="600">
<tr>
<td>
<table border="0" width="600">
<tr>
<td align="left"><% out.println("用户:"+uid); %></td>
<td align="right"><% out.println(new Date());%></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><% out.println(content); %></td>
</tr>
</table>

帮帮忙看看咯>_<!!!

------解决方案--------------------
都是马虎的毛病
------解决方案--------------------
3: Integer i =(integer)application.getAttribute("num");

if(uid == null || uid.equals(" ")){

注意细心点