org.alphadisplaytag.util
Class Href

java.lang.Object
  extended byorg.alphadisplaytag.util.Href

public class Href
extends java.lang.Object

Object representing an URI (the href parameter of an <a> tag). Provides methods to insert new parameters. It doesn't support multiple parameter values

Version:
$Revision: 1.14 $ ($Author: fgiust $)
Author:
fgiust

Constructor Summary
Href(Href href)
          Constructor for Href.
Href(java.lang.String baseUrl)
          Construct a new Href parsing a URL.
 
Method Summary
 void addParameter(java.lang.String name, int value)
          Adds an int parameter to the href.
 void addParameter(java.lang.String name, java.lang.Object value)
          Adds a parameter to the href.
 void addParameterMap(java.util.Map parametersMap)
          Adds all the parameters contained in the map to the Href.
 java.lang.String getAnchor()
          Returns the URI anchor.
 java.lang.String getBaseUrl()
          Getter for the base url (without parameters).
 java.util.Map getParameterMap()
          Getter for the map containing link parameters.
 void setAnchor(java.lang.String name)
          Setter for the URI anchor.
 void setParameterMap(java.util.Map parametersMap)
          Adds all the parameters contained in the map to the Href.
 java.lang.String toString()
          toString: output the full url with parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Href

public Href(java.lang.String baseUrl)
Construct a new Href parsing a URL. Parameters are stripped from the base url and saved in the parameters map.

Parameters:
baseUrl - String

Href

public Href(Href href)
Constructor for Href.

Parameters:
href - Href
Method Detail

addParameter

public void addParameter(java.lang.String name,
                         java.lang.Object value)
Adds a parameter to the href.

Parameters:
name - String
value - Object

addParameter

public void addParameter(java.lang.String name,
                         int value)
Adds an int parameter to the href.

Parameters:
name - String
value - int

getParameterMap

public java.util.Map getParameterMap()
Getter for the map containing link parameters. The returned map is always a copy and not the original instance.

Returns:
parameter Map (copy)

setParameterMap

public void setParameterMap(java.util.Map parametersMap)
Adds all the parameters contained in the map to the Href. The value in the given Map will be escaped before added. Any parameter already present in the href object is removed.

Parameters:
parametersMap - Map containing parameters

addParameterMap

public void addParameterMap(java.util.Map parametersMap)
Adds all the parameters contained in the map to the Href. The value in the given Map will be escaped before added. Parameters in the original href are kept and not overridden.

Parameters:
parametersMap - Map containing parameters

getBaseUrl

public java.lang.String getBaseUrl()
Getter for the base url (without parameters).

Returns:
String

getAnchor

public java.lang.String getAnchor()
Returns the URI anchor.

Returns:
anchor or null if no anchor has been set.

setAnchor

public void setAnchor(java.lang.String name)
Setter for the URI anchor.

Parameters:
name - string to be used as anchor name (without #).

toString

public java.lang.String toString()
toString: output the full url with parameters.

Returns:
String


Alphabetical Navigation Bar Java Display Tag Home Page. 

My Home Page. Contact me at: chauvetp@hotmail.com.
I am alway looking for Java/J2EE work and would appreciate the business. Some of my design is inspired by the original display tag <display:*> code. Please go to http://displaytag.sourceforge.net/ for details on the <display:*> tag.

Copyright © 2004 Aiki Innovations Inc. Permission is granted to reuse and distribute for commercial or personal use if no extensive monetary gain is received. Java and the Java Standard Tag Library are programming languages owed by Sun Microsystems, Inc: http://java.sun.com/products/jsp/jstl/