I’m looking for a way to input a ‘schedule’ for a task from a user of a web app I’m working on, and have it be used on multiple pages in my UI.
I was looking for something that would allow me to configure whether was manually triggered, run monthly/weekly/daily/hourly, etc. and then based on the configured frequency show subfields, like day of month for monthly + time of day, day of week for weekly + time of day, just time of day for daily, etc.
I was thinking I could just use multiple select fields, and use Javascript to hide/show the appropriate subfields when the selected frequency indicated I didn’t need them. However, since I want to use this on multiple pages, I don’t want to have to do a copy of a bunch of stuff between pages if there’s a better way to do this.
Internally, it’ll likely be converted to crontab format and use Spring to do the scheduling, but I don’t want to display crontab format in a text box, because of its lack of user friendliness.
Anyone have any suggestions? I’m using Struts 2 for the UI, and am not using any Javascript library for anything. Not sure if this is the type of thing something like jQuery would make easy, or what.
Thanks.
OK, so I ended up using the Struts 2 component tag and just passing parameters to that to generate the appropriate code with different names. This worked the best for me since using this I was still able to nest Struts 2 tags and I’m not sure if I would have been able to do that by defining my own taglib.