📄 selecteditemsrangevalidatortag.java
字号:
import javax.faces.validator.Validator;
import javax.faces.webapp.ValidatorTag;
import javax.servlet.jsp.JspException;
import cn.hxex.library.view.util.FacesUtils;
public class SelectedItemsRangeValidatorTag extends ValidatorTag
{
// the validator id registered in JSF
private static String VALIDATOR_ID = "cn.hxex.library.view.validator.SelectedItemsRange";
// the minimum number of items to be selected
private String minNum;
// the maximum number of items to be selected
private String maxNum;
/**
* Default constructor.
*/
public SelectedItemsRangeValidatorTag()
{
this.setValidatorId(VALIDATOR_ID);
}
public void setMinNum(String newMinNum)
{
this.minNum = newMinNum;
}
public void setMaxNum(String newMaxNum)
{
this.maxNum = newMaxNum;
}
/**
* Create the validator associated with the tag.
*
* @return the validator associated with the tag
*/
public Validator createValidator() throws JspException
{
SelectedItemsRangeValidator validator = (SelectedItemsRangeValidator) super
.createValidator();
Integer minValue = FacesUtils.evalInt(this.minNum);
if (minValue != null)
{
validator.setMinNum(minValue.intValue());
}
Integer maxValue = FacesUtils.evalInt(this.maxNum);
if (maxValue != null)
{
validator.setMaxNum(maxValue.intValue());
}
return validator;
}
public void release()
{
this.minNum = null;
this.maxNum = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -