|
Hi!,
Here is an example that i
experimented with.....
the JSP code....
<%@ page
import="hello.NameHandler" %>
<jsp:useBean id="mybean" scope="page" class="hello.NameHandler" /> <jsp:setProperty name="mybean" property="*" /> <html> <head><title>Hello, User</title></head> <body bgcolor="#ffffff" background="background.gif"> <%@ include file="dukebanner.html" %> <table border="0" width="700"> <tr> <td width="150"> </td> <td width="550"> <h1>My name is Duke. What’s yours?</h1> </td> </tr> <tr> <td width="150" </td> <td width="550"> <form method="get"> <input type="text" name="username" size="25"> <br> <input type="submit" value="Submit"> <input type="reset" value="Reset"> </td> </tr> </form> </table> <% if ( request.getParameter("username") != null ) { %> <%@ include file="response.jsp" %> <% } %> </body> </html> the other JSP response.jsp.....
<table
border="0" width="700">
<tr> <td width="150"> </td> <td width="550"> <h1>Hello, <jsp:getProperty name="mybean" property="username" />! </h1> </td> </tr> </table> the bean......
package hello;
public class NameHandler { private String username; public NameHandler() { username = null; } public void setUsername( String name ) { username = name; } public String getUsername() { return username; } } This is an example straight from the JSWDK....i hope this
helps...
Senthil.
|
- How to use BEANS IN JSP D.Sankara Narayana
- Senthel Kumarann
