KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > frontoffice > taglib > SelectObjectsTag


1 /*
2  * ¤ON content management system.
3  * Copyright (C) 2002 Guillaume Bort(gbort@msn.com). All rights reserved.
4  *
5  * Copyright (c) 2000 The Apache Software Foundation. All rights reserved.
6  * Copyright 2000-2002 (C) Intalio Inc. All Rights Reserved.
7  *
8  * ¤ON is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * ¤ON core framework, ¤ON content server, ¤ON backoffice, ¤ON frontoffice
14  * and ¤ON admin application are parts of ¤ON and are distributed under
15  * same terms of licence.
16  *
17  * ¤ON includes software developed by the Apache Software Foundation (http://www.apache.org/)
18  * and software developed by the Exolab Project (http://www.exolab.org).
19  *
20  * ¤ON is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  */

25
26 package org.nextime.ion.frontoffice.taglib;
27
28 import javax.servlet.http.HttpServletRequest JavaDoc;
29 import javax.servlet.http.HttpServletResponse JavaDoc;
30 import javax.servlet.jsp.*;
31 import javax.servlet.jsp.tagext.BodyTagSupport JavaDoc;
32 import org.apache.taglibs.standard.tag.common.core.*;
33 import java.util.*;
34 import org.nextime.ion.frontoffice.objectSelector.*;
35
36 public class SelectObjectsTag extends BodyTagSupport JavaDoc {
37
38     private Hashtable _params;
39     private String JavaDoc _type;
40
41     // methodes hÚritÚes de ParentParam
42

43     public void addParameter(String JavaDoc name, String JavaDoc value) {
44         _params.put(name, value);
45     }
46
47     // accesseurs de propriÚtÚs
48

49     public void setType(String JavaDoc type) {
50         _type = type;
51     }
52
53     // methodes hÚritÚes de BodyTagSupport
54

55     public int doStartTag() throws JspException {
56         _params = new Hashtable();
57         return (EVAL_BODY_INCLUDE);
58     }
59
60     public int doEndTag() throws JspException {
61         return (EVAL_PAGE);
62     }
63
64     public void release() {
65         super.release();
66         init();
67     }
68
69     private void init() {
70         _params = new Hashtable();
71     }
72
73     public Collection getCollection() throws JspException {
74         try {
75             Object JavaDoc os = Class.forName(_type).newInstance();
76             return ((ObjectSelector) os).selectObjects(
77                 _params,
78                 (HttpServletRequest JavaDoc) pageContext.getRequest(),
79                 (HttpServletResponse JavaDoc) pageContext.getResponse());
80         } catch (Exception JavaDoc e) {
81             throw new JspException(
82                 "Impossible d'invoquer le ObjectSelector : " + e.getMessage());
83         }
84     }
85 }
86
Popular Tags