//index.jsp
<html>
<head>Student Info Entry Form</head>
<body>
<form action ="jsp9.jsp" method = "post">
Registration Number : <input type = "text" name = "regno" />
<br>
Name : <input type = "text" name = "uname" />
<br>
Address :<input type = "text" name = "address" />
<br>
<input type ="submit" value ="Register" />
</form>
</body>
</html>
--------------------------------------------------------
//jsp9.jsp
<html>
<body>
<jsp:useBean id="std" scope="request" class="ourbeans.Student" />
<jsp:setProperty name="std" property="*"/>
<jsp:forward page="welcomeinfo.jsp"/>
</body>
</html>
--------------------------------------------------------
// welcomeinfo.jsp
<html>
<body>
<h1>Welcome Your Info </h1>
<jsp:useBean id="std" scope="request" class="ourbeans.Student"/>
User Name : <jsp:getProperty name="std" property="uname"/><br>
Registration Number : <jsp:getProperty name="std" property="regno"/><br>
Address : <%out.print(std.getaddress());%>
</body>
</html>
//Student.java
package ourbeans;
public class Student
{
public String uname;
public int regno;
public String address;
public Student(){}
public void setuname(String s)
{uname = s;}
public String getuname()
{return uname;}
public void setregno(int rg)
{regno=rg;}
public int getregno()
{return regno;}
public void setaddress(String ad)
{address = ad;}
public String getaddress()
{return address;}
}
Thursday, 12 February 2015
9. Write a JAVA JSP Program to get student information through a HTML and create a JAVA Bean Class, populate Bean and display the same information through another JSP.
Labels:
J2EE

No comments:
Post a Comment