Total members 10262 | Gratitudes |It is currently Wed May 23, 2012 9:34 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Code Snippet
 Code subject: validate mail in jsp
PostPosted: Tue Jan 20, 2009 11:44 pm 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2279
Location: Earth
Has thanked: 39 time
Have thanks: 61 time

validate mail in jsp (Java server pages ) , the following code contain two snippet ,the first one is using custom tags ,the second is a java bean class.

1. JSP FIle
Code:
<%@ 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>


2. Java Class Bean
Code:


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;
}

}

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  

 Similar topics
 validate international phone number value
 validate age entered as selection box in javascript
 How to send conformation e-mail through JSP
 validate username
 validate email address in asp
 configure cisco call manager express for voice mail
 mail function problem
 send mail using php
 validate domain name in php
 validate e-mail in php

All times are UTC [ DST ]


Users browsing similar codes

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Code Snippet | Next Code Snippet 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team