Using a Constructor
//File: index.jsp <HTML> <HEAD> <TITLE>Using a Constructor</TITLE> </HEAD> <BODY> <H1>Using a Constructor</H1> <% beans.Message m = new beans.Message("Hello from JSP!"); %> The message is: <%= m.msg() %> </BODY> </HTML> /////////////////////////////////////////////////////////////////////////// //File: Message.java package beans; public class Message { String msg; public Message(String message) { msg = message; } public String msg() { return msg; } }