问题描述
/**GeneratedbyMyEclipseStruts*Templatepath:templates/java/JavaClass.vtl*/packagebookstore;importjava.util.List;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importjavax.servlet.http.HttpSession;importorg.apache.struts.action.Action;importorg.apache.struts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;importorg.apache.struts.action.ActionMessage;importorg.apache.struts.action.ActionMessages;importorg.hibernate.Query;importorg.hibernate.Session;importbookstore.database.HibernateUtil;/***MyEclipseStruts*Creationdate:04-26-2011**XDocletdefinition:*@struts.actionpath="/guess"name="guessForm"scope="request"validate="true"*@struts.action-forwardname="remarkbook"path="/guessbook.jsp"*/@SuppressWarnings("unused")publicclassGuessActionextendsAction{/**GeneratedMethods*//***Methodexecute*@parammapping*@paramform*@paramrequest*@paramresponse*@returnActionForward*/publicActionForwardexecute(ActionMappingmapping,ActionFormform,HttpServletRequestrequest,HttpServletResponseresponse){GuessFormguessForm=(GuessForm)form;//TODOAuto-generatedmethodstub//request.getSession().invalidate();ActionMessageserrors=newActionMessages();//ActionForwardforward=mapping.findForward("frontPage");try{//����û��������Ƿ�Ϸ�SessiondbSession=HibernateUtil.currentSession();HibernateUtil.beginTransaction();//dbSession.flush();StringhqlStr="fromRemarkasrorderbyr.id";Queryquery=dbSession.createQuery(hqlStr);Listresult=query.list();HibernateUtil.commitTransaction();request.setAttribute("remarks",result);//System.out.println(result.size());//if(result.size()==0){//errors.add("inputErrors",newActionMessage("index.loginError"));//this.saveErrors(request,errors);//returnmapping.findForward("failed");//}else{////}}catch(Exceptione){errors.add("dbError",newActionMessage("globle.dbError"));this.saveErrors(request,errors);returnmapping.getInputForward();}returnmapping.findForward("remarkbook");}}
<logic:presentname="remarks"><!--遍历一个集合,此处是显示remarks集合中的信息,即查询得到的评论信息--><logic:presentid="aremark"name="remarks"scope="request"><tablewidth="100%"class="default"><tr><tdwidth="20%"align="center"valign="top"class="item"> <bean:messagekey="index.username"/> </td><td><bean:writename="aremark"property="id"/></td><tdalign="right"valign="top"class="item"> <bean:messagekey="guessbook.date"/> </td><td>显示时间</td></tr><bean:writename="aremark"property="date"/><tr><tdalign="center"valign="top"> <bean:messagekey="guessbook.remark"/></td><tdcolspan="3"><br><bean:writename="aremark"property="remark"/><br></td></tr></table><br></logic:present></logic:present></td></tr><tr><td>
解决方案
解决方案二:
2011-4-2622:21:16org.apache.catalina.startup.HostConfigcheckResources信息:Reloadingcontext[/test2]log4j:WARNNoappenderscouldbefoundforlogger(org.apache.struts.util.PropertyMessageResources).log4j:WARNPleaseinitializethelog4jsystemproperly.2011-4-2622:21:28org.apache.catalina.startup.HostConfigcheckResources信息:Reloadingcontext[/test2]log4j:WARNNoappenderscouldbefoundforlogger(org.apache.struts.util.PropertyMessageResources).log4j:WARNPleaseinitializethelog4jsystemproperly.2011-4-2622:21:31org.apache.catalina.loader.WebappClassLoaderloadClass信息:Illegalaccess:thiswebapplicationinstancehasbeenstoppedalready.Couldnotloadjava.net.BindException.Theeventualfollowingstacktraceiscausedbyanerrorthrownfordebuggingpurposesaswellastoattempttoterminatethethreadwhichcausedtheillegalaccess,andhasnofunctionalimpact.java.lang.IllegalStateExceptionatorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1244)atorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)atjava.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)atcom.mysql.jdbc.CommunicationsException.<init>(CommunicationsException.java:161)atcom.mysql.jdbc.MysqlIO.send(MysqlIO.java:2759)atcom.mysql.jdbc.MysqlIO.quit(MysqlIO.java:1410)atcom.mysql.jdbc.Connection.realClose(Connection.java:4900)atcom.mysql.jdbc.Connection.cleanup(Connection.java:2061)atcom.mysql.jdbc.Connection.finalize(Connection.java:3376)atjava.lang.ref.Finalizer.invokeFinalizeMethod(NativeMethod)atjava.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)atjava.lang.ref.Finalizer.access$100(Finalizer.java:14)atjava.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
解决方案三:
这是首页的链接<ahref="<%=basePath%>guess.do">书友留言</a></div>
解决方案四:
设个断点跟一下,看在那一步出错了
解决方案五:
问题解决了,《logic:presentid="aremark"name="remarks"scope="request">present改为iter……容器就可以了!