[Ejtools-cvs] libraries/taglib/src/main/net/sourceforge/ejtools/servlet/http/jsp/tagext HiddenObject
Brought to you by:
letiemble
From: <let...@us...> - 2002-06-04 17:27:01
|
Update of /cvsroot/ejtools/libraries/taglib/src/main/net/sourceforge/ejtools/servlet/http/jsp/tagext In directory usw-pr-cvs1:/tmp/cvs-serv9416/taglib/src/main/net/sourceforge/ejtools/servlet/http/jsp/tagext Added Files: HiddenObjectTag.java Log Message: Add tag --- NEW FILE: HiddenObjectTag.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.servlet.http.jsp.tagext; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.TagSupport; import org.apache.struts.util.RequestUtils; import org.apache.struts.util.ResponseUtils; /** * Description of the Class * * @author letiemble * @created 25 avril 2002 * @version $Revision: 1.5 $ * @todo Javadoc to complete */ public class HiddenObjectTag extends TagSupport { /** Description of the Field */ protected String id = null; /** Description of the Field */ protected String name = null; /** Description of the Field */ protected String property = null; /** Description of the Field */ protected String scope = null; /** * Description of the Method * * @return Description of the Returned Value * @exception JspException Description of Exception */ public int doStartTag() throws JspException { Object object = null; // Look up the requested bean (if necessary) if (property != null) { object = RequestUtils.lookup(pageContext, name, property, scope); } else { object = RequestUtils.lookup(pageContext, name, scope); } if (object == null) { throw new JspException("Unable to find bean " + name + " or its property " + property); } String output = "<input type=\"hidden\" name=\"" + id + "\" value=\"" + ResponseUtils.filter(object.toString()) + "\">"; ResponseUtils.write(pageContext, output); // Continue processing this page return (SKIP_BODY); } /** * Gets the id attribute of the HiddenObjectTag object * * @return The id value */ public String getId() { return (this.id); } /** * Getter for the name attribute * * @return The value of name attribute */ public String getName() { return (this.name); } /** * Gets the property attribute of the HiddenObjectTag object * * @return The property value */ public String getProperty() { return (this.property); } /** * Getter for the scope attribute * * @return The value of scope attribute */ public String getScope() { return (this.scope); } /** Release all allocated resources. */ public void release() { super.release(); id = null; name = null; property = null; scope = null; } /** * Sets the id attribute of the HiddenObjectTag object * * @param id The new id value */ public void setId(String id) { this.id = id; } /** * Setter for the name attribute * * @param name The new value for name attribute */ public void setName(String name) { this.name = name; } /** * Sets the property attribute of the HiddenObjectTag object * * @param property The new property value */ public void setProperty(String property) { this.property = property; } /** * Setter for the scope attribute * * @param scope The new value for scope attribute */ public void setScope(String scope) { this.scope = scope; } } |