dbforms
Tag filter
Create a set of sql filter conditions, letting user
select which one will be applied.
Example:
A filter tag contains one or more filterCondition
tag. Each filterCondition represent a sql condition
and is identified by its label. In the body of the
filterCondition tag there is the piece of SQL code
that we want to insert in the where clause, the
character ? act like a placeholder, so a ? in the
sql code will be substituted with the some user
input. To tell the system what type of user input we
want, the last tag is used, the filterValue tag.
Each ? found in body will be subsituted by its
corresponding filterValue tag. With the "type"
attribute of this tag you can select the input more.
Selecting "text", a filterValue will render an html
input tag, with "select" you'll have an html select,
and so on. An example is like this:
<db:filter> <db:filterCondition
label="author name like"> NAME LIKE %?%
<db:filterValue/>
</db:filterCondition>
<db:filterCondition label="ID > V1 AND ID
< V2"> AUTHOR_ID >= ? AND AUTHOR_ID <=
? <db:filterValue label="V1"
type="numeric"/> <db:filterValue
label="V2" type="numeric"/>
</db:filterCondition>
<db:filterCondition label="author equal
to"> NAME = ? <db:filterValue
type="select"> <db:queryData name="q1"
query="select distinct name as n1, name as
n2 from author where AUTHOR_ID < 100
order by name"/> </db:filterValue>
</db:filterCondition>
<db:filterCondition label="now is after
date"> CURRENT_DATE > ? <db:filterValue
type="date" useJsCalendar="true" />
</db:filterCondition>
<db:filterCondition label="filter without
user input"> AUTHOR_ID > 10
</db:filterCondition> </db:filter>
This structure will be rendered as a html select
element to select the condition the you want to
apply. On the onchange event there is a submit, so
the page reload with the input elements of the
condition that you have selected. After all input
elements, there are two buttons, one to apply the
condition, one to unset the current applied
condition.
Tag Information |
Tag Class | org.dbforms.taglib.DbFilterTag |
TagExtraInfo Class | None |
Body Content | JSP |
Display Name | None |
Attributes |
Name | Required | Request-time | Type | Description |
disabledCaption | false | true | java.lang.String |
used to override the label of the main select's
first option element
|
setCaption | false | true | java.lang.String | caption of the SET button |
unsetCaption | false | true | java.lang.String | caption of the UNSET button |
styleClass | false | true | java.lang.String |
CSS stylesheet class to be applied. This is done
adding a SPAN element that contains the text.
|
title | false | true | java.lang.String |
this defines the "title" attribute for the HTML4
tag.
|
size | false | true | java.lang.String | Number of rows of select element |
setStyleClass | false | true | java.lang.String |
CSS stylesheet class to be applied to the SET
button. If not provided, the styleClass
attribute is used.
|
unsetStyleClass | false | true | java.lang.String |
CSS stylesheet class to be applied to the UNSET
button. If not provided, the styleClass
attribute is used.
|
Variables |
No Variables Defined. |
Output Generated by
Tag Library Documentation Generator.
Java, JSP, and JavaServer Pages are trademarks or
registered trademarks of Sun Microsystems, Inc. in the US and other
countries. Copyright 2002-4 Sun Microsystems, Inc.
4150 Network Circle
Santa Clara, CA 95054, U.S.A.
All Rights Reserved.