?? ifvalidemailaddrtag.java
字號:
package com.ora.jsp.tags;
import javax.servlet.jsp.*;
import javax.servlet.jsp.jstl.core.*;
import org.apache.taglibs.standard.lang.support.*;
import com.ora.jsp.util.StringFormat;
/**
* This class is a custom action for testing if a string value
* is in the format of a valid SMTP email address.
* If it is, the body is evaluated. If a var attribute is provided,
* the result is also saved as a Boolean variable in the specified
* scope, or in the page if no scope is specified.
*
* @author Hans Bergsten, Gefion software <hans@gefionsoftware.com>
* @version 2.0
*/
public class IfValidEmailAddrTag extends ConditionalTagSupport {
private String valueEL;
public void setValue(String value) {
valueEL = value;
}
public boolean condition() throws JspTagException {
/*
* Evaluate the EL expression, if any
*/
String emailAddr = null;
try {
emailAddr = (String)
ExpressionEvaluatorManager.evaluate("value", valueEL,
String.class, this, pageContext);
}
catch (JspException e) {
throw new JspTagException(e.getMessage());
}
return StringFormat.isValidEmailAddr(emailAddr);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -