|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
com.taggercat.tags.HTMLListMenuOptionsListTag
public class HTMLListMenuOptionsListTag
This tag creates HTML select options that are sourced from a List or a Map of objects. Although it can be used with any object type, it will probably be mostly commonly used with Entities and FKs on Entities.
Even though this tag is very similar to the ListOptionListTag, it is different in that it allows you to
set object references, and not deal exclusively with string values.
The intended use of this tag is similar to the functionality of Code Tables, where you need to set a foreign key, or other object reference, on an entity using a Menu List element. But, unlike code tables, the source of FK entities, or other objects, can come from an arbitrary List or Map.
Items in the List or Map must implement the OptionItem interface.
Presenting the list as HTML option tags is only half the story though. Upon a submit, we usually need to set the corresponding selected item from the Collection or Map on the parent entity.
To accomplish that, this tag also gets its parent HTMLListMenu tag to
generate an extra hidden form element.
That hidden form element submits the
TC EL Expression where the source options can be found; such as: session.cutomerAddressOptions.
Of course, the source of the Map or Collection must also be available, and resolve to the same collection upon the submit.
Therefore, the listOptions and the sourceValuesExpr attributes will commonly be nearly the same.
The difference being that listOptions attribute would be an JSP EL that is evaluated at page response time, and
sourceValuesExpr attribute would be the same literal expression; but without the $[....} delimiters.
OptionItem,
ColorCodedOptionItem,
ListOptionListTag,
DataSourceOptionListTag,
Serialized Form
![]() |
![]() |
| Field Summary |
|---|
| 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 | |
|---|---|
HTMLListMenuOptionsListTag()
|
|
| Method Summary | |
|---|---|
int |
doEndTag()
Resets the tags internal state. |
int |
doStartTag()
Creates and the option list tags and sends them to the page. |
java.lang.String |
getDsn()
Gets the sources data source name. |
java.lang.String |
getField()
|
java.util.Collection<OptionItem> |
getListOptions()
|
java.util.Map<java.lang.String,OptionItem> |
getMapOptions()
|
java.lang.String |
getMissingItemStyleclass()
|
java.lang.Object |
getSelected()
Gets the selected item. |
java.lang.String |
getSelectedStyleclass()
Gets the CSS style class to be used to selected items in the option list. |
java.lang.String |
getSourceVar()
|
java.lang.String |
getStyleclass()
Gets the CSS style class to be used to items in the option list. |
boolean |
isAddEmptyItem()
|
void |
setAddEmptyItem(boolean addEmptyItem)
|
void |
setDsn(java.lang.String dsn)
Set the name of the data source this field to test as a boolean ( optional ). |
void |
setEmptyItem(boolean emptyItem)
Set to true to add an empty item to the option list. |
void |
setField(java.lang.String field)
Sets the field name attribute ( optional ). |
void |
setListOptions(java.util.Collection<OptionItem> listOptions)
|
void |
setMapOptions(java.util.Map<java.lang.String,OptionItem> mapOptions)
|
void |
setMissingItemStyleclass(java.lang.String missingItemStyleclass)
Sets the CSS style class to be used to display a missing, and selected items in the option list. |
void |
setSelected(java.lang.Object selected)
|
void |
setSelected(java.lang.String selected)
Sets the selected attribute. |
void |
setSelectedStyleclass(java.lang.String selectedStyleclass)
Sets the CSS style class to be used to selected items in the option list. |
void |
setSourceVar(java.lang.String sourceVar)
|
void |
setStyleclass(java.lang.String styleclass)
Sets the CSS style class to be used to items in the option list. |
| Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
|---|
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HTMLListMenuOptionsListTag()
| Method Detail |
|---|
public int doEndTag()
throws javax.servlet.jsp.JspException
doEndTag in interface javax.servlet.jsp.tagext.TagdoEndTag in class javax.servlet.jsp.tagext.TagSupportjavax.servlet.jsp.JspException
public int doStartTag()
throws javax.servlet.jsp.JspException
doStartTag in interface javax.servlet.jsp.tagext.TagdoStartTag in class javax.servlet.jsp.tagext.TagSupportjavax.servlet.jsp.JspException
public java.lang.String getDsn()
public java.lang.Object getSelected()
public java.lang.String getSelectedStyleclass()
public java.lang.String getStyleclass()
public void setEmptyItem(boolean emptyItem)
emptyItem - The new codeField valuepublic void setDsn(java.lang.String dsn)
dsn - the new dsn fieldValuepublic void setField(java.lang.String field)
field - the new field fieldValuepublic void setSelected(java.lang.String selected)
selected - The new selected valuepublic void setSelectedStyleclass(java.lang.String selectedStyleclass)
selectedStyleclass - the CSS style class to be used to selected items in the option
list.public void setStyleclass(java.lang.String styleclass)
styleclass - the CSS style class to be used to items in the option listpublic void setMissingItemStyleclass(java.lang.String missingItemStyleclass)
missingItemStyleclass - the CSS style class to be used to missing items in the option
list.public java.lang.String getSourceVar()
public void setSourceVar(java.lang.String sourceVar)
public boolean isAddEmptyItem()
public void setAddEmptyItem(boolean addEmptyItem)
public java.util.Collection<OptionItem> getListOptions()
public void setListOptions(java.util.Collection<OptionItem> listOptions)
public java.util.Map<java.lang.String,OptionItem> getMapOptions()
public void setMapOptions(java.util.Map<java.lang.String,OptionItem> mapOptions)
public java.lang.String getMissingItemStyleclass()
public java.lang.String getField()
public void setSelected(java.lang.Object selected)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||