Copyright ©2008 |
Tutorial:
Using the Eclipse Web Tools Platform
with Apache Tomcat
|
This discussion is continued from here.
Right click on the project, wtp-tutorial, choose New and Clas. You get the standard class dialog box which you fill out using the same package path as your TutorialServlet class. Inside this class, you'll enter the following code.
package com.windofkeltia.wtp.tutorial;
/**
* Tutorial: Using the Eclipse Web Tools Platform with Apache Tomcat
* This class is a bean that manages persistence for the greeting in the
* tutorial.
*
* @author russ@windofkeltia.com
*/
public class GreetingBean implements java.io.Serializable
{
static final long serialVersionUID = 1L;
private String greeting;
public GreetingBean()
{
// this is the default greeting...
this.greeting = "Hello world!";
}
public String getGreeting()
{
return this.greeting;
}
public void setGreeting( String greeting )
{
this.greeting = greeting;
}
}
If you want the test code, create another class for that or continue on with the rest of the tutorial by clicking on the back arrow or here.
package com.windofkeltia.wtp.tutorial;
public class TestGreetingBean
{
public static void main( String[] args )
{
GreetingBean greeting = new GreetingBean();
greeting.setGreeting( "Salut les mecs !" );
System.out.print( greeting.getGreeting() );
}
}