1 25 26 package org.nextime.ion.frontoffice.taglib; 27 28 import javax.servlet.http.HttpServletRequest ; 29 import javax.servlet.http.HttpServletResponse ; 30 import javax.servlet.jsp.*; 31 import javax.servlet.jsp.tagext.BodyTagSupport ; 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 { 37 38 private Hashtable _params; 39 private String _type; 40 41 43 public void addParameter(String name, String value) { 44 _params.put(name, value); 45 } 46 47 49 public void setType(String type) { 50 _type = type; 51 } 52 53 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 os = Class.forName(_type).newInstance(); 76 return ((ObjectSelector) os).selectObjects( 77 _params, 78 (HttpServletRequest ) pageContext.getRequest(), 79 (HttpServletResponse ) pageContext.getResponse()); 80 } catch (Exception e) { 81 throw new JspException( 82 "Impossible d'invoquer le ObjectSelector : " + e.getMessage()); 83 } 84 } 85 } 86 | Popular Tags |