KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dlog4j > tags > DraftsTag


1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Library General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  */

16 package dlog4j.tags;
17
18 import java.sql.SQLException JavaDoc;
19 import java.util.List JavaDoc;
20
21 import javax.servlet.jsp.JspException JavaDoc;
22
23 import net.sf.hibernate.HibernateException;
24 import net.sf.hibernate.Session;
25 import dlog4j.LogManager;
26 import dlog4j.SiteManager;
27 import dlog4j.formbean.SiteForm;
28 import dlog4j.formbean.UserForm;
29
30 /**
31  * 用于读出所有的草稿信息的标签库
32  * @author Liudong
33  */

34 public class DraftsTag extends DlogBaseTag {
35     
36     public int doStartTag() throws JspException JavaDoc {
37         Session session = null;
38         List JavaDoc drafts = null;
39         try{
40             session = getSession();
41             SiteForm site = SiteManager.getCurrentSite(pageContext.getRequest());
42             UserForm user = getLoginUser();
43             drafts = LogManager.listDrafts(session,site,user);
44             pageContext.setAttribute(id,drafts);
45         }catch(SQLException JavaDoc e){
46             throw new JspException JavaDoc(e);
47         }catch(HibernateException e){
48             throw new JspException JavaDoc(e);
49         }finally{
50             try{
51                 closeSession(session);
52             }catch(Exception JavaDoc e){}
53         }
54         return SKIP_BODY;
55     }
56 }
57
Popular Tags