|
||||||||||
Previous class Subsequent class | Frames No frames | |||||||||
Overview: Nested | Field | Constructor | Method | Details: Field | Constructor | Method |
java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
jp.terasoluna.fw.web.struts.taglib.PageLinksTag
public class PageLinksTag
Function that navigates the page.
Display the page navigation link of the list defined by<logic:iterate>
element of Struts.
If the link is identical JSP, it can be displayed at anywhere of the corresponding list such as left, right, top and bottom.
While using the page link function, it is necessary to
prepare the following fields in action form and to specify them
corresponding to the attribute of this function.
Page link function supports following attribute.
Attribute name | Default value | Necessity | Execution time format | Overview |
id |
- | false |
true |
When the string is specified in this attribute, the output destination is not the display but is stored in the page context. This attribute is the storage key. |
action |
- | false |
true |
Specify the path name of the action that displays the list display screen. It becomes the mandatory attribute when "submit" attribute is false. |
name |
- | false |
true |
Specify Bean that fetches display lines, starting line index and all lines of list information. |
rowProperty |
- | true |
true |
Specify the field that retains display lines. Fetch the value directly when "name" attribute is not specified. |
indexProperty |
- | true |
true |
Specify the field that retains the displayed starting index. Fetch the value directly when "name" attribute is not specified. |
totalProperty |
- | true |
true |
Specify the field that retains all lines of list information which is defined by
<logic:iterate> element .
Fetch the value directly when "name" attribute is not specified.
|
scope |
- | false |
true |
Specify the scope of fetching Bean specified in "name" attribute. |
submit |
false |
false |
true |
Specify true while performing submit and not link. Default is false. In case of false, "action" attribute becomes the mandatory attribute. "action" attribute becomes invalid if this attribute is set to true. |
forward |
false |
false |
true |
Attribute used when performing the distribution of forward using DispatchAction of TERASOLUNA. When true is specified, Hidden tags of the value set in "event" attribute are output. "value" attribute of that Hidden tag is considered as "forward_pageLinks". Default is false. |
event |
"event" |
false |
true |
Attribute used when performing distribution of forward using DispatchAction of TERASOLUNA. When "forward" attribute is set to true, Hidden tags with the names specified in this attribute are generated. Default is "event". |
resetIndex |
false |
false |
true |
This attribute becomes valid when using submit and when set to true, outputs Hidden tag of "startIndex" and "endIndex" to reset the specifed range. Default is false. |
currentPageIndex |
"currentPageIndex" |
false |
true |
It is the key for storing the current page count of corresponding list into page context. Default is "currentPageIndex". |
totalPageCount |
"totalPageCount" |
false |
true |
It is the key for storing the total page count of corresponding list into page context. Default is "totalPageCount". |
PageLinksTag
supports the following variables.
Variable name | Type | Valid range | Description |
Name specified in id attribute of custom tag.
|
java.lang.String |
Custom tag onwards | Retains the page link (tag etc) that is output to screen. |
Name or default value specified in currentPageIndex attribute of
custom tag.
|
java.lang.Integer |
Custom tag onwards | Retains the current page number of corresponding list information. |
Name or default value specified in totalPageCount
attribute of custom tag.
|
java.lang.Integer |
Custom tag onwards | Retains total page count of corresponding list information. |
pageLinks.<navigation direction><Navigation page count
>.char=<Display string>
Navigation direction :
Previous to currently displayed page number(forward in case of next.
Navigation page count :
Count of pages to jump from the current page number. Any numeric value can be set.
Display string :
Characters to be displayed on screen. These characters are the target of the link.
pageLinks.maxDspLinkSize =
<Count of display page>
Count of display page :
Maximum count of the link that directly specifies the page number.
pageLinks.prev10.char=<<
pageLinks.prev1.char=<
pageLinks.next1.char=>
pageLinks.next10.char=>>
pageLinks.maxDirectLinkCount=10
In the following example, page link function is used. In this example, for each switching of the page, database is accessed and only the list which is to be displayed, is fetched. In this example, there is no problem even if the action that initially navigated to the list display screen and action ("action" attribute) of the page link function, are same. In the below example, the field used in PageLinks is of type String. However, an object of type other than String can also be used.
In the following example, page link function is used. In this example, while switching the page, already fetched list information (all records) is fetched from action form. In this example, the action that initially navigated to the list display screen and action ("action" attribute) of page link function, are separate actions. In the action that initially navigated to the list display screen, all records of list information are fetched and the action of page link function should be considered as the action exclusively for screen display. In the followig example, String is used in the field which is set in page link. However, it is also possible to set the object other than String.
submit
attribute to true
.
If these settings are carried out, submit process is performed by JavaScript when page link is clicked.
When submit
attribute is set to true
,
action
attribute becomes invalid.
pageContext
.
Key can be specified in currentPageIndex
and
totalPageCount
attribute.
For the default value of attribute, refer to above.
For displaying the current page number and total page count on screen, use it as follows.
pageContext
by using the key. Therefore, output location can be changed.
It is used when current page number or total page count are to be dislayed on the top of page link
Field Summary | |
---|---|
protected java.lang.String |
action
Action name which is invoked when page link is clicked. |
protected static java.lang.String |
CHAR_LINKS
Property name element of the link for page jump of symbol display in ApplicationResources file. |
protected static java.lang.String |
CURRENT_PAGE_INDEX
Key that registers current page count into page context. |
protected java.lang.String |
currentPageIndex
Parameters for storing the current page number. |
protected static java.lang.String |
DEFAULT_EVENT
Default event parameter. |
protected static java.lang.String |
ERROR_MESSAGE_ACTION_REQUIRED
Error message wherein "action" attribute is mandatory. |
protected java.lang.String |
event
Event parameter. |
protected boolean |
forward
Forward flag. |
protected static java.lang.String |
FORWARD_NAME
Forward name. |
protected java.lang.String |
id
ID for changing the output destination. |
protected java.lang.String |
indexProperty
Field name of display starting index. |
protected java.util.Map<java.lang.String,java.lang.String> |
links
Map that stores display link by considering link registration ID of property file as key. |
private static org.apache.commons.logging.Log |
log
Log class. |
protected static java.lang.String |
MAX_DSP_SIZE
Property name element of display maximum count wherein the number of link for page jump in the ApplicationResources file, is directly specified. |
protected int |
maxLinkNo
Maximum page jump count. |
protected int |
maxPageCount
Maximum value of directly specified link number. |
protected java.lang.String |
name
Bean name that retains display starting index and all record count. |
protected static java.lang.String |
NEXT_LINKS
Property name element of the link to jump to next page in the ApplicationResources file. |
protected static java.lang.String |
PAGE_LINKS_PREFIX
Property name prefix of the link for page jump in the ApplicationResources file. |
protected static java.lang.String |
PAGELINKS_JAVASCRIPT_KEY
Output flag of JavaScript which is output by page link function |
protected static java.lang.String |
PREV_LINKS
Property name element of the link to jump to the previous page in the ApplicationResources file. |
protected boolean |
resetIndex
Specified range index output flag. |
protected java.lang.String |
rowProperty
Field name of display lines. |
protected java.lang.String |
scope
Scope of Bean to be fetched. |
private static long |
serialVersionUID
Serial version ID |
protected boolean |
submit
Submit flag. |
protected static java.lang.String |
TOTAL_PAGE_COUNT
Key that registers total page count into page context. |
protected java.lang.String |
totalPageCount
Parameter for storing the currentpage number. |
protected java.lang.String |
totalProperty
Field name of all records. |
protected static java.lang.String |
WARN_MESSAGE_ILLEGAL_ROW
Error message when fetched display lines (row) are below 0. |
Field inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
pageContext |
Field inherited from interface javax.servlet.jsp.tagext.IterationTag |
---|
EVAL_BODY_AGAIN |
Field inherited from interface javax.servlet.jsp.tagext.Tag |
---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Constructor Summary | |
---|---|
PageLinksTag()
|
Method Summary | |
---|---|
protected void |
addDirectLink(java.lang.StringBuilder sb,
int row,
int startIndex,
int totalCount)
Add page number link to StringBuilder of argument. |
protected void |
addDirectSubmit(java.lang.StringBuilder sb,
int row,
int startIndex,
int totalCount)
Add page number link to StringBuilder of argument. |
protected void |
addNextLink(java.lang.StringBuilder sb,
int row,
int startIndex,
int totalCount)
Add the link to navigate to next page, in the StringBuilder of argument. |
protected void |
addNextSubmit(java.lang.StringBuilder sb,
int row,
int startIndex,
int totalCount)
Add the link to naviagate to next page, in the StringBuilder of argument. |
protected void |
addPrevLink(java.lang.StringBuilder sb,
int row,
int startIndex,
int totalCount)
Add the link to naviagate to previous page, in StringBuilder of argument. |
protected void |
addPrevSubmit(java.lang.StringBuilder sb,
int row,
int startIndex,
int totalCount)
Add the link to navigate to previous page in StringBuilder of argument. |
protected void |
attributePageCount(int now,
int total)
Store the current pag count and total page count into page context. |
protected void |
defineHtml(int row,
int startIndex,
int totalCount)
Output the definition of HTML. |
int |
doStartTag()
Method which is called while starting the tag evaluation. |
java.lang.String |
getAction()
Return the "action" attribute value. |
java.lang.String |
getCurrentPageIndex()
Return the set currentPageIndex attribute value. |
java.lang.String |
getEvent()
Return the event attribute value. |
boolean |
getForward()
Return the forward attribute value. |
java.lang.String |
getId()
Return the id attribute value. |
java.lang.String |
getIndexProperty()
Return the indexProperty attribute value. |
protected int |
getInt(java.lang.Object obj)
Return the object of argument by converting it into int. |
private void |
getLinkProperty()
Fetch the link definition for page jump which is defined in property file. |
java.lang.String |
getName()
Return the id attribute value. |
protected boolean |
getPageContextFlg(javax.servlet.jsp.PageContext pageContext,
java.lang.String key)
Convert the value fetched by the specified KEY into true value and return. |
protected int |
getPageCount(int row,
int totalCount)
Calculate the page count and return. |
protected int |
getPageIndex(int row,
int startIndex)
Calculate the displayed page number and return. |
boolean |
getResetIndex()
Return the resetIndex attribute value. |
java.lang.String |
getRowProperty()
Return the rowProperty attribute value. |
java.lang.String |
getScope()
Return the scope attribute value. |
boolean |
getSubmit()
Return the submit attribute value. |
java.lang.String |
getTotalPageCount()
Return the totalPageCount attribute value. |
java.lang.String |
getTotalProperty()
Return the totalProperty attribute value. |
protected java.lang.Object |
lookup(javax.servlet.jsp.PageContext pageContext,
java.lang.String name,
java.lang.String property,
java.lang.String scope)
Fetch the value of property directly when name is not specified. |
void |
release()
Release all alocated resources. |
void |
setAction(java.lang.String action)
Set the value in "action"attribute. |
void |
setCurrentPageIndex(java.lang.String currentPageIndex)
Set the value in the "currentPageIndex" attribute. |
void |
setEvent(java.lang.String event)
Set the value in "event" attribute. |
void |
setForward(boolean forward)
Set the value in "forward" attribute. |
void |
setId(java.lang.String id)
Set the value in "id" attribute. |
void |
setIndexProperty(java.lang.String indexProperty)
Set the value in "indexProperty" attribute. |
void |
setName(java.lang.String name)
Set the value in "name" attribute. |
protected void |
setPageContextFlg(javax.servlet.jsp.PageContext pageContext,
java.lang.String key)
Set the flag of specified KEY for the page context. |
void |
setResetIndex(boolean resetIndex)
Set the value in "resetIndex" attribute. |
void |
setRowProperty(java.lang.String rowProperty)
Set the value in "rowProperty" attribute. |
void |
setScope(java.lang.String scope)
Set the value in "scope" attribute. |
void |
setSubmit(boolean submit)
Set the value in "submit" attribute. |
void |
setTotalPageCount(java.lang.String totalPageCount)
Set the value in "totalPageCount" attribute. |
void |
setTotalProperty(java.lang.String totalProperty)
Set the value in "totalProperty" attribute. |
Method inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
doAfterBody, doEndTag, findAncestorWithClass, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue |
Method fetched from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Details |
---|
private static final long serialVersionUID
private static org.apache.commons.logging.Log log
protected java.lang.String id
protected java.lang.String action
protected java.lang.String name
protected java.lang.String rowProperty
protected java.lang.String indexProperty
protected java.lang.String totalProperty
protected java.lang.String scope
protected boolean submit
protected boolean forward
protected java.lang.String event
protected boolean resetIndex
protected java.lang.String currentPageIndex
protected java.lang.String totalPageCount
protected static java.lang.String ERROR_MESSAGE_ACTION_REQUIRED
protected static java.lang.String WARN_MESSAGE_ILLEGAL_ROW
protected static java.lang.String PAGE_LINKS_PREFIX
ApplicationResources
file.
protected static java.lang.String PREV_LINKS
ApplicationResources
file.
protected static java.lang.String NEXT_LINKS
ApplicationResources
file.
protected static java.lang.String CHAR_LINKS
ApplicationResources
.
protected static java.lang.String MAX_DSP_SIZE
ApplicationResources
file, is directly specified.
protected static java.lang.String PAGELINKS_JAVASCRIPT_KEY
protected static java.lang.String FORWARD_NAME
protected static java.lang.String DEFAULT_EVENT
protected static java.lang.String TOTAL_PAGE_COUNT
protected static java.lang.String CURRENT_PAGE_INDEX
protected java.util.Map<java.lang.String,java.lang.String> links
protected int maxLinkNo
protected int maxPageCount
Constructor Details |
---|
public PageLinksTag()
Method Details |
---|
public java.lang.String getId()
getId
in class javax.servlet.jsp.tagext.TagSupport
public void setId(java.lang.String id)
setId
in class javax.servlet.jsp.tagext.TagSupport
id
- Value to be setpublic java.lang.String getAction()
public void setAction(java.lang.String action)
action
- Value to be setpublic java.lang.String getName()
public void setName(java.lang.String name)
name
- Value to be setpublic java.lang.String getRowProperty()
public void setRowProperty(java.lang.String rowProperty)
rowProperty
- Value to be setpublic java.lang.String getIndexProperty()
public void setIndexProperty(java.lang.String indexProperty)
indexProperty
- Value to be setpublic java.lang.String getTotalProperty()
public void setTotalProperty(java.lang.String totalProperty)
totalProperty
- Value to be setpublic java.lang.String getScope()
public void setScope(java.lang.String scope)
scope
- Value to be setpublic boolean getSubmit()
public void setSubmit(boolean submit)
submit
- Value to be setpublic boolean getForward()
public void setForward(boolean forward)
forward
- Value to be setpublic java.lang.String getEvent()
public void setEvent(java.lang.String event)
event
- Value to be setpublic boolean getResetIndex()
public void setResetIndex(boolean resetIndex)
resetIndex
- Value to be setpublic java.lang.String getCurrentPageIndex()
public void setCurrentPageIndex(java.lang.String currentPageIndex)
currentPageIndex
- Value to be setpublic java.lang.String getTotalPageCount()
public void setTotalPageCount(java.lang.String totalPageCount)
totalPageCount
- Value to be setpublic int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
- JSP exceptionprotected void defineHtml(int row, int startIndex, int totalCount) throws javax.servlet.jsp.JspException
row
- Display linesstartIndex
- Display starting indextotalCount
- All records
javax.servlet.jsp.JspException
- JSP exceptionprotected void addPrevSubmit(java.lang.StringBuilder sb, int row, int startIndex, int totalCount)
sb
- StringBuilder to be addedrow
- Display linesstartIndex
- Display starting indextotalCount
- All records of list informationprotected void addDirectSubmit(java.lang.StringBuilder sb, int row, int startIndex, int totalCount)
sb
- StringBuilder to be addedrow
- Display linesstartIndex
- Display starting indextotalCount
- All records of list informationprotected void addNextSubmit(java.lang.StringBuilder sb, int row, int startIndex, int totalCount)
sb
- StringBuilder to be addedrow
- Display linesstartIndex
- Display starting indextotalCount
- All records of list informationprotected void addPrevLink(java.lang.StringBuilder sb, int row, int startIndex, int totalCount)
sb
- StringBuilder to be addedrow
- Display linesstartIndex
- Display starting indextotalCount
- All records of list informationprotected void addDirectLink(java.lang.StringBuilder sb, int row, int startIndex, int totalCount)
sb
- StringBuilder to be addedrow
- Display linesstartIndex
- Display starting indextotalCount
- All records of list informationprotected void addNextLink(java.lang.StringBuilder sb, int row, int startIndex, int totalCount)
sb
- StringBuilder to be addedrow
- Display linesstartIndex
- Display starting indextotalCount
- All records of list informationprivate void getLinkProperty()
protected int getPageIndex(int row, int startIndex)
row
- Display linesstartIndex
- Display starting index of currently displayed page
protected int getPageCount(int row, int totalCount)
row
- Display linestotalCount
- All records
protected boolean getPageContextFlg(javax.servlet.jsp.PageContext pageContext, java.lang.String key)
pageContext
- Page contextkey
- KEY that fetches FLG
protected void setPageContextFlg(javax.servlet.jsp.PageContext pageContext, java.lang.String key)
pageContext
- Page contextkey
- KEY that sets FLGprotected java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext, java.lang.String name, java.lang.String property, java.lang.String scope) throws javax.servlet.jsp.JspException
pageContext
- Page contextname
- Bean name that retains propertyproperty
- Propertyscope
- Scope
javax.servlet.jsp.JspException
- JSP exceptionprotected int getInt(java.lang.Object obj) throws javax.servlet.jsp.JspException
obj
- Object to be converted into int
javax.servlet.jsp.JspException
- JSP exceptionprotected void attributePageCount(int now, int total)
now
- Current page counttotal
- Total page countpublic void release()
release
in javax.servlet.jsp.tagext.Tag
release
in javax.servlet.jsp.tagext.TagSupport
|
||||||||||
Previous class Subsequent class | Frames No frames | |||||||||
Overview: Nested | Field | Constructor | Method | Details: Field | Constructor | Method |