Jsp page code
<HTML> <HEAD> <TITLE>Using <jsp:useBean></TITLE> </HEAD> <BODY> <H1>Using <jsp:useBean></H1> <jsp:useBean id="bean1" class="beans.Test3" /> The message is: <%= bean1.getMessage() %> </BODY> </HTML>
Test3.java
package beans; import java.io.Serializable; public class Test3 implements Serializable { public Test3() { } private String message = "Hello from JSP!"; public String getMessage() { return message; } }