jsp页面输出数据库数据问题,为什么刷新页面数据会消失?必须重起Tomcat?大家指教!谢谢!
遇到一个怪问题,希望大家指教。我在Jsp页面输出数据库的数据,启动Tomcat在地址栏中输入
http://我的IP/term/rightframe.jsp?corpus=eCorpus&eFile=06591_e.xml&cFile=06592_c.xml,
这是我的jsp程序,然后页面可以显示数据库的数据,可是如果刷新页面,由数据库导入的数据会消失,必须重新启动tomcat才能再次显示,不知道是什么原因?其大家指点!以下是我的代码:
<%@ page contentType= "text/html; charset=GBK " %>
<%@ page import= "Term.Corpus.AddDataToBase " %>
<html>
<head>
<style type= "text/css ">
s{TEXT-DECORATION:none}
</style>
</head>
<%
String efile=request.getParameter( "eFile ") ;
String cfile=request.getParameter( "cFile ") ;
String corpus=request.getParameter( "corpus ") ;
String file=new String() ;
if(corpus.compareTo( "eCorpus ")==0 )
{
file=efile;
}
else if(corpus.compareTo( "GBCorpus ")==0)
{
file=cfile.replace( "_c.xml ", "_sc.xml ");
}
else
{
file=cfile;
}
%>
<%
out.print( " <a href=\ "rightframe.jsp?corpus=eCorpus&eFile= "+efile+ "&cFile= "+cfile+ "\ "> "+ "英语语料库 </a> ") ;
%>
<%
out.print( " <a href=\ "rightframe.jsp?corpus=GBCorpus&eFile= "+efile+ "&cFile= "+cfile+ "\ "> "+ "简体中文语料库 </a> ") ;
%>
<%
out.print( " <a href=\ "rightframe.jsp?corpus=Big5Corpus&eFile= "+efile+ "&cFile= "+cfile+ "\ "> "+ "繁体中文语料库 </a> ") ;
%>
<hr />
<jsp:useBean id= "showcorpus " scope= "page " class= "Term.Corpus.AddDataToBase ">
</jsp:useBean>
<%
out.print(corpus);
out.print(file);
out.print(showcorpus.ReadDataFromDB(corpus,file)) ;
%>
<br>
<form name= "myform " action= " ">
<textarea cols= "100 " rows= "10 " name= "termarea ">
</textarea>
<br />
<input type= "submit " onclick= " "/>
</form>
</body>
</html>
------解决方案--------------------将scope= "page "改为scope= "request "