锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久综合亚洲色hezyo,亚洲欧洲国产成人综合在线观看,亚洲欧美一区二区三区日产http://m.tkk7.com/botson/category/30205.htmlzh-cnTue, 25 Mar 2008 20:09:42 GMTTue, 25 Mar 2008 20:09:42 GMT60Hibernate+Spring瀹炵幇澶氬涓鍏寵仈http://m.tkk7.com/botson/archive/2008/03/23/187993.htmlJam ChanJam ChanSun, 23 Mar 2008 02:06:00 GMThttp://m.tkk7.com/botson/archive/2008/03/23/187993.htmlhttp://m.tkk7.com/botson/comments/187993.htmlhttp://m.tkk7.com/botson/archive/2008/03/23/187993.html#Feedback0http://m.tkk7.com/botson/comments/commentRss/187993.htmlhttp://m.tkk7.com/botson/services/trackbacks/187993.html-- 鍒涘緩鐢ㄦ埛琛?/span>
CREATE TABLE SCOTT.bloguser
(
    id    
NUMBER NOT NULL,
    username    
VARCHAR2(50UNIQUE NOT NULL,
    password    
VARCHAR2(50NOT NULL,
    
CONSTRAINT PK_bloguser PRIMARY KEY (id )
);
-- 鍒涘緩鐢ㄦ埛琛ㄤ富閿簭鍒?/span>
CREATE SEQUENCE SEQ_BLOGUSERID START WITH 1 INCREMENT BY 1 MINVALUE 1 NOCACHE  NOCYCLE  NOORDER ;

-- 鍒涘緩bolg琛?/span>
CREATE TABLE SCOTT.bolginfo
(
    id    
NUMBER,
    userId    
NUMBER NOT NULL,
    content    
VARCHAR2(1000),
    
CONSTRAINT PK_bolginfo PRIMARY KEY (id )
);
-- 鍒涘緩bolg琛ㄤ富閿簭鍒?/span>
CREATE SEQUENCE SEQ_BLOGID START WITH 1 INCREMENT BY 1 MINVALUE 1 NOCACHE  NOCYCLE  NOORDER ;

--娣誨姞澶栭敭綰︽潫
ALTER TABLE SCOTT.bolginfo
    
ADD CONSTRAINT FK_userId_blogId FOREIGN KEY (userId) REFERENCES SCOTT.bloguser(id);
Bloguser.java
package com.jam.hibeinate.po;

import java.util.Set;

/**
 * Bloguser entity.
 * 
 * 
@author Jam Chan
 
*/
public class Bloguser implements java.io.Serializable {


    private Long id;
    private String username;
    private String password;
    private Set bolginfos = new HashSet(0);

}

Bolginfo.java
package com.jam.hibeinate.po;

/**
 * Bolginfo entity.
 * 
 * 
@author Jam Chan
 
*/
public class Bolginfo implements java.io.Serializable {

    private Long id;
    private Bloguser bloguser;
    private String content;

}

Bloguser.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
>
<!-- 
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    
<class name="com.jam.hibeinate.po.Bloguser" table="BLOGUSER" schema="SCOTT">
        
<id name="id" type="java.lang.Long">
            
<column name="ID" precision="22" scale="0" />
            
<generator class="sequence">
                
<param name="sequence">
                    SEQ_BLOGUSERID
                
</param>
            
</generator>
        
</id>
        
<property name="username" type="java.lang.String">
            
<column name="USERNAME" length="50" not-null="true" unique="true" />
        
</property>
        
<property name="password" type="java.lang.String">
            
<column name="PASSWORD" length="50" not-null="true" />
        
</property>
        
<set name="bolginfos" inverse="true" cascade="all" lazy="false" outer-join="auto">
            
<key>
                
<column name="USERID" precision="22" scale="0" not-null="true" />
            
</key>
            
<one-to-many class="com.jam.hibeinate.po.Bolginfo" />
        
</set>
    
</class>
</hibernate-mapping>

Bolginfo.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
>
<!-- 
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    
<class name="com.jam.hibeinate.po.Bolginfo" table="BOLGINFO" schema="SCOTT">
        
<id name="id" type="java.lang.Long">
            
<column name="ID" precision="22" scale="0" />
            
<generator class="sequence">
                
<param name="sequence">SEQ_BLOGID</param>
            
</generator>
        
</id>
        
<many-to-one name="bloguser" class="com.jam.hibeinate.po.Bloguser" fetch="select" insert="true" update="true" outer-join="true">
            
<column name="USERID" precision="22" scale="0" not-null="true" />
        
</many-to-one>
        
<property name="content" type="java.lang.String">
            
<column name="CONTENT" length="1000" />
        
</property>
    
</class>
</hibernate-mapping>

娉細Spring鐨刟pplicationContext.xml浜嬪姟浠g悊綆$悊鐨勯厤緗渷鐣?#8230;…

涔嬪墠鎴戝疄鐜板琛ㄦ煡璇㈢殑鏃跺欐姏鍑?br />
could not initialize proxy - the owning Session was closed
org.hibernate.LazyInitializationException: could not initialize proxy 
- the owning Session was closed
……………………
鐨勫紓甯革紝濡傛灉鎯充嬌Session is opened闇瑕佸湪web.xml娣誨姞濡備笅閰嶇疆錛?br />
     <filter>
        
<filter-name>openSessionInViewFilter</filter-name>
        
<filter-class>
            org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
        
</filter-class>
    
</filter>
    <!-- 閫夋嫨闇瑕佽繃婊ょ殑欏甸潰 -->
    <filter-mapping>
        
<filter-name>openSessionInViewFilter</filter-name>
        
<url-pattern>*.faces</url-pattern>
    
</filter-mapping>
    
<filter-mapping>
        
<filter-name>openSessionInViewFilter</filter-name>
        
<url-pattern>*.do</url-pattern>
    
</filter-mapping>
    
<filter-mapping>
        
<filter-name>openSessionInViewFilter</filter-name>
        
<url-pattern>*.jsp</url-pattern>
    
</filter-mapping>

涔嬪悗灝監K鍟錛侊紒鍝堝搱





Jam Chan 2008-03-23 10:06 鍙戣〃璇勮
]]>
JSF鏁村悎Spring鏃跺悇鏂囦歡鐨勯厤緗?/title><link>http://m.tkk7.com/botson/archive/2008/03/20/187557.html</link><dc:creator>Jam Chan</dc:creator><author>Jam Chan</author><pubDate>Thu, 20 Mar 2008 12:44:00 GMT</pubDate><guid>http://m.tkk7.com/botson/archive/2008/03/20/187557.html</guid><wfw:comment>http://m.tkk7.com/botson/comments/187557.html</wfw:comment><comments>http://m.tkk7.com/botson/archive/2008/03/20/187557.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/botson/comments/commentRss/187557.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/botson/services/trackbacks/187557.html</trackback:ping><description><![CDATA[鏈榪戝湪鍋氫竴涓渶瑕丣SF鍜孲pring鏁村悎鐨勯」鐩紝涔嬪墠涓嶇煡閬撳浣曞湪鍚庡彴綆$悊Bean鑾峰彇琚玈pring綆$悊鐨勪笟鍔$被瀵硅薄錛岀幇鍦ㄨВ鍐充簡錛屽彲浠ヨ窇璧鋒潵浜嗭紒<br /> <br /> <ol> <li><span style="color: red;">web.xml<br /> </span> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #008080;"> 1</span> <span style="color: #808080;"><</span><span style="color: #000000;">?xml version</span><span style="color: #808080;">=</span><span style="color: #000000;">"</span><span style="color: #800000; font-weight: bold;">1.0</span><span style="color: #000000;">"?</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 2</span> <span style="color: #808080;"><</span><span style="color: #000000;">web</span><span style="color: #808080;">-</span><span style="color: #000000;">app xmlns</span><span style="color: #808080;">=</span><span style="color: #000000;">"http:</span><span style="color: #808080;">//</span><span style="color: #000000;">java.sun.com</span><span style="color: #808080;">/</span><span style="color: #000000;">xml</span><span style="color: #808080;">/</span><span style="color: #000000;">ns</span><span style="color: #808080;">/</span><span style="color: #000000;">j2ee"<br /> </span><span style="color: #008080;"> 3</span> <span style="color: #000000;">  xmlns:xsi</span><span style="color: #808080;">=</span><span style="color: #000000;">"http:</span><span style="color: #808080;">//</span><span style="color: #000000;">www.w3.org</span><span style="color: #808080;">/</span><span style="color: #800000; font-weight: bold;">2001</span><span style="color: #808080;">/</span><span style="color: #000000;">XMLSchema</span><span style="color: #808080;">-</span><span style="color: #000000;">instance"<br /> </span><span style="color: #008080;"> 4</span> <span style="color: #000000;">  xsi:schemaLocation</span><span style="color: #808080;">=</span><span style="color: #000000;">"http:</span><span style="color: #808080;">//</span><span style="color: #000000;">java.sun.com</span><span style="color: #808080;">/</span><span style="color: #000000;">xml</span><span style="color: #808080;">/</span><span style="color: #000000;">ns</span><span style="color: #808080;">/</span><span style="color: #000000;">j2ee<br /> </span><span style="color: #008080;"> 5</span> <span style="color: #000000;">    http:</span><span style="color: #808080;">//</span><span style="color: #000000;">java.sun.com</span><span style="color: #808080;">/</span><span style="color: #000000;">xml</span><span style="color: #808080;">/</span><span style="color: #000000;">ns</span><span style="color: #808080;">/</span><span style="color: #000000;">j2ee</span><span style="color: #808080;">/</span><span style="color: #000000;">web</span><span style="color: #808080;">-</span><span style="color: #000000;">app_2_4.xsd"<br /> </span><span style="color: #008080;"> 6</span> <span style="color: #000000;">  version</span><span style="color: #808080;">=</span><span style="color: #000000;">"</span><span style="color: #800000; font-weight: bold;">2.4</span><span style="color: #000000;">"</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 7</span> <span style="color: #000000;"> <br /> </span><span style="color: #008080;"> 8</span> <span style="color: #000000;">  </span><span style="color: #808080;"><</span><span style="color: #000000;">display</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;">example</span><span style="color: #808080;"></</span><span style="color: #000000;">display</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 9</span> <span style="color: #000000;"><br /> </span><strong><span style="color: #008080;">10</span></strong> <span style="color: #000000;">    </span><strong><span style="color: #808080;"><</span><span style="color: #000000;">context</span><span style="color: #808080;">-</span><span style="color: #000000;">param</span><span style="color: #808080;">></span><span style="color: #000000;">    <br /> </span><span style="color: #008080;">11</span> <span style="color: #000000;">        </span><span style="color: #808080;"><</span><span style="color: #000000;">param</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;">contextConfigLocation</span><span style="color: #808080;"></</span><span style="color: #000000;">param</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">12</span> <span style="color: #000000;">        </span><span style="color: #808080;"><</span><span style="color: #000000;">param</span><span style="color: #808080;">-</span><span style="color: #000000;">value</span><span style="color: #808080;">>/</span><span style="color: #000000;">WEB</span><span style="color: #808080;">-</span><span style="color: #000000;">INF<span style="color: #040000;"><span style="color: #040000;"><span style="color: #808080;">/classes/</span></span></span><span style="color: #040000;"><span style="color: #000000;">appl</span></span></span><span style="color: #000000;">icationContext.xml</span><span style="color: #808080;"></</span><span style="color: #000000;">param</span><span style="color: #808080;">-</span><span style="color: #000000;">value</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">13</span> <span style="color: #000000;">    </span><span style="color: #808080;"></</span><span style="color: #000000;">context</span><span style="color: #808080;">-</span><span style="color: #000000;">param</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">14</span> <span style="color: #000000;"><br /> </span><span style="color: #008080;">15</span> <span style="color: #000000;">    </span><span style="color: #808080;"><</span><span style="color: #000000;">listener</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">16</span> <span style="color: #000000;">      </span><span style="color: #808080;"><</span><span style="color: #000000;">listener</span><span style="color: #808080;">-</span><span style="color: #000000;">class</span><span style="color: #808080;">></span><span style="color: #000000;">org.springframework.web.context.ContextLoaderListener</span><span style="color: #808080;"></</span><span style="color: #000000;">listener</span><span style="color: #808080;">-</span><span style="color: #000000;">class</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">17</span> <span style="color: #000000;">    </span><span style="color: #808080;"></</span><span style="color: #000000;">listener</span><span style="color: #808080;">></span></strong><span style="color: #000000;"><br /> </span><span style="color: #008080;">18</span> <span style="color: #000000;"><br /> </span><span style="color: #008080;">19</span> <span style="color: #000000;">    </span><span style="color: #808080;"><</span><span style="color: #000000;">servlet</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">20</span> <span style="color: #000000;">        </span><span style="color: #808080;"><</span><span style="color: #000000;">display</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;">FacesServlet</span><span style="color: #808080;"></</span><span style="color: #000000;">display</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">21</span> <span style="color: #000000;">        </span><span style="color: #808080;"><</span><span style="color: #000000;">servlet</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;">FacesServlet</span><span style="color: #808080;"></</span><span style="color: #000000;">servlet</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">22</span> <span style="color: #000000;">        </span><span style="color: #808080;"><</span><span style="color: #000000;">servlet</span><span style="color: #808080;">-</span><span style="color: #000000;">class</span><span style="color: #808080;">></span><span style="color: #000000;">javax.faces.webapp.FacesServlet</span><span style="color: #808080;"></</span><span style="color: #000000;">servlet</span><span style="color: #808080;">-</span><span style="color: #000000;">class</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">23</span> <span style="color: #000000;">        </span><span style="color: #808080;"><</span><span style="color: #0000ff;">load</span><span style="color: #808080;">-</span><span style="color: #0000ff;">on</span><span style="color: #808080;">-</span><span style="color: #000000;">startup</span><span style="color: #808080;">></span><span style="color: #800000; font-weight: bold;">0</span><span style="color: #808080;"></</span><span style="color: #0000ff;">load</span><span style="color: #808080;">-</span><span style="color: #0000ff;">on</span><span style="color: #808080;">-</span><span style="color: #000000;">startup</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">24</span> <span style="color: #000000;">    </span><span style="color: #808080;"></</span><span style="color: #000000;">servlet</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">25</span> <span style="color: #000000;"><br /> </span><span style="color: #008080;">26</span> <span style="color: #000000;">    </span><span style="color: #808080;"><</span><span style="color: #000000;">servlet</span><span style="color: #808080;">-</span><span style="color: #000000;">mapping</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">27</span> <span style="color: #000000;">      </span><span style="color: #808080;"><</span><span style="color: #000000;">servlet</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;">FacesServlet</span><span style="color: #808080;"></</span><span style="color: #000000;">servlet</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">28</span> <span style="color: #000000;">      </span><span style="color: #808080;"><</span><span style="color: #000000;">url</span><span style="color: #808080;">-</span><span style="color: #000000;">pattern</span><span style="color: #808080;">></span><span style="color: #008080;">*.faces</span><span style="color: #008080;"></url-pattern><br /> </span><span style="color: #008080;">29</span> <span style="color: #008080;">    </servlet-mapping><br /> </span><span style="color: #008080;">30</span> <span style="color: #008080;">     <br /> </span><span style="color: #008080;">31</span> <span style="color: #008080;"></web-app></span></div> <br /> </li> <li><span style="color: red;">faces-config.xml<br /> </span> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #008080;"> 1</span> <span style="color: #808080;"><</span><span style="color: #000000;">?xml version</span><span style="color: #808080;">=</span><span style="color: #ff0000;">'</span><span style="color: #ff0000;">1.0</span><span style="color: #ff0000;">'</span><span style="color: #000000;"> encoding</span><span style="color: #808080;">=</span><span style="color: #ff0000;">'</span><span style="color: #ff0000;">UTF-8</span><span style="color: #ff0000;">'</span><span style="color: #000000;">?</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 2</span> <span style="color: #808080;"><</span><span style="color: #000000;">!DOCTYPE faces</span><span style="color: #808080;">-</span><span style="color: #000000;">config </span><span style="color: #0000ff;">PUBLIC</span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 3</span> <span style="color: #000000;">"</span><span style="color: #808080;">-//</span><span style="color: #000000;">Sun Microsystems, Inc.</span><span style="color: #808080;">//</span><span style="color: #000000;">DTD JavaServer Faces Config </span><span style="color: #800000; font-weight: bold;">1.1</span><span style="color: #808080;">//</span><span style="color: #000000;">EN"<br /> </span><span style="color: #008080;"> 4</span> <span style="color: #000000;">"http:</span><span style="color: #808080;">//</span><span style="color: #000000;">java.sun.com</span><span style="color: #808080;">/</span><span style="color: #000000;">dtd</span><span style="color: #808080;">/</span><span style="color: #000000;">web</span><span style="color: #808080;">-</span><span style="color: #000000;">facesconfig_1_1.dtd"</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 5</span> <span style="color: #808080;"><</span><span style="color: #000000;">faces</span><span style="color: #808080;">-</span><span style="color: #000000;">config</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><strong><span style="color: #008080;"> 6</span> <span style="color: #000000;">    </span><span style="color: #808080;"><</span><span style="color: #000000;">application</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 7</span> <span style="color: #000000;">        </span><span style="color: #808080;"><</span><span style="color: #000000;">variable</span><span style="color: #808080;">-</span><span style="color: #000000;">resolver</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 8</span> <span style="color: #000000;">            org.springframework.web.jsf.DelegatingVariableResolver<br /> </span><span style="color: #008080;"> 9</span> <span style="color: #000000;">        </span><span style="color: #808080;"></</span><span style="color: #000000;">variable</span><span style="color: #808080;">-</span><span style="color: #000000;">resolver</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">10</span> <span style="color: #000000;">    </span><span style="color: #808080;"></</span><span style="color: #000000;">application</span><span style="color: #808080;">></span></strong><span style="color: #808080;"><br /> </span><span style="color: #000000;"><br /> </span><span style="color: #008080;">12</span> <span style="color: #808080;"><</span><span style="color: #000000;">managed</span><span style="color: #808080;">-</span><span style="color: #000000;">bean</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">13</span> <span style="color: #000000;">  </span><span style="color: #808080;"><</span><span style="color: #000000;">managed</span><span style="color: #808080;">-</span><span style="color: #000000;">bean</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;">infoBean</span><span style="color: #808080;"></</span><span style="color: #000000;">managed</span><span style="color: #808080;">-</span><span style="color: #000000;">bean</span><span style="color: #808080;">-</span><span style="color: #000000;">name</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">14</span> <span style="color: #000000;">  </span><span style="color: #808080;"><</span><span style="color: #000000;">managed</span><span style="color: #808080;">-</span><span style="color: #000000;">bean</span><span style="color: #808080;">-</span><span style="color: #000000;">class</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">15</span> <span style="color: #000000;">      com.jam.managedbeans.InfoBean<br /> </span><span style="color: #008080;">16</span> <span style="color: #000000;">  </span><span style="color: #808080;"></</span><span style="color: #000000;">managed</span><span style="color: #808080;">-</span><span style="color: #000000;">bean</span><span style="color: #808080;">-</span><span style="color: #000000;">class</span><span style="color: #808080;">></span><span style="color: #000000;"> <br /> </span><span style="color: #008080;">17</span> <span style="color: #000000;">  </span><span style="color: #808080;"><</span><span style="color: #000000;">managed</span><span style="color: #808080;">-</span><span style="color: #000000;">bean</span><span style="color: #808080;">-</span><span style="color: #000000;">scope</span><span style="color: #808080;">></span><span style="color: #000000;">request</span><span style="color: #808080;"></</span><span style="color: #000000;">managed</span><span style="color: #808080;">-</span><span style="color: #000000;">bean</span><span style="color: #808080;">-</span><span style="color: #000000;">scope</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">18</span> <span style="color: #808080;"></</span><span style="color: #000000;">managed</span><span style="color: #808080;">-</span><span style="color: #000000;">bean</span><span style="color: #808080;">></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">19</span> <span style="color: #000000;"><br /> </span><span style="color: #008080;">20</span> <span style="color: #808080;"></</span><span style="color: #000000;">faces</span><span style="color: #808080;">-</span><span style="color: #000000;">config</span><span style="color: #808080;">></span></div> <br /> <br /> </li> <li> <span style="color: #000000;"><span style="color: red;">InfoBean.java</span></span><br /> <span>鍋囧</span><u><span style="color: #000000;"><span style="color: red;">InfoBean</span></span></u><span>涓渶瑕佷嬌鐢ㄤ笟鍔$被<u><span style="color: red;">UserService</span></u>鐨勬柟娉曪紝鑰?/span><span><u><span style="color: red;">UserService</span></u>浜ょ敱Spring綆$悊(<strong><span style="color: #2c8e1f;">id="userService"</span></strong>)錛?/span><u><span style="color: #000000;"><span style="color: red;">InfoBean</span></span></u><span>鍙互榪欐牱鍐欙細<br /> </span> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000ff;">package</span><span style="color: #000000;"> </span><span style="color: #000000;">com.jam.managedbeans</span><span style="color: #000000;">;<br /> <br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.util.Map;<br /> <br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> javax.faces.context.ExternalContext;<br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> javax.faces.context.FacesContext;<br /> <br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> org.springframework.context.ApplicationContext;<br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> org.springframework.web.jsf.FacesContextUtils;<br /> <br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> com.jam.hibeinate.po.Bloguser;<br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> com.jam.service.UserService;<br /> <br /> </span><span style="color: #008000;">/**</span><span style="color: #008000;"><br />  * </span><span style="color: #808080;">@author</span><span style="color: #008000;"> Jam Chan<br />  * <br />  </span><span style="color: #008000;">*/</span><span style="color: #000000;"><br /> </span><span style="color: #0000ff;">public</span><span style="color: #000000;"> </span><span style="color: #0000ff;">final</span><span style="color: #000000;"> </span><span style="color: #0000ff;">class</span><span style="color: #000000;"> </span><span style="color: #000000;">InfoBean</span><span style="color: #000000;"> </span><span style="color: #0000ff;">extends</span><span style="color: #000000;"> Object {<br /> <br />     </span><span style="color: #008000;">/**</span><span style="color: #008000;"><br />      * 鐢ㄦ埛鍚?br />      </span><span style="color: #008000;">*/</span><span style="color: #000000;"><br />     </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> String userName;</span><span style="color: #000000;"><br />     </span><span style="color: #008000;">/**</span><span style="color: #008000;"><br />      * 涓氬姟綾?br />      </span><span style="color: #008000;">*/</span><span style="color: #000000;"><br />     </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> UserService userService;<br />     </span><span style="color: #008000;">/**</span><span style="color: #008000;"><br />      * 瀵嗙爜<br />      </span><span style="color: #008000;">*/</span><span style="color: #000000;"><br />     </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> String password;<br /> <br />     </span><span style="color: #008000;">/**</span><span style="color: #008000;"><br />      * 鐧婚檰楠岃瘉<br />      * <br />      * </span><span style="color: #808080;">@return</span><span style="color: #008000;"><br />      </span><span style="color: #008000;">*/</span><span style="color: #000000;"><br />     </span><span style="color: #0000ff;">public</span><span style="color: #000000;"> String loginValidate() {<br />         FacesContext facesContext </span><span style="color: #000000;">=</span><span style="color: #000000;"> FacesContext.getCurrentInstance();<br />         ExternalContext extnContext </span><span style="color: #000000;">=</span><span style="color: #000000;"> facesContext.getExternalContext();<br />         <span style="color: #2c8e1f;">// POJO綾?/span><br />         Bloguser objUser </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">new</span><span style="color: #000000;"> Bloguser();<br />         objUser.setUsername(getUserName());<br />         objUser.setPassword(getPassword1());<br />         </span><span style="color: #008000;">//</span><span style="color: #008000;"> 浠嶴pring涓幏鍙栭渶瑕佺殑涓氬姟綾籙serService錛屾垜灝辨槸鍦ㄨ繖閲岃鍗′綇錛岀粓浜嶰K浜?/span><span style="color: #000000;"><br />         <strong><span style="color: #b63e98;"><span style="color: #000000;"><strong><span style="color: #b63e98;"><span style="color: #000000;"><strong>ApplicationContext appContext </strong></span><strong><span style="color: #000000;">=</span><span style="color: #000000;"> FacesContextUtils.getWebApplicationContext(facesContext);<br />         userService </span><span style="color: #000000;">=</span><span style="color: #000000;"> (UserService) appContext.getBean(</span><span style="color: #000000;">"</span><span style="color: #000000;">userService</span><span style="color: #000000;">"</span></strong><span style="color: #000000;"><strong>);</strong></span></span></strong></span></span></strong></span><span style="color: #000000;"><br />         </span><span style="color: #008000;">//</span><span style="color: #008000;"> 楠岃瘉鐢ㄦ埛</span><span style="color: #008000;"><br /> </span><span style="color: #000000;">        </span><span style="color: #0000ff;">boolean</span><span style="color: #000000;"> result </span><span style="color: #000000;">=</span><span style="color: #000000;"> userService.loginValidate(objUser);<br />         </span><span style="color: #008000;">//</span><span style="color: #008000;"> 鑾峰彇SessionMap</span><span style="color: #008000;"><br /> </span><span style="color: #000000;">        Map sessionMap </span><span style="color: #000000;">=</span><span style="color: #000000;"> extnContext.getSessionMap();<br />         </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (result) { </span><span style="color: #008000;">//</span><span style="color: #008000;"> 鐧婚檰鎴愬姛</span><span style="color: #008000;"><br /> </span><span style="color: #000000;">            </span><span style="color: #008000;">/*</span><span style="color: #008000;"> 鎶婄敤鎴峰悕璁劇疆鍦⊿ession涓?nbsp;</span><span style="color: #008000;">*/</span><span style="color: #000000;"><br />             sessionMap.put(</span><span style="color: #000000;">"</span><span style="color: #000000;">userName</span><span style="color: #000000;">"</span><span style="color: #000000;">, getUserName());<br />             </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> </span><span style="color: #000000;">"</span><span style="color: #000000;">success</span><span style="color: #000000;">"</span><span style="color: #000000;">;<br />         } </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> { </span><span style="color: #008000;">//</span><span style="color: #008000;"> 鐧誨綍澶辮觸</span><span style="color: #008000;"><br /> </span><span style="color: #000000;">            </span><span style="color: #008000;">/*</span><span style="color: #008000;"> 娓呯┖session </span><span style="color: #008000;">*/</span><span style="color: #000000;"><br />             </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (sessionMap.containsKey(</span><span style="color: #000000;">"</span><span style="color: #000000;">userName</span><span style="color: #000000;">"</span><span style="color: #000000;">)) {<br />                 sessionMap.remove(</span><span style="color: #000000;">"</span><span style="color: #000000;">userName</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br />             }<br />             </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> </span><span style="color: #000000;">"</span><span style="color: #000000;">failed</span><span style="color: #000000;">"</span><span style="color: #000000;">;<br />         }<br />     }<br />     <span style="color: #2c8e1f;">// setter getter鐪佺暐</span><br /> </span></div> 鏆傛椂鍐欏埌榪欙紝鍙兘榪樿鏌ユ紡琛ョ己錛屽彂鐜伴棶棰樼戶緇姞涓婏紒<br /> </li> </ol> <br /> <br /> <img src ="http://m.tkk7.com/botson/aggbug/187557.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/botson/" target="_blank">Jam Chan</a> 2008-03-20 20:44 <a href="http://m.tkk7.com/botson/archive/2008/03/20/187557.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鎵句笉鍒板熀鏈璞℃睜錛氣渏ava.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool鈥濊В鍐蟲柟娉?/title><link>http://m.tkk7.com/botson/archive/2008/03/19/187311.html</link><dc:creator>Jam Chan</dc:creator><author>Jam Chan</author><pubDate>Wed, 19 Mar 2008 09:34:00 GMT</pubDate><guid>http://m.tkk7.com/botson/archive/2008/03/19/187311.html</guid><wfw:comment>http://m.tkk7.com/botson/comments/187311.html</wfw:comment><comments>http://m.tkk7.com/botson/archive/2008/03/19/187311.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/botson/comments/commentRss/187311.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/botson/services/trackbacks/187311.html</trackback:ping><description><![CDATA[<strong>闂錛?/strong> <br /> <span style="color: red;"><br /> org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DataSource' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: <u><strong>org/apache/commons/pool/impl/GenericObjectPool</strong></u><br /> Caused by: <br /> java.lang.NoClassDefFoundError: <u><strong>org/apache/commons/pool/impl/GenericObjectPool</strong></u><br />     at java.lang.Class.getDeclaredConstructors0(Native Method)<br />     at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)<br />     at java.lang.Class.getConstructor0(Class.java:2640)<br />     at java.lang.Class.getDeclaredConstructor(Class.java:1953)<br />     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54)<br />     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:752)<br />     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:717)<br />     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386)<br />     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)<br />     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)<br />     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)<br />     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)<br />     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)<br />     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)<br />     at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicationContext(ContextLoaderPlugIn.java:354)<br />     at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplicationContext(ContextLoaderPlugIn.java:295)<br />     at org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:225)<br />     at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)<br />     at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)<br />     at javax.servlet.GenericServlet.init(GenericServlet.java:212)<br />     at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)<br />     at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)<br />     at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)<br />     at org.apache.catalina.core.StandardContext.start(StandardContext.java:4364)<br />     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)<br />     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)<br />     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)<br />     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924)<br />     at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)<br />     at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)<br />     at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)<br />     at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)<br />     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)<br />     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)<br />     at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)<br />     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)<br />     at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)<br />     at org.apache.catalina.core.StandardService.start(StandardService.java:516)<br />     at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)<br />     at org.apache.catalina.startup.Catalina.start(Catalina.java:578)<br />     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />     at java.lang.reflect.Method.invoke(Method.java:585)<br />     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)<br />     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)</span><br /> <br /> <strong>鍘熷洜錛?br /> </strong>鎵句笉鍒?Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool<br /> 灝盇pache鎵鎻愪緵鐨勫熀鏈璞℃睜銆?br /> <br /> <strong>瑙e喅錛?br /> </strong>鍒拌繖閲?a dragover="true" >http://commons.apache.org/downloads/download_pool.cgi</a>涓嬭澆鍖咃紝鐒跺悗,鎶婇噷闈㈢殑commons-pool-x.jar澶嶅埗鍒癿yEclipse鐨凴eferenced Libraries涓? <img src ="http://m.tkk7.com/botson/aggbug/187311.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/botson/" target="_blank">Jam Chan</a> 2008-03-19 17:34 <a href="http://m.tkk7.com/botson/archive/2008/03/19/187311.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>myeclipse6.0 ssh宸ョ▼姝ラhttp://m.tkk7.com/botson/archive/2008/03/19/187268.htmlJam ChanJam ChanWed, 19 Mar 2008 07:47:00 GMThttp://m.tkk7.com/botson/archive/2008/03/19/187268.htmlhttp://m.tkk7.com/botson/comments/187268.htmlhttp://m.tkk7.com/botson/archive/2008/03/19/187268.html#Feedback0http://m.tkk7.com/botson/comments/commentRss/187268.htmlhttp://m.tkk7.com/botson/services/trackbacks/187268.html鍘熸枃錛歨ttp://user.qzone.qq.com/17882384/blog/1205207879 1銆佸姞鍏truts1.2鐨勬敮鎸?br /> 2銆佸姞鍏pring2.0鐨勬敮鎸?br /> 鍔犲叆鐨勫寘鏈夛細
            Spring2.0 AOP Libraries(瀵筧op鐨勬敮鎸?
            Spring2.0 Core Libraries
            Spring2.0 Persistence Core Libraries
            Spring2.0 Persistence JDBC Libraries(JDBC鏀寔)
            Spring2.0 Testing Suppor Libraries
            Spring2.0 Web Libraries
            Hibernate3.2 Core Libraries
            Hibernate3.2 Annotations & Entity Manager
            Hibernate3.2 Advanced Support Libraries
3銆佸姞鍏ibernate 閫夋嫨myEclipse Libraries 浣嗘槸涓嶉夋嫨浠誨姟鍖?br /> 4銆侀厤緗畇truts-config.xml鏂囦歡
<!-- 鎺у埗鍣?-->
    <controller  processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />
    <!-- struts,spring闆嗘垚鎻掍歡 -->
    <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
        <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
    </plug-in>

5銆佸姞鍏ュ寘commons-pool.jar spring.jar
6銆佸垹闄ゅ寘asm-2.2.3.jar hibernate-annotaions.jar


Jam Chan 2008-03-19 15:47 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲美女在线国产| 免费va在线观看| 亚洲美女一区二区三区| 男女午夜24式免费视频| 国产亚洲一区二区在线观看| 一个人看的www免费在线视频| 亚洲阿v天堂在线2017免费| 一级做a免费视频观看网站| 精品国产亚洲男女在线线电影 | 久久不见久久见中文字幕免费 | 成人免费无码大片a毛片软件| 亚洲一区二区三区高清不卡 | 99久久精品毛片免费播放| 中文字幕亚洲图片| 国产日韩一区二区三免费高清| 亚洲处破女AV日韩精品| 97免费人妻在线视频| 中文无码亚洲精品字幕| 在线观看亚洲免费视频| 一级黄色免费毛片| 亚洲AV日韩AV高潮无码专区| 成人福利免费视频| 久久精品国产亚洲AV电影网| 亚洲一区二区精品视频| 久久青草91免费观看| 亚洲深深色噜噜狠狠网站| 免费一级毛片在线观看| 精品国产一区二区三区免费| 亚洲中文字幕无码av在线| 日本v片免费一区二区三区| 大妹子影视剧在线观看全集免费| 亚洲三级电影网址| 成人午夜视频免费| WWW免费视频在线观看播放| 亚洲国产成人超福利久久精品| 国产精品二区三区免费播放心| 免费无码av片在线观看| 亚洲一区二区三区亚瑟| 久久亚洲国产精品五月天婷| 妻子5免费完整高清电视| 精品在线观看免费|