这是一个小型的白板程序,我把所有的文件都copy过来,大家帮忙分析一下究竟是哪里的问题,谢谢了:
共6个文件:两个javabean( JBoardBean.java,LogDataBean.java),一个MakeSuggestion,一个JBoard.jsp,一个Uh-oh.jsp,一个SuggestionLog.jsp:
JBoardBean.java:
package hh;
import java.text.DateFormat;
import java.util.Date;
public class JBoardBean
{
private String name,login,date,domain,suggestion,PATH;
public void setName(String name)
{
this.name=name;
}
public void setLogin(String login)
{
this.login=login;
}
public void setDomain(String domain)
{
this.domain=domain;
}
public void setSuggestion(String suggestion)
{
this.suggestion=suggestion;
}
public void setPATH(String PATH)
{
this.PATH=PATH;
}
public String getDate()
{
return date;
}
public String getName()
{
return name;
}
public String getLogin()
{
return login;
}
public String getDomain()
{
return domain;
}
public String getSuggestion()
{
return suggestion;
}
public String getPATH()
{
return PATH;
}
public JBoardBean()
{
date=DateFormat.getInstance().format(new Date());
}
}
LogDataBean.java:
package hh;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
public class LogDataBean
{
private BufferedWriter bw;
private String date,domain,login,logPath,name,suggestion;
private String fileName="/data/SuggestionLog.inc";
private StringBuffer sb1=new StringBuffer();
private StringBuffer sb2=new StringBuffer();
private StringBuffer emailUrl;
private String TRuser="<tr><td id=\"user\">";
private String TRdata="<tr><td id=\"data\">";
private String TRclose="</td></tr>";
public synchronized void setSuggestion(String suggestion)
{
this.suggestion=suggestion;
try
{
bw=new BufferedWriter(new FileWriter(logPath+fileName,true));
emailUrl=new StringBuffer("<a href=\"").append(name).append("mailto:").append(login).append("@").append("\">").append(name).append("</a>");
bw.write(sb1.append(TRuser).append(date).append(" ").append(emailUrl).append("wrote:").append(TRclose).toString());
bw.newLine();
bw.write(sb2.append(TRdata).append(suggestion).append(TRclose).toString());
bw.newLine();
bw.close();
sb1.setLength(0);
sb2.setLength(0);
}
catch(IOException e)
{
System.err.println(e);
e.printStackTrace();
}
}
public synchronized void setLogPath(String logPath)
{
this.logPath=logPath;
}
public synchronized void setName(String name)
{
this.name=name;
}
public synchronized void setLogin(String login)
{
this.login=login;
}
public synchronized void setDate(String date)
{
this.date=date;
}
public synchronized void setDomain(String domain)
{
this.domain=domain;
}
public LogDataBean()
{
}
}
MakeSuggestion:
<html>
<HEAD><title>Jboard Suggestion Box</title>
<STYLE type="text/css">
<!--
@import url(Jboard.css);
-->
</STYLE>
</HEAD>
<BODY>
<H1>Jboard</H1>
<p>Use this page to make a suggestion.</p>
<P><SMALL>Note:You can use any HTML in the TEXTAREA of this form,
but please only use the simplest formatting HTML for your suggestion,e.g.<br><p>etc.</small></P><br/>
<form action="JBoard.jsp" method="post">
<p>
Full Name:
<INPUT type="text" name="name" value="your name" maxlength="25"><br/>
User id:
<INPUT type="text" name="login" value="userid" maxlength="12">@:<INPUT type="text" name="domain"
value="yourdomain.com" maxlength="20" ><br/>
Suggestion:<br/>
<TEXTAREA name="suggestion" rows="8" cols="72"></TEXTAREA><br/>
<INPUT type="submit" value="Suggest"><INPUT type="reset">
</p>
</form>
</BODY>
</html>
JBoard.jsp:
<%@page errorPage="Uh-oh.jsp" %>
<jsp:useBean id="jboard" scope="request" class="hh.JBoardBean" />
<jsp:setProperty property="*" name="jboard"/>
<jsp:setProperty name="jboard" property="PATH" value="<%= application.getRealPath(\"/\")%>" />
<html>
<head><title>JBoard Thanks</title>
<stytle type="text/css">
<!--
@import url(Jboard.css);
-->
</stytle>
</head>
<body>
<h1>JBoard:Thank you ...</h1><p>
<b>Hi,<jsp:getProperty name="jboard" property="name" /><br/>
Thanks for the suggestion.</b></p>
<table>
<tr>
<td>
From
<em>
<a href="mailto:<jsp:getProperty name="jboard" property="login" />@<jsp:getProperty name="jboard" property="domain" />">
<jsp:getProperty name="jboard" property="name" /> </a>
</em><br/>
<em id="red"><small>
<jsp:getProperty name="jboard" property="date" />
</small></em>
</td>
<tr>
<td>
<jsp:getProperty name="jboard" property="suggestion" />
</td>
</tr>
</table><br/>
<jsp:useBean id="logbean" class="hh.LogDataBean" scope="application" />
<jsp:setProperty name="logbean" property="logPath" value="<%= application.getRealPath(\"/\") %>" />
<jsp:setProperty name="logbean" property="date" value="<%=jboard.getDate() %>" />
<jsp:setProperty name="logbean" property="*" />
<a href="SuggestionLog.jsp">Suggestion Log</a>
</body>
</html>
Uh-oh.jsp:
<%@ page isErrorPage="true" %>
<html>
<head><title>Uh-oh Page</title></head>
<body>
<h1 align="center">Uh Oh...</h1>
<p><font color="red"><%= exception %></font></p>
<p><% exception.printStackTrace(); %></p>
<hr/>
<p>Why don't you email the owner of this page and send the error you got?</p>
<p>Here's his email :<a href="sstirling@mediaone.net
</body></html>
SuggestionLog.jsp:
<%@ page errorPage="Uh-oh.jsp" %>
<html>
<head>
<title>JBoard Suggestion Log</title>
<style type="text/css">
<!--
@import url(Jboard.css);
-->
</style></head>
<body>
<h1>JBoard:Suggestion Log</h1>
<center>
<table>
<jsp:include page="data/SuggestionLog.inc" flush="true" />
</table>
<p><a href="<%=request.getContextPath()%>">back to main JBoard page</a>
</center>
</body>
</html>
从JBoard.jsp到SuggestionLog.jsp后,应该把SuggestionLog.inc的内容显示出来,但是,到了SuggestionLog.jsp页面后,只显示了:
JBoard:Suggestion Log
back to main JBoard page
我不知道究竟是哪里的问题,困扰好几天了,实在是没辙了,望各位大侠帮忙分析一下,先谢啦!
----------------解决方案--------------------------------------------------------
没人帮我呀,大家帮忙运行一下吧,感激不尽!!
----------------解决方案--------------------------------------------------------
如果你想让大家运行你的程序
那么能提交工程给我们是最好的了,毕竟我还很懒不想C&P你的代码
----------------解决方案--------------------------------------------------------
有道理,并且复制的话,还可能会出错误,搞得糊里糊涂
----------------解决方案--------------------------------------------------------
如果你想让大家运行你的程序
那么能提交工程给我们是最好的了,毕竟我还很懒不想C&P你的代码
怎么提交工程?
----------------解决方案--------------------------------------------------------
直接把你的项目的目录打包压缩
----------------解决方案--------------------------------------------------------