0% found this document useful (0 votes)
32 views8 pages

Eejava Tyit Sem 5 Practical4b Performed by RMP

The document provides steps to develop a simple JSP application. It involves creating a new NetBeans project called "Practical4b", adding an index.html page with a form to collect user input, and a Validate.jsp page to validate the form data on submit. The Validate.jsp page gets the form parameters, checks for empty or invalid values, and displays either error messages or a success message with the submitted values.

Uploaded by

Jalisa Firfire
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views8 pages

Eejava Tyit Sem 5 Practical4b Performed by RMP

The document provides steps to develop a simple JSP application. It involves creating a new NetBeans project called "Practical4b", adding an index.html page with a form to collect user input, and a Validate.jsp page to validate the form data on submit. The Validate.jsp page gets the form parameters, checks for empty or invalid values, and displays either error messages or a success message with the submitted values.

Uploaded by

Jalisa Firfire
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Class: TYIT

SUBJECT: ENTERPRISE JAVA

PRACTICAL 4B: DEVELOP A SIMPLE JSP APPLICATION

Procedure:

Step 1: Go To Neatbean Software

Step2: Click On File Menu

Step3: Select New Project Option

Step 4: Type Project Name As A “Practical4b”

Step 5: Click On Next Next And Finish Button

Step 6: Index.Html Pg Will Display On Screen

Step7: Add Following Source Code In Index.Html Pg.

Under The <Body>

Index.Html Source Code:

<form action="Validate.jsp">

<table>

<tr>

<td> Enter Your Name </td>

<td> <input type="text" name="name"></td>

</tr>

<tr>

<td>Enter Your Age</td>

<td><input type="text" name="age"></td>

</tr>
<tr>

<td colspan="2">Select Hobbies

<input type="checkbox" name="hob1" value="singing"> Singing

<input type="checkbox" name="hob2" value="reading"> reading

<input type="checkbox" name="hob3" value="dancing"> dancing

<input type="checkbox" name="hob4" value="drawing"> drawing

</td>

</tr>

<tr>

<td>enter E-mail</td>

<td><input type="text" name="email"></td>

</tr>

<tr>

<td>Select Gender</td>

<td>

<input type="radio" name="r1" value="Male"> Male

<input type="radio" name="r2" value="Female"> Female

</td>

</tr>

<tr>

<td colspan="2">

<input type="submit" value="Submit Form">

</td>

</tr>

</table>

</form>
Step 8: Then Go To Project Double Click On Project

Step 9: Click On Web Page Folder

Step 10: Right Click On That Folder

Step11: Then Click On New Option Select Jsp Sub Option From List.

Step 12: Give Name To Jsp File As A “Validate.jsp”

Step 13: Then Jsp Source Code Interface Will Display On Screen. Add Following Source Code In It

VALIDATE.JSP SOURCE CODE

ADD THIS CODE UNDER <BODY>

<%

String name=request.getParameter("name");

String agest r=request.getParameter("age");


String errmsg="";

if(name.trim().equals(""))

errmsg="Plz. Provide Name <br>";

if(agestr.trim().equals(""))

errmsg+="Plz. Provide Age <br>";

else

try{

int age=Integer.parseInt(agestr);

catch(Exception ex)

errmsg+="Invalid Age<br>";

if(errmsg.trim().equals(""))

%>

<jsp:include page="index.html"></jsp:include>

<%

out.println(errmsg);

else

out.println("Name "+ request.getParameter("name"));

out.println("<br> Age "+ request.getParameter("age"));

}
%>
Then Save It

Step 14: Go To Index.Html Page Click On Run Icon .

Then Designing Output Will Display On Screen

Add Username And Age Click On Submit Button Following Output Will Display On Screen

OUTPUT:

You might also like