org.apache.struts.taglib.html
Class BaseTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.apache.struts.taglib.html.BaseTag
All Implemented Interfaces:
Serializable, IterationTag, Tag

public class BaseTag
extends TagSupport

Renders an HTML element with an href attribute pointing to the absolute location of the enclosing JSP page. This tag is only valid when nested inside a head tag body. The presence of this tag allows the browser to resolve relative URL's to images, CSS stylesheets and other resources in a manner independent of the URL used to call the ActionServlet.

Version:
$Rev: 471754 $ $Date: 2005-09-20 02:29:01 -0400 (Tue, 20 Sep 2005) $
See Also:
Serialized Form

Field Summary
protected static org.apache.struts.util.MessageResources messages
          The message resources for this package.
protected  String ref
          The reference to which the base will created.
protected  String REF_PAGE
           
protected  String REF_SITE
           
protected  String server
          The server name to use instead of request.getServerName().
protected  String target
          The target window for this base reference.
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
BaseTag()
           
 
Method Summary
 int doStartTag()
          Process the start of this tag.
 String getRef()
          Gets the reference to which the base will be created
 String getServer()
          Returns the server.
 String getTarget()
           
protected  String renderBaseElement(String scheme, String serverName, int port, String uri)
          Render a fully formed HTML <base> element and return it as a String.
 void setRef(String ref)
          Sets the reference to which the base will be created.
 void setServer(String server)
          Sets the server.
 void setTarget(String target)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messages

protected static org.apache.struts.util.MessageResources messages
The message resources for this package.


REF_SITE

protected final String REF_SITE
See Also:
Constant Field Values

REF_PAGE

protected final String REF_PAGE
See Also:
Constant Field Values

server

protected String server
The server name to use instead of request.getServerName().


target

protected String target
The target window for this base reference.


ref

protected String ref
The reference to which the base will created.

Constructor Detail

BaseTag

public BaseTag()
Method Detail

getRef

public String getRef()
Gets the reference to which the base will be created


setRef

public void setRef(String ref)
Sets the reference to which the base will be created.

Parameters:
ref - Either "page" to render the base as the jsp path located, or "site" as the application's context

getTarget

public String getTarget()

setTarget

public void setTarget(String target)

doStartTag

public int doStartTag()
               throws JspException
Process the start of this tag.

Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Throws:
JspException - if a JSP exception has occurred

renderBaseElement

protected String renderBaseElement(String scheme,
                                   String serverName,
                                   int port,
                                   String uri)
Render a fully formed HTML <base> element and return it as a String.

Parameters:
scheme - The scheme used in the url (ie. http or https).
serverName -
port -
uri - The portion of the url from the protocol name up to the query string.
Returns:
String An HTML <base> element.
Since:
Struts 1.1

getServer

public String getServer()
Returns the server.

Returns:
String

setServer

public void setServer(String server)
Sets the server.

Parameters:
server - The server to set


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.