|
On this page we will help you learn how to start working with Smile. This "Getting Started"-page will grow over time and, dare I say it, may eventually turn into a complete user manual! What you need before we begin:
<web-app>
<display-name>
Smile, the JavaServer Faces open-source implementation.
</display-name>
<description>
Development web-app for smile.
</description>
<context-param>
<param-name>net.sourceforge.smile.descriptor.package</param-name>
<param-value>net.sourceforge.smile.demo</param-value>
<description>The package where the screen descriptors are located.</description>
</context-param>
<context-param>
<param-name>net.sourceforge.smile.descriptor.postfix</param-name>
<param-value></param-value>
<description>The postfix to append to descriptor class names.</description>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
<description>state saving option. One of client,server</description>
</context-param>
<listener>
<listener-class>net.sourceforge.smile.ApplicationListener</listener-class>
</listener>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
The web.xml contains two Smile specific context parameters:
Now you can start creating your pages, pages are defined as pojos(plain old java objects) in Smile. For Example to create your first hello world page, create a Java file like this:
public class HelloWorld extends UIScreen {
private UIColumnLayout layout;
private UIOutput label;
public HelloWorld() {
setTitle("Hello World Example...");
layout = new UIColumnLayout(1,1);
addChild(layout);
label = new UIOutput();
label.setComponentId("label");
label.setValue("Hello World");
layout.addChild(label);
}
}
Copy the application to Tomcat and navigate to http://localhost:8080/<app-name>/faces/HelloWorld (replace app-name with the name of your web application). If all went well, you should see a blank page with the text: Hello World. |