|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectus.souther.select.HolidayBean
public class HolidayBean
This is the model portion of an MVC app that demonstrates one way to build work with dynamic select boxes. In the real world this bean would most likely access a relational database to get the data. In order to keep this project entirely contained within a war file, a data structure (HolidayDB) was used instead. The basic concept is the same and this bean should be good enough to use as a starting point in a relational database app. Legal Notice:
This code was written for demonstration purposes only. The author of this code assumes no responsibility for damage resulting in it's use. You may do whatever you like with it but at your own risk. It is your responsibility to understand how it works and determine if it is dependable enough, stable enough, and secure enough for your intended purpose.
Constructor Summary | |
---|---|
HolidayBean()
Creates a new HolidayBean. |
|
HolidayBean(HolidayDB db,
int month,
java.lang.String key)
Creates a new HolidayBean. |
Method Summary | |
---|---|
java.lang.String |
getHolidaysAsOptions()
Builds a filtered list of holidays as a set of HTML Select Option tags. |
java.lang.String |
getInfo()
Shows the date that a selected holiday is celebrated on but only when the final form has been submitted. |
java.lang.String |
getIsFormEnabled()
Used to toggle the disabled status of the form's enter button. |
java.lang.String |
getKey()
This key is also used as the value portion in the option tags return from the getHolidaysAsOptions method. |
int |
getMonth()
The month as a numeric string. |
java.lang.String |
getMonthsAsOptions()
Builds a list of Months as a set of HTML Select Option tags. |
static void |
main(java.lang.String[] args)
For testing and debugging only. |
void |
setShowInfo(boolean showInfo)
Unless this is specifically set to true, the getInfo mehod will return an empty string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HolidayBean()
public HolidayBean(HolidayDB db, int month, java.lang.String key)
db
- The mock database containing the holiday information.month
- The month filter used to restrict the list of holidays.
This value will be passed to the servlet as an HTML form parameter.
It will come from the month select list in on the JSP.key
- The key needed to pull a specific holiday from the database.
This value will be passed to the servlet as an HTML form parameter.
It will come from the holiday select list on the JSP.
If this arg is a blank string we will assume that the
form submission was triggered by the onclick event of the
month select list.Method Detail |
---|
public java.lang.String getMonthsAsOptions()
public java.lang.String getHolidaysAsOptions()
public java.lang.String getIsFormEnabled()
public java.lang.String getInfo()
public void setShowInfo(boolean showInfo)
showInfo
- form information?public int getMonth()
public java.lang.String getKey()
public static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |