| |||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
---|---|---|---|---|---|---|---|---|---|
26 | 27 | 28 | 29 | 30 | 31 | 1 | |||
2 | 3 | 4 | 5 | 6 | 7 | 8 | |||
9 | 10 | 11 | 12 | 13 | 14 | 15 | |||
16 | 17 | 18 | 19 | 20 | 21 | 22 | |||
23 | 24 | 25 | 26 | 27 | 28 | 29 | |||
30 | 1 | 2 | 3 | 4 | 5 | 6 |
注意writer的參數(shù)有多個(gè),特別是有一個(gè)boolean的參數(shù)決定刷新或在附加文本
????????????log?
=
??
new
?PrintWriter(
new
?FileOutputStream(fl,
true
),
true
);
????????????SimpleDateFormat?df?
=
?
new
?SimpleDateFormat(
"
yyyy.MM.dd?'at'?hh:mm:ss\n
"
);
????????????Date?now?
=
?
new
?Date();
????????????String?dateformat?
=
?df.format(now)
????????????BufferedWriter?bf??
=
?
new
?BufferedWriter(
new
?FileWriter(fl,?
true
));
????????????bf.append(dateformat);
????????????bf.close();
????????????log.println(
"
start?connection?databse:
"
);
????????????log.println(
"
driver?name:
"
.concat(driveName);
ProcessInstance.hbm.xml:
<sqlMap namespace="PersonnelRegist">
? <typeAlias alias="ID" type="com.xindeco.core.pojo.IDEntity"/>
? </select>
?? <select id="GraAppInfo.searchUpApply" parameterClass="com.xindeco.business.dto.GraAppInfoDTO"????resultClass="ID" cacheModel="userCache">
?? select distinct a.ID AS id
?? from TGraAppInfo a? left join TEMPLOYUNITBASEINFO b on a.unit=b.MEMBERID
?? where appstatus = '1'
?? <dynamic>
?? <isNotEmpty prepend="AND" property="name">(a.name like '%' + #name# + '%')</isNotEmpty>
?? <isNotEmpty prepend="AND" property="unit">(b.UNITNAME like '%' + #unit# + '%')</isNotEmpty>
?? </dynamic>
? </select>
</sqlMap>
注意sqlmapGraAppInfoDTO的name,unit只能是基本數(shù)據(jù)類(lèi)型,不能是復(fù)雜數(shù)據(jù)類(lèi)型.
2、<script>的位置
<script>
form1.srchEdit.value='<%=srchEdit%>';
form1.srchType.value='<%=srchType%>';????
</script>
<form>
<input type="text" name="srchEdit"/>
<input type="text" name="srchType"/></form>
與<form>
<input type="text" name="srchEdit"/>
<input type="text" name="srchType"/>
</form>
<script>
form1.srchEdit.value='<%=srchEdit%>';
form1.srchType.value='<%=srchType%>';????
</script>
的差別,必須在form加載完對(duì)它賦值,否則srchEdit又重新加載,為null
3、hibernate屬性設(shè)置出現(xiàn)錯(cuò)誤:
????? 如果pojo類(lèi)取fSUnit屬性名,系統(tǒng)將無(wú)法識(shí)別。get和set將取不到值。
1、get是從服務(wù)器上取得數(shù)據(jù),post是向服務(wù)器上傳送數(shù)據(jù)。
2、get是將參數(shù)數(shù)據(jù)隊(duì)列(表單)加到提交表單的action所指定的url中,值和表單的各個(gè)字段是相互對(duì)應(yīng)的,Get將表單中數(shù)據(jù)的按照variable=value的形式,添加到action所指向的URL后面,并且兩者使用“?”連接,而各個(gè)變量之間使用“&”連接,在url中是可以看見(jiàn)的,
post是將表單各個(gè)字段放在http header內(nèi)一起傳送到action中的URL中,
3、get,服務(wù)器通過(guò)request.getQuery()獲得對(duì)應(yīng)的值;對(duì)于post,服務(wù)器通過(guò)request.getForm()表單的值。
4、get,傳送的數(shù)據(jù)小,post,傳送的數(shù)據(jù)大,上傳文件一般用post
特別注意:
<form action="/GraAppInfo/GraAppInfo.do?method=UpList"? method="post">
<select name="srchType">
???? <option value="0">名字</option>
???? <option value="1">用人單位</option>
???</select>
???<input height="18" name="srchEdit" type="text" align="right">
? <input? type="submit" value="查詢(xún)">
顯示的URL:http://localhost:8080/GraAppInfo/GraAppInfo.do?method=UpList
<form action="/GraAppInfo/GraAppInfo.do?method=UpList"? method="get">
顯示的URL:http://localhost:8080/GraAppInfo/GraAppInfo.do?srchType=0&srchEdit=da
可見(jiàn)post 會(huì)覆蓋action中的參數(shù),
5、中文用post傳遞不會(huì)出現(xiàn)亂碼,用get傳遞會(huì)出現(xiàn)亂碼
所以傳到action后要通過(guò)
String srchEdit = new String(graForm.getSrchEdit().getBytes("iso8859-1"), "gb2312");
處理。
二、傳到頁(yè)面的值亂碼
MENUID?UPMENUID?MENUNAME?MENUURL?MENUSEQ?LAYERLEVEL?RIGHTCODE?ISSHOW?TABLETYPE?STARTSTATE
?
?1083?1001?畢業(yè)生招聘?#?1?1?1083?1??
?1084?1083?畢業(yè)生申報(bào)?/GraAppInfo/GraAppInfo.do?method=graappinfolist?6?9?1084?1??
menuid 該層菜單的id ?upmenuid 上一層菜單id? menuname 菜單名字
menuurl 該層菜單的地址(首層菜單為#,沒(méi)有地址)
menuseq 該層菜單在上一層菜單的順序
layerlevel 如果是最后一層的菜單為9,其他為1
rigntcode關(guān)聯(lián)到權(quán)限表=menuid
idshow 是否顯示
權(quán)限表:
RIGHTID?RIGHTCODE?ROLETYPE?ROLEID?DEPTID?USERID?MENUID?FUNNAME
1084??????????????? 1084????????????? 2????????????????????2??????????????????
?????????????????????0??????? 0??????????? 1084?????????? 畢業(yè)生申報(bào)
rightid=menuid=rightcode,roletype,roleid
這是單位的菜單設(shè)置和權(quán)限設(shè)置(1000〈menuid〈2000)
2、人事單位內(nèi)部的設(shè)置(4000〈munuid〈5000)
權(quán)限的設(shè)置通過(guò)頁(yè)面來(lái)控制
public class EmployUnitBaseInfo
{???
?
??? private long ID; //用人單位系統(tǒng)編號(hào)---邏輯主鍵
??? private String unitCode; //用人單位代號(hào)--業(yè)務(wù)主鍵
}
1、??? 使用邏輯主鍵,分頁(yè)比較方便
2、??? 有可能unitcode會(huì)改變,用id可以保證當(dāng)unitcode改變時(shí),這個(gè)實(shí)體還存在
在頁(yè)面上必須返回workpost + demandid,,
pojo 中的demand類(lèi)如下:只有以下屬性的setter和getter
??? private String usedNeedNum;
??? private int unitId;
??? private String demandInfo;
private long ID;
??? private String needNum;
??? private String position;
必須再添加一個(gè)屬性demandInfo,
而在另一個(gè)畢業(yè)生申報(bào)中又要如圖上操作,,如何在service層向頁(yè)面層傳遞這些信息(測(cè)試程序員(剩2需求數(shù)))
public class DemandServiceImpl
??? extends BaseServiceImpl implements DemandService{
??? public List getDemandList(int unitId)
??? {
????????? long demandId;
????????? int needNum;
????????? int usedNeedNum;
????????? int lastNum;
?????????
????????? String demandInfo;
????????? TRealDemandDAOImpl dao = (TRealDemandDAOImpl) this.getBaseDAO();
????????? List list = dao.getSpareDemandByUnitId(unitId);
????????? Iterator it = list.iterator();
????????? while(it.hasNext())
????????? {
????????????? TRealDemand demand = (TRealDemand) it.next();
????????????? demandId = demand.getID();
????????????? needNum =? Integer.parseInt(demand.getNeedNum());?
????????????? usedNeedNum = Integer.parseInt(demand.getUsedNeedNum());
????????????? if(needNum>usedNeedNum)
????????????? {
????????????????? lastNum = usedNeedNum-needNum;
????????????????? demandInfo = demand.getPosition()+" 剩 " + lastNum +" 需求數(shù) ";
????????????? }
?????????????
????????? }
????????? return list;
??? }
}
在action層再通過(guò)以下代碼向頁(yè)面?zhèn)鬟f數(shù)據(jù):
DemandService demandService = (DemandService) this.getBean("DemandService");
?request.setAttribute("demandList",demandService.findDemandListByUnitId(unitInfo.getID()));
4、注意DemandServiceImpl 是實(shí)現(xiàn)類(lèi),DemandService 是interface
DemandService demandService = (DemandService) this.getBean("DemandService");
和DemandServiceImpl demandService = (DemandServiceImpl) this.getBean("DemandService");
雖然兩個(gè)的操作一樣,但是demandService是接口但可以執(zhí)行相應(yīng)的操作,起到黑箱子的作用。
5、記得在action中添加一個(gè)實(shí)體時(shí),要通過(guò)idcard取得sex和birthday的屬性加到內(nèi)存中(表相對(duì)應(yīng)的pojo)
1、
org.springframework.orm.ObjectRetrievalFailureException: Object of class [com.xindeco.myregister.pojo.MyRegisterInfo] with identifier [14]: not found
MyRegisterInfo在數(shù)據(jù)庫(kù)沒(méi)有identifier [14]對(duì)象。
2、
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Repeated column in mapping for entity: com.xindeco.myregister.pojo.MyRegisterInfo column: password (should be mapped with insert="false" update="false")
出錯(cuò)原因:password 和repassword同時(shí)對(duì)應(yīng)數(shù)據(jù)庫(kù)表中的password一列,同時(shí)update和insert都設(shè)為true。
xml文件如下:
??? <property name="password"
????????????????????????? type="java.lang.String"
????????????????????????? update="true"
????????????????????????? insert="true"
????????????????????????? access="property"
????????????????????????? column="password"
????????????????????????? length = "32"
????????????????????????? />
???????????????????????? <property name="repassword"
????????????????????????? type="java.lang.String"
????????????????????????? update="false"
????????????????????????? insert="false"
????????????????????????? access="property"
????????????????????????? column="password"
????????????????????????? length = "32"
????????????????????????? />
解決的方法:
將repassword的insert和update設(shè)為false。
3、
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed;
nested exception is org.hibernate.PropertyNotFoundException: Could not find a getter for ID in class
錯(cuò)誤原因:hibernate的映射文件中ID是大寫(xiě)的,而pojo的類(lèi)中id是小寫(xiě)的
注意事項(xiàng):每個(gè)pojo的類(lèi)都要繼承abstractEntity,其中abstractEntity類(lèi)有個(gè)ID的屬性要重寫(xiě)
?public abstract class AbstractEntity
??? implements Entity, BaseDTO {
??? abstract public long getID();
??? abstract public void setID(long id);
??? public int hashCode() {
??????? return (int)this.getID();
??? }
??? public boolean equals(Object obj) {
??????? if (obj == this) {
??????????? return true;
??????? }
??????? if (obj instanceof Entity) {
??????????? return this.getID() == ( (Entity) obj).getID();
??????? }
??????? return false;
??? }
}
4、
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition
錯(cuò)誤原因:
在application.xml文件中deleteRegister方法以delete開(kāi)頭,并沒(méi)有被設(shè)定為可更改的,應(yīng)如下設(shè)置:
?<!--為事物創(chuàng)建代理類(lèi),并指定方法的事物類(lèi)型-->
? <bean id="baseTxProxy" lazy-init="true" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
??? <property name="transactionManager">
????? <ref bean="transactionManager"/>
??? </property>
??? <property name="transactionAttributes">
????? <props>
??????? <prop key="add*">PROPAGATION_REQUIRED</prop>
??????? <prop key="cancel*">PROPAGATION_REQUIRED</prop>
???????????</props>
??? </property>
? </bean>
加上一行
? <prop key="delete*">PROPAGATION_REQUIRED</prop>
5、
???ERROR org.apache.struts.util.RequestUtils - Error creating form bean of class com.xindeco.business.web.form.GraAppInfoForm
public class? GraAppInfoForm
extends ActionForm 錯(cuò)誤寫(xiě)成
public abstratic?class? GraAppInfoForm
extends ActionForm
6、
2006-04-25 08:56:38,495 ERROR com.xindeco.business.web.action.GraAppAction - com.xindeco.business.web.action.GraAppAction@8e2fb5
java.lang.ClassCastException: $Proxy0
?at com.xindeco.business.web.action.GraAppAction.newone(GraAppAction.java:30)
?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
?at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
?at java.lang.reflect.Method.invoke(Method.java:585)
?at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
?at com.xindeco.core.web.action.BaseAction.dispatchMethod(BaseAction.java:153)
?at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
actioin類(lèi)中的newone方法如下:
public? class GraAppAction
??? extends BaseAction {
??? public ActionForward newone(ActionMapping mapping, ActionForm form,
????????????????????????????? HttpServletRequest request,
????????????????????????????? HttpServletResponse response) throws Exception {
???????GraAppService ?graservice = (GraAppService) this.getBean("GraAppService");
}
applicationcontext中的GraAppService的配置如下:
??? <bean id="GraAppDAO" class="com.xindeco.business.dao.impl.GraAppDAOImpl">
??? <property name="support">
????? <ref local="support"/>
??? </property>
??? <property name="sessionFactory">
????? <ref local="sessionFactory"/>
??? </property>
? </bean>
? <bean id="GraAppService" parent="baseTxProxy">
??? <property name="target">
????? <bean class="com.xindeco.business.service.impl.GraAppServiceImpl" autowire="byName">
??????? <property name="baseDAO">
????????? <ref bean="GraAppDAO"/>
??????? </property>
????? </bean>
??? </property>
? </bean>
因此this.getBean("GraAppService");是為了得到GraAppServicImpl類(lèi)的實(shí)現(xiàn)。GraAppService是interface
public class GraAppServiceImpl extends BaseServiceImpl
??? implements GraAppService{
}
7、org.hibernate.hql.ast.QuerySyntaxException: Demand is not mapped. [from Demand where unitid = ? and needNum > usedNeedNum]
hibernate.cfg.xml沒(méi)有配置Demand.hbm.xml文件的目錄
8、org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: 列名 'id' 無(wú)效。
java.sql.SQLException: 列名 'name' 無(wú)效。
因?yàn)閔ibernate聲明的id,name的columnid屬性沒(méi)有與數(shù)據(jù)庫(kù)的字段對(duì)應(yīng),所以id,name無(wú)效。
9、java.lang.NumberFormatException: null
?at java.lang.Integer.parseInt(Integer.java:415)
?at java.lang.Integer.parseInt(Integer.java:497)
?at com.xindeco.business.service.impl.DemandServiceImpl.findDemandListByUnitId(DemandServiceImpl.java:33)
錯(cuò)誤語(yǔ)句為
?needNum = Integer.parseInt(demand.getNeedNum());
?usedNeedNum = Integer.parseInt(demand.getUsedNeedNum());
因?yàn)閐emand.getUsedNeedNum()==null,無(wú)法轉(zhuǎn)化為string 類(lèi)型,
10、rg.apache.jasper.JasperException: /GraAppInfo/GraAppInfoNew.jsp(343,29) According to TLD, tag bean:write must be empty, but is not
錯(cuò)誤的原因:
????????????? <select name="politicsID" >
??????????? ?<option value="">請(qǐng)選擇</option>
?????? <logic:notEmpty name="politicsList">
??????????????? <logic:iterate id="politics" name="politicsList">
????????????????????????? </logic:notEmpty>
???????????<option value="<bean:write name="politics" property="codeID"/>"><bean:write name="politics" property="codeName"/></option>
????????? </logic:iterate>
?</select>
就因?yàn)樯倭?>
以后懂得通過(guò)查找字?jǐn)?shù),來(lái)檢查錯(cuò)誤
11、2006-04-26 13:27:54,812 ERROR com.xindeco.core.util.BeanUtils - bean property [Nation] copy failed
com.xindeco.core.exception.ConvertException: org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: java.lang.String; nested exception is org.hibernate.MappingException: Unknown entity: java.lang.String
beanUtil.beanCopy(grapojo,form,BizConstants.CONVERTER);
要求:
1、pojo類(lèi)的屬性只有與form屬性名字相同,才能beancopy成功
2、pojo中屬性是實(shí)體,在form中一定要用int,long表示
出現(xiàn)這錯(cuò)誤的原因是pojo中的屬性不是實(shí)體,而錯(cuò)誤寫(xiě)成:
string
?private String nation;應(yīng)改成 private?Syscode nation;
12、
2006-04-26 14:38:37,843 ERROR com.xindeco.business.web.action.GraAppAction - com.xindeco.business.web.action.GraAppAction@fa1b2d
java.lang.NullPointerException
?at com.xindeco.business.web.action.GraAppAction.newone(GraAppAction.java:43)
?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
hibernate配置文件沒(méi)改,程序找不到相應(yīng)的類(lèi)
??????? <many-to-one
??????????? name="FSUnit"
??????????? class="com.xindeco.business.pojo.EmployUnitBaseInfo"
??????????? cascade="none"
??????????? outer-join="auto"
??????????? update="true"
??????????? insert="true"
??????????? access="property"
??????????? column="fSUnit"
??????? />
其實(shí)FSUnit對(duì)應(yīng)的類(lèi)應(yīng)該是FSUnit
??????? <many-to-one
??????????? name="FSUnit"
??????????? class="com.xindeco.business.pojo.FSUnit"
??????????? cascade="none"
??????????? outer-join="auto"
??????????? update="true"
??????????? insert="true"
??????????? access="property"
??????????? column="fSUnit"
??????? />
13、
org.hibernate.MappingException: An association from the table GraAppInfo refers to an unmapped class: com.xindeco.business.pojo.FSUnit
錯(cuò)誤原因:hibernate.cfg.xml沒(méi)有配置fsunit.hbm.xml文件的位置
14、
java.lang.ClassCastException: com.xindeco.business.dao.impl.GraAppDAOImpl
at com.xindeco.business.service.impl.GraAppServiceImpl.addGraduateApp(GraAppServiceImpl.java:16)
GraAppServiceImpl.java:16
第16行: GraAppDAO dao = (GraAppDAO) this.getBaseDAO();//其實(shí)得到的是GraAppDAOImpl
錯(cuò)誤的原因是
public class GraAppDAOImpl
??? extends BaseDAOImpl {
}
沒(méi)有實(shí)現(xiàn)GraAppDAO接口,正確的做法是
public class GraAppDAOImpl
??? extends BaseDAOImpl implements GraAppDAO {
}
先繼承后實(shí)現(xiàn)
15、2006-04-27 08:38:54,078 ERROR com.xindeco.business.web.action.GraAppAction - com.xindeco.business.web.action.GraAppAction@1d6399b
java.lang.ClassCastException: com.xindeco.business.pojo.SysCode
?at org.hibernate.type.StringType.set(StringType.java:26)
?at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:63)
?at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:40)
一般是因?yàn)閔ibernate聲明類(lèi)型和pojo類(lèi)聲明的類(lèi)型不一樣,并且前面已經(jīng)出現(xiàn)了Hibernate: insert into TGraAppInfo (name, whereFrom, degree, college, speciality, studentRelTel, remark, higherEduLength, highSchool, studyResume, normalOrNot, proxyUnit, workPost, workPlace, studentAddress, studentPostNumber, nation, appStatus) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
的操作提示,查出錯(cuò)誤的原因有:
??????? <many-to-one
??????????? name="demand"
??????????? class="com.xindeco.business.pojo.Syscode"
??????????? cascade="none"
??????????? outer-join="auto"
??????????? update="true"
??????????? insert="true"
??????????? access="property"
??????????? column="demandID"
??????? />
???????? <property
??????????? name="appStatus"
??????????? type="int"
??????????? update="true"
??????????? insert="true"
??????????? access="property"
??????????? column="appStatus"
??????????? length="10"
??????? />
應(yīng)改為????
??????? <many-to-one
??????????? name="demand"
??????????? class="com.xindeco.business.pojo.Demand"
??????????? cascade="none"
??????????? outer-join="auto"
??????????? update="true"
??????????? insert="true"
??????????? access="property"
??????????? column="demandID"
??????? />
??<many-to-one
??????????? name="nation"
??????????? class="com.xindeco.business.pojo.SysCode"
??????????? cascade="none"
??????????? outer-join="auto"
??????????? update="true"
??????????? insert="true"
??????????? access="property"
??????????? column="nation"
??????? />
16、
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: com.xindeco.business.pojo.SysCode
?at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:626)
?at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:570)
?at
org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:482)
pojo類(lèi)為:
public class GraAppInfo{
???????????? private College college;
}
action 類(lèi)為
public class GraAppAction
??? extends BaseAction {
?????? public ActionForward add(ActionMapping mapping, ActionForm form,
???????????????????????????? HttpServletRequest request,
???????????????????????????? HttpServletResponse response) throws Exception {
????????graInfo.setCollege(new College());\\必須從數(shù)據(jù)庫(kù)找到college這個(gè)對(duì)象,而不能新生成
???????
??????? graInfo.getCollege().setID(graForm.getCollegeID());
??????? graInfo.setAppStatus(Integer.parseInt("0"));
??????service.addGraduateApp(graInfo);
}
public class GraAppServiceImpl extends BaseServiceImpl
??? implements GraAppService{
??? public boolean addGraduateApp(GraAppInfo info)
??? {
??????? this.getBaseDAO().save(info);
??????? return true;
??? }
}
dao類(lèi)save方法為
??? getHibernateTemplate().save(obj);
當(dāng)cascade="all",插入new college 除了id和原來(lái)的記錄一樣,其他的字段全部都被更新,為null
當(dāng)cascase=“insert”,插入new college 只會(huì)把它的id插入grainfo表中,其他字段不變。
17、java.sql.SQLException: Unable to convert between java.lang.Integer and BLOB.
因?yàn)?br />??????? <property
??????????? name="province"
??????????? type="com.xindeco.business.pojo.SysCode"http://不能用復(fù)雜類(lèi),
??????????? update="true"
??????????? insert="true"
??????????? access="property"
??????????? column="provinceId"
??????? />
應(yīng)該改為
??? ??????? <many-to-one
??????????? name="province"
??????????? class="com.xindeco.business.pojo.SysCode"
??????????? cascade="none"
??????????? outer-join="auto"
??????????? update="true"
??????????? insert="true"
??????????? access="property"
??????????? column="provinceId"
??????? />
18、javax.servlet.jsp.JspException: Cannot create iterator for this collection
?at org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:265)
jsp文件如下:
? ?<logic:notEmpty name="graduateList" >
? ?<logic:iterate id="graduate"? name="graduateList" >
?? </ogic:notEmpty >
?? </ogic:iterat>
graduateList是一個(gè)類(lèi),而logic:iterator要求必須是ArrayList,HashSet....這樣的集合類(lèi),而graduateList中一個(gè)屬性是ArrayList或HashSet的
應(yīng)改為:
<logic:notEmpty name="graduateList" property="items">
?<logic:iterate id="graduate"? name="graduateList" property="items" >
?</ogic:notEmpty >
??</ogic:iterat>
19、2006-05-11 17:13:37,468 ERROR com.xindeco.business.web.action.GraAppAction - com.xindeco.business.web.action.GraAppAction@bc22eb
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
SysUser user= (SysUser) request.getSession().getAttribute(WebConstants.SESSION_USER);
??????? System.out.println(user.getRole().getRoleName());
當(dāng)hibernate session取出數(shù)據(jù)放到http session時(shí),
由于sysuser中role的lazy=“true”,所以沒(méi)有將RoleName放到http session中,當(dāng)System.out.println(user.getRole().getRoleName());
時(shí),雖然http session還開(kāi)著, hibernat seesion已經(jīng)關(guān)閉
??????? <many-to-one
??????????? name="role"
??????????? class="com.xindeco.business.pojo.SysRole"
??????????? lazy="false"
??????????? cascade="none"
??????????? outer-join="auto"
??????????? update="true"
??????????? insert="true"
??????????? access="property"
??????????? column="roleID"
??????? />
20、Association references unmapped class: com.xindeco.workflow.WFNode
因?yàn)閍pplication.xml文件中沒(méi)有配置<mapping resource="com/xindeco/workflow/WFNode.hbm.xml"/>
系統(tǒng)找不到WFNode