Example: StringBean
package cwp;
public class StringBean {
private String message = "No message specified";
public String getMessage() {
return(message);
}
public void setMessage(String message) {
this.message = message;
}
}
Installed in normal servlet directory
61
JSP
www.corewebprogramming.com
JSP Page That Uses StringBean
 id="stringBean" class="cwp.StringBean" />
  • Initial value (getProperty):
  •  name="stringBean" 
    property="message" />
  • Initial value (JSP expression):
  • <%= stringBean.getMessage() %>
  •  name="stringBean" 
    property="message" 
    value="Best string bean: Fortex" />
    Value after setting property with setProperty:
     name="stringBean" 
    property="message" />
  • <% stringBean.setMessage("My favorite: Kentucky Wonder"); %>
    Value after setting property with scriptlet:
    <%= stringBean.getMessage() %>
    62
    JSP
    www.corewebprogramming.com
    31
    
    
    
    
      

    Home

    About Services Network Support FAQ Order Contact
     

    Java Web Hosting

    Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

    Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved