Tue Jan 20, 2009 11:44 pm
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<jsp:useBean id="mailcheck" class="codemiles.mailchecker" >
<jsp:setProperty name="mailcheck" property="*" />
</jsp:useBean>
<%-- get valid property from ClientValidator bean --%>
<c:set var="isValid" value="${mailcheck.valid}" />
<c:if test="${isValid}">
<c:set var="useremail" value="${mailcheck.email}" scope="request" />
<c:set var="userpassword" value="${mailcheck.password}" scope="request" />
</c:if>
<html>
<head><title>Mail validation</title></head>
<body>
<h2>Welcome to codemiles library</h2>
<strong>Email</strong>:
<c:out value="${useremail}" /><br><br>
<strong>Password</strong>:
<c:out value="${userpassword}" />
</body>
</html>
package codemiles;
/**
*
* @author codemiles
*/
public class mailchecker implements java.io.Serializable{
String email;
String password;
boolean valid;
public mailchecker()
{
this.valid=false;
}
public boolean isValid(){
/* This method is called in the jsp file , here you put your code to check on
mail , and set the value of valid property .
*/
this.valid=true;
return valid;
}
// set the email value
public void setEmail(String _email){
if(_email != null && _email.length() > 0)
email = _email;
else
email = "Unknown";
}
// Return the current email
public String getEmail(){
return email; }
// Set the value of the password
public void setPassword(String _password){
if(_password != null && _password.length() > 0)
password = _password;
else
password = "none";
}
// Return the value of password property
public String getPassword(){
return password;
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.