问题描述
<%@pagelanguage="java"import="java.util.*"pageEncoding="utf-8"%><%@taglibprefix="s"uri="/struts-tags"%><!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"><html><head><title>......</title><styletype="text/css">#title{font-family:微软雅黑;font-size:20px;}#test{width:150px;height:200px;}</style><SCRIPTtype="text/javascript">functionshow(aaa){max=500;if(aaa.value.length<max){document.getElementById("sp").innerHTML="字数必须超过5000";}else{document.myfor.submit();}}</SCRIPT><SCRIPTtype="text/javascript"src="jquery-1.8.0.min.js"></SCRIPT><SCRIPTtype="text/javascript">functiongetN(){$.ajax({url:'replie!getplies.action',data:'replies.content='+replies.content,type='post',success:function(result){$("#replyTime").html(result);}});}</SCRIPT></head><body><center><div><divalign="left"id="title"><span><s:propertyvalue="#request.ccc.title"/></span><table><tr><td>发表于:<s:propertyvalue="#request.ccc.reporttime"/></td></tr><tr><td><s:propertyvalue="#request.ccc.content"/></td></tr><tr><td>读者回应:</td></tr><s:iteratorvalue="#request.ccc"var="a"><tr><td>${a.sets.content}</td><td>${a.sets.replyTime}</td></tr></s:iterator></table><s:formmethod="post"action="replie!getplies.action"name="myfor"id="myfro"onchange="getN"><s:textareaname="replies.content"id="test"onblur="returnshow(this)"/><spanid="sp"></span><br/><table><tr><td><inputtype="submit"value="提交"/></td></tr></table></s:form></div></div></center></body></html>${a.sets.}这里报错<?xmlversion="1.0"?><!DOCTYPEhibernate-mappingPUBLIC"-//Hibernate/HibernateMappingDTD3.0//EN""http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping><classname="cn.xml.model.replies"table="replies"><idname="id"column="Id"><generatorclass="sequence"><paramname="sequence">sq_a</param></generator></id><propertyname="content"column="content"/><propertyname="replyTime"column="replytime"/><many-to-onename="informations"class="cn.xml.model.Informations"column="infold"cascade="all"fetch="select"></many-to-one></class></hibernate-mapping>两张表配置<?xmlversion="1.0"?><!DOCTYPEhibernate-mappingPUBLIC"-//Hibernate/HibernateMappingDTD3.0//EN""http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping><classname="cn.xml.model.Informations"table="informations"><idname="infold"column="infold"type="java.lang.Integer"><generatorclass="sequence"><paramname="sequence">sq_a</param></generator></id><propertyname="title"column="titleNAME"></property><propertyname="content"column="content"></property><propertyname="replycount"column="replyCount"></property><propertyname="viewcount"column="viewCount"></property><propertyname="reporttime"column="AUTHORTIME"/><propertyname="lastposttime"column="LATELYTIME"></property><setname="sets"cascade="all"inverse="true"fetch="join"><keycolumn="Id"></key><one-to-manyclass="cn.xml.model.replies"/></set></class></hibernate-mapping>
解决方案
解决方案二:
${a.sets.点}这里报错Property'content'notfoundontypeorg.hibernate.collection.PersistentSetAnexceptionoccurredprocessingJSPpage/adminleft.jspatline7168:69:70:71:${a.sets.content}72:73:74:${a.sets.replyTime}Stacktrace:
解决方案三:
${a.sets.content}//sets不是一个单独的entity对象,它是一个集合,还得对它进行循环才能调用content属性
解决方案四:
如果你想输出content的大小,可以引入JSTL的FN函数标签库这样写:${fn:length(a.sets.content)}参考地址:http://jun1986.iteye.com/blog/1067107
解决方案五:
看你贴出来的,没得格式看着真心吃力