Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Diganta Das
JSP Project
0 Answer(s)      a year and 7 months ago
Posted in : JSP-Servlet


Register.html

<html>
<body >
<form action="process.jsp" method=post>
<center>
<table cellpadding=2 cellspacing=1 border="1" bgcolor="lightblue" width="900" height="500">
<th bgcolor="lightblue" colspan=2>
<font size=5>User Registration</font>
<br>
<font size=2 color="red"><sup>*</sup> Required Fields</font>
</th>
<tr bgcolor="lightblue">
<td valign=top> 
<b>First Name<sup>*</sup></b> 
<br>
<input type="text" name="firstName" value="" size=20 maxlength=20></td>
<td  valign=top>
<b>Last Name<sup>*</sup></b>
<br>
<input type="text" name="lastName" value="" size=15 maxlength=20></td>
</tr>
<tr bgcolor="lightblue">
<td valign=top>
<b>E-Mail<sup>*</sup></b> 
<br>
<input type="text" name="email" value="" size=25  maxlength=125>
<br></td>
<td  valign=top>
<b>Cell Nr(9 fig.)<sup>*</sup></b> 
<br>
<input type="text" name="zip" value="" size=10  maxlength=9></td>
</tr>
<tr bgcolor="lightblue">
<td valign=top colspan=2>
<b>User Name<sup>*</sup></b>
<br>
<input type="text" name="userName" size=20 value=""  maxlength=10>
</td>
</tr>
<tr bgcolor="lightblue">
<td valign=top>
<b>Password<sup>*</sup></b> 
<br>
<input type="password" name="password1" size=10 value="" maxlength=10></td>
<td  valign=top>
<b>Confirm Password<sup>*</sup></b>
<br>
<input type="password" name="password2" size=10 value="" maxlength=10></td>
<br>
</tr>
<tr bgcolor="lightblue">
<td  align=center colspan=2>
<input type="submit" value="Submit"> <input type="reset"  
value="Reset">
</td>
</tr>
</table>
</center>
</form>
</body>
</html>


Process.jsp

<%@ page language="java" %>
<%@ page import="java.util.*"%>
<%!
%>
<jsp:useBean id="formHandler" class="test.FormBean" scope="request">
    <jsp:setProperty name="formhandler" property="*"/>
</jsp:useBean>
<% 
if(formHandler.validate())
    {
    %>

}

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<center>
<form action="Register.html" method=POST>
    <input type="submit" name="Submit" value="Submit" style="background-color:#49743D;font-weight:bold;color:#ffffff;"/>
    </form>

<table cellpadding=1 cellspacing=1 border="1" width="900" height="500">
<th bgcolor="lightblue" colspan=2>
<font size=5>Almost done! Just press SUBMIT to finish the registration procedure!</font>
</th>
<font size=4>
<tr bgcolor="lightblue">
<td valign=top> 
<b>First Name</b> 
<br>
<jsp:getProperty name="formHandler" property="firstName"/>
</td>
<td valign=top>
<b>Last Name</b>
<br>
<jsp:getProperty name="formHandler" property="lastName"/>
</td>
</tr>
<tr bgcolor="lightblue">
<td valign=top>
<b>E-Mail</b> 
<br>
<jsp:getProperty name="formHandler" property="email"/>
<br></td>
<td valign=top>
<b>Cell Nr(9 fig.)</b> 
<br>
<jsp:getProperty name="formHandler" property="zip"/>
</td>
</tr>
<tr bgcolor="lightblue">
<td valign=top colspan=2>
<b>User Name</b>
<br>
<jsp:getProperty name="formHandler" property="userName"/>
</td>
</tr>
</font>
</table>
</center>
    </body>
    </html>
<%
   }  else {
%>
    <jsp:forward page="retry.jsp"/>
<%
   }
%>

Retry.jsp

<jsp:useBean id="formHandler" class="test.FormBean" scope="request"/>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd"
<html> 
<body>

<form action="process.jsp" method=post>
<center>
<table cellpadding=4 cellspacing=2 border=0 width="900" height="500">
<th bgcolor="lightblue" colspan=2>
<font size=5>User Registration</font>
<br>
<font size=2 color="red"><sup>*</sup> Required Fields </font>
</th>
<tr bgcolor="lightblue">
<td valign=top> 
<B>First Name<sup>*</sup></B> 
<br>
<input type="text" name="firstName" value='<%=formHandler.getFirstName()%>' size=15 maxlength=20>
<br>
 <font size=2 color=red><%=formHandler.getErrorMsg("firstName")%></font>
</td>

<td  valign=top>
<B>Last Name<sup>*</sup></B>
<br>
<input type="text" name="lastName" 
value='<%=formHandler.getLastName()%>' size=15 maxlength=20>
<br><font size=2 color=red><%=formHandler.getErrorMsg("lastName")%></font>
</td>
</tr>
<tr bgcolor="lightblue">
<td valign=top>
<B>E-Mail<sup>*</sup></B> 
<br>
<input type="text" name="email" value='<%=formHandler.getEmail()%>' 
size=25  maxlength=125>
<br><font size=2 color=red><%=formHandler.getErrorMsg("email")%></font>
</td>
<td  valign=top>
<B>Cell Nr(9 fig.)<sup>*</sup></B> 
<br>
<input type="text" name="zip" value='<%=formHandler.getZip()%>' size=5  
maxlength=9>
<br><font size=2 color=red><%=formHandler.getErrorMsg("zip")%></font>
</td>
</tr>
<tr bgcolor="lightblue">
<td valign=top colspan=2> 
<B>User Name<sup>*</sup></B>
<br>
<input type="text" name="userName" size=10 
value='<%=formHandler.getUserName()%>'  maxlength=10>
<br><font size=2 
color=red><%=formHandler.getErrorMsg("userName")%></font>
</td>
</tr>
<tr bgcolor="lightblue">
<td valign=top>
<B>Password<sup>*</sup></B> 
<br>
<input type="password" name="password1" size=10 
value='<%=formHandler.getPassword1()%>'  maxlength=10>
<br><font size=2 color=red><%=formHandler.getErrorMsg("password1")%></font>
</td>
<td  valign=top>
<B>Confirm Password<sup>*</sup></B>
<br>
<input type="password" name="password2" size=10 
value='<%=formHandler.getPassword2()%>'  maxlength=10>
<br><font size=2 color=red><%=formHandler.getErrorMsg("password2")%></font>
</td>
<br>
</tr>
<tr bgcolor="lightblue">
<td colspan=2 align=center>
<input type="submit" value="Submit"> 
</td>
</tr>
</table>
</center>
</form>
</body>
</html>

TestBen.java

package test;
import java.io.*;
import java.util.*;


/**
 *
 * @author NIIT
 */
public class FormBean 
{
   private String firstName;
      private String lastName;
      private String email;
      private String userName;
      private String password1;
      private String password2;
      private String zip;
      private String notify;
      private Hashtable errors;

      public boolean validate() {
        boolean bool=true;
        if (firstName.equals("")) {
          errors.put("firstName","Please enter your first name");
          firstName="";
          bool=false;
        }
        if (lastName.equals("")) {
          errors.put("lastName","Please enter your last name");
          lastName="";
          bool=false;
        }
        if (email.equals("") || (email.indexOf('@') == -1)) {
          errors.put("email","Please enter a valid email address");
          email="";
          bool=false;
        }
        if (userName.equals("")) {
          errors.put("userName","Please enter a username");
          userName="";
          bool=false;
        }
        if (password1.equals("") ) {
          errors.put("password1","Please enter a valid password");
          password1="";
          bool=false;
        }
        if (!password1.equals("") && (password2.equals("") || 
            !password1.equals(password2))) {
          errors.put("password2","Please confirm your password");
          password2="";
          bool=false;
        }
        if (zip.equals("") || zip.length() !=9 ) {
          errors.put("zip","Please enter a valid cell number");
          zip="";
          bool=false;
        } else {
          try {
            int x = Integer.parseInt(zip);
          } catch (NumberFormatException e) {
            errors.put("zip","Please enter a valid cell number");
            zip="";
            bool=false;
          }
        }
        return bool;
      }
      public String getErrorMsg(String s) {
        String errorMsg =(String)errors.get(s.trim());
        return (errorMsg == null) ? "":errorMsg;
      }
      public FormBean() {
        firstName="";
        lastName="";
        email="";
        userName="";
        password1="";
        password2="";
        zip="";
        notify="";
        errors = new Hashtable();
      }
      public String getFirstName() {
        return firstName;
      }
      public String getLastName() {
        return lastName;
      }
      public String getEmail() {
        return email;
      }
      public String getUserName() {
        return userName;
      }
      public String getPassword1() {
        return password1;
      }
      public String getPassword2() {
        return password2;
      }
      public String getZip() {
        return zip;
      }
      public String getNotify() {
        return notify;
      }
      public void setFirstName(String fname) {
        firstName =fname;
      }
      public void setLastName(String lname) {
        lastName =lname;
      }
      public void setEmail(String eml) {
        email=eml;
      }
      public void setUserName(String u) {
        userName=u;
      }
      public void  setPassword1(String p1) {
        password1=p1;
      }
      public void  setPassword2(String p2) {
        password2=p2;
      }
      public void setZip(String z) {
        zip=z;
      }
      public void setErrors(String key, String msg) {
        errors.put(key,msg);
      }
      public void setNotify(String n) {
        notify=n;
      }
    }
When I Run This Program It's Show a Error
type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: java.lang.NullPointerException
root cause 

java.lang.NullPointerException
note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1_01 logs.

Advertisement
View Answers

Related Tutorials/Questions & Answers:
Project in jsp
Project in jsp  Hi, I'm doing MCA n have to do a project 'Attendance Consolidation' in JSP.I know basic java, but new to jsp. Is there any JSP source code available for reference...? pls help me
Jsp Project
project using jsp and servlet.. and i am interested in doing cloud computing related...Jsp Project  Hi Sir, i am final year mca Student... i have to do main project for completing my acadamic project as well as i need to improve my
Advertisements
jsp project
jsp project  hi i am sabarish i am doing mini project in EJP..... front end is jsp and back end is SQL SERVER 2012 my project title is friendstouch... mobile as a msg ........ could any body help me i am new to jsp
jsp project
jsp project  hello sir..i am doing one project in jsp in which there are two user type one is admin who is having all priviledge to add,edit and delete and can view all things and second one is student.In login page one
JSP Project
JSP Project  I want to get a code for login page with user interface in JSP for my web application. Please help me
jsp project - JSP-Servlet
jsp project  sure vac call management project
JSP Project
JSP Project  Register.html <html> <body > <form...; <%! %> <jsp:useBean id="formHandler" class="test.FormBean" scope="request"> <jsp:setProperty name="formhandler" property="*"/> <
project - JSP-Servlet
project  i have to do a project in jsp... plz suggest me some good topics. its an mini project.. also mention some good projects in core java... reply urgently  Hi friend, Please visit for more
project - JSP-Servlet
project  plz suggest me some good projects using jsp-servlets v r...... you choose Library Management as ur project Becoz thats only , you can easy to generate the code in jsp and servlet, its size also medium. if you
Project - JSP-Servlet
Project  Can you send me the whole project on jsp or servlet so that i can refer it to create my own : the topic is Advertisement Management System Atleast tell me how many modules does it include
help on project - JSP-Servlet
help on project  Need help on Java Project
java project - JSP-Servlet
java project  i am going to do a mini-project on computerization... mini-project... where all the students can enter into the application... over to the ID card manufacturers.. so this is the idea of my mini-project
project guidance - JSP-Servlet
project guidance  i have to make a project on resume management... form, can anyone guide me through the project ?  Hi maverick Here is the some free project available on our site u can visit and find the solution
library management system jsp project
library management system jsp project  i need a project of library management system using jsp/java bean
library management system jsp project
library management system jsp project  i need a project of library management system using jsp/java bean
library management system jsp project
library management system jsp project  i need a project of library management system using jsp/java bean
online examination system project in jsp
online examination system project in jsp  How many tables are required in SQL for online examination system project in jsp in java
online examination system project in jsp
online examination system project in jsp  How many tables are required in SQL for online examination system project in jsp in java my email id
.xhtml or .jsp page in a jsf project
.xhtml or .jsp page in a jsf project  in a jsf project which pages should i use, .jsp or .xhtml? and why ? what are adventages or dis adventages jsp and xhtml pages. thanks
online examination system project in jsp
online examination system project in jsp  How many and which data tables are required for online examination system project in jsp in java. please give me the detailed structure of each table
Regarding a project in java - JSP-Servlet
Regarding a project in java  am doing a project on Tiny ETL(Extract Transform and Load), using jsp-servlets. Can u help me out by giving some... friend, Plz specify the technologies you have used like JSP/Servlet/Struts/J2EE
project in JSP and XML(to store data)
project in JSP and XML(to store data)  I need to complete an assignment in JSP and using XML as Database ,Please help me to complete... if possible,ineed to understand this.making this project from last2 weeks but still
JSP Project: implementing video chatting in JSP
JSP Project: implementing video chatting in JSP  Hi!!! I am developing a chatting application in JSP and Servlet. I want to implement video chatting facility on my website. How can I do this task. Please help at the earliest
online examination system project in jsp
online examination system project in jsp  I am doing project... in jsp for online examination system...; For more information, visit the following link: http://www.roseindia.net/jsp/online
import project from eclipse - JSP-Servlet
import project from eclipse  i have two jsp project in eclipse workspace one project run in eclipse. how import second project in eclipse editor please tell me which file are required to run jsp project in lib directory
online examination system project in jsp
online examination system project in jsp  How to show the status bar which shows how much time is remaining in online examination system in jsp.my
online examination system project in jsp
online examination system project in jsp  Thanks for providing me the 6 tables.But I want to know will the id field of answers1 table be same for all questions of Set1? Will it be 1 or will be 1,2,3,... What
Project realated help - JSP-Servlet
Project realated help   Hi sir i need your assistance em stuck at a point,actualy i am making final year project,i am making OTRS system in java em using sturts ,servlet,i push whole data by layered architecture,sir succesfully
online examination system project in jsp
online examination system project in jsp  thanks for providing me 6 tables for online examination system. I want to know what will the id field of Answers1 table contain? Will it contain same id for all the questions of Set1 &
online examination system project in jsp
online examination system project in jsp  thanks for providing me 6 tables for online examination system. I want to know what will the id field of Answers1 table contain? Will it contain same id for all the questions of Set1 &
I want design samples for JSP project
I want design samples for JSP project  Sir, I world Like to do a project in jsp techonology. But i have no idea of selecting the project, especially if i selected any project i have no idea that is how to build ie how to design
Advertisements
 

 

 

DMCA.com