Switch to full style
JSP Code Examples
Post a reply

use of Java Beans in jsp

Sat Jan 17, 2009 1:02 am

Example on use of Java Beans in jsp (Java server pages ) .The scope of beans can be
(session,page,Application) It is so simple example .


Code:
<HTML>
    <
HEAD>
        <
TITLE>use of  Java Beans in jsp</TITLE>
    </
HEAD>

    <
BODY>
        <
H1>Using Beans and Session Scope</H1>

        <
jsp:useBean id="myhome" class="codebeans.Home" scope="session" />

        <% 

        
myhome.setHomeName("Codemiles Home");

        %>
       
Our home name is : <jsp:getProperty name="myhome" property="HomeName" /> 
    </
BODY>
</
HTML>
 


Here the java Beans example .

Code:

package codebeans
;
 

public class 
Home {

  
String HomeName ;

  public 
int getHomeName() {
 
    return 
this.HomeName;
  }

  public 
void setHomeName(String HomeName)
 {
    
this.HomeName HomeName;
  }




Post a reply
  Related Posts  to : use of Java Beans in jsp
 use java beans with jsp form     -  
 cmp entity beans     -  
 2d game in java-Monster-Java 2D Game Graphics and Animation     -  
 need help in java     -  
 What is Java API?!!!     -  
 java or .net     -  
 Using FTP in java     -  
 what is java     -  
 Java course     -  
 How java access URL     -  

Topic Tags

Servlets/JSP