Update of /cvsroot/ejtools/applications/jmx.browser/src/main/net/sourceforge/ejtools/jmxbrowser/web/taglib
In directory usw-pr-cvs1:/tmp/cvs-serv31361
Added Files:
ConnectTag.java
Log Message:
Initial Import
--- NEW FILE: ConnectTag.java ---
package net.sourceforge.ejtools.jmxbrowser.web.taglib;
import java.io.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import net.sourceforge.ejtools.jmxbrowser.web.*;
/**
* Description of the Class
*
* @author letiembl
* @created 1 mars 2002
*/
public class ConnectTag extends TagSupport
{
/** The key of the session-scope bean we look for. */
private String name = Constants.TREE;
/** The page to which we should forward for the user to log on. */
private String page = "/connect.do";
/**
* Setter for the name attribute
*
* @param name The new value for name attribute
*/
public void setName(String name)
{
this.name = name;
}
/**
* Setter for the page attribute
*
* @param page The new value for page attribute
*/
public void setPage(String page)
{
this.page = page;
}
/**
* Getter for the name attribute
*
* @return The value of name attribute
*/
public String getName()
{
return (this.name);
}
/**
* Getter for the page attribute
*
* @return The value of page attribute
*/
public String getPage()
{
return (this.page);
}
/**
* Description of the Method
*
* @return Description of the Returned Value
* @exception JspException Description of Exception
*/
public int doStartTag() throws JspException
{
return (SKIP_BODY);
}
/**
* Description of the Method
*
* @return Description of the Returned Value
* @exception JspException Description of Exception
*/
public int doEndTag() throws JspException
{
boolean valid = false;
HttpSession session = pageContext.getSession();
System.out.println("ConnectTag session "+session.getId());
if ((session != null) && (session.getAttribute(name) != null))
valid = true;
// Forward control based on the results
if (valid)
return (EVAL_PAGE);
else
{
try
{
pageContext.forward(page);
}
catch (Exception e)
{
throw new JspException(e.toString());
}
return (SKIP_PAGE);
}
}
/** Description of the Method */
public void release()
{
super.release();
this.name = Constants.TREE;
this.page = "/connect.do";
}
}
|