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