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