Jsp code
<HTML> <HEAD> <TITLE>Using a JavaBean</TITLE> </HEAD> <BODY> <h1>Using a JavaBean</h1> <% beans.Test1 messager = new beans.Test1("message from"); %> The message is: <%= messager.msg() %> </BODY> </HTML>
Test1.java
package beans; public class Test1 { String msg; public Test1(String message) { msg = message; } public String msg() { return msg; } }