Mega Code Archive

 
Categories / Java Tutorial / JSP
 

GetSet Value Using JSP Set Property

Jsp code <HTML>   <HEAD>     <TITLE>Getting a Property Value</TITLE>   </HEAD>   <BODY>     <H1>Getting a Property Value</H1>     <jsp:useBean id="bean1" class="beans.Test4" />         The message is: <jsp:getProperty name="bean1" property="message" />          <BR>         <jsp:setProperty name="bean1" property="message" value="Hello again!" />         Now the message is: <jsp:getProperty name="bean1" property="message" />   </body> </html> Test4.java package beans; import java.io.Serializable; public class Test4 implements Serializable {     public Test4()      {     }     private String message = "Hello from JSP!";     public void setMessage(String message)      {         this.message = message;     }     public String getMessage()      {         return this.message;     } }