Struts2 jquery datepicker - set past date range by maxDate & minDate

隐身守侯 提交于 2019-12-12 14:26:06

问题


I have a problem to set the S2 jQuery datepicker to a range between 1st of March 2012 and 31st of March 2014. I have an application that searches past data within this date range and cannot use the +/- setting based on the todays date. I tried to pass a Date object from Action class, but I don't know if it's possible to access it inside the tag. I would appreciate your help!

<sj:datepicker value="Start" id="start" 
    name="startDate" 
    changeMonth="false" 
    changeYear="false" 
    showButtonPanel="false"
    displayFormat="dd-mm-yy" 
    buttonImageOnly="true" 
    onfocus="checkByDate()"
    minDate="????"
    maxDate="????"
    showOn="both"
/>

回答1:


In JSP:

<sj:datepicker 
    ....
    minDate="%{minDate}"
    maxDate="%{maxDate}"
/>

In Action class:

public java.util.Date getMinDate(){
    return minDate;
}
public java.util.Date getMaxDate(){
    return maxDate;
}


来源:https://stackoverflow.com/questions/24574249/struts2-jquery-datepicker-set-past-date-range-by-maxdate-mindate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!