Web Applications in the Cloud with Struts and Jelastic
As you know, Web applications differ from conventional websites in that web applications can create a dynamic response. Many websites deliver only static pages. A web application can interact with databases and logic engines to customize a response. Web applications based on JavaServer Pages sometimes commingle database code, page design code and control flow code. In practice, unless these concerns are separated, larger applications become difficult to maintain.
One way to separate concerns in a software application is to use a Model-View-Controller (MVC) architecture. The Model represents the business or database code, the View represents the page design code, and the Controller represents the navigational code. The Struts framework is designed to help developers create web applications that utilize a MVC architecture. It is a free open-source solution for creating Java web applications.
Struts provides three key components:
- A “request” handler provided by the application developer that is mapped to a standard URI.
- A “response” handler that transfers control to another resource which completes the response.
- A tag library that helps developers create interactive form-based applications with server pages.
Wondering how to get all these benefits in the cloud? It’s easy! Just follow the next steps.
Create the environment
1. Go to jelastic.com and sign up if you haven’t done it yet or log in with your Jelastic credentials by clicking the Sign In link on the page.
2. Click Create environment to set up a new environment in Jelastic.
3. In the Environment topology window, select Tomcat 7 as your application server, set the Cloudlets limit (e.g. 16), type your environment name, for example, struts, and click Create.
In a minute your environment will be created and will appear in the environments list.
Upload a Java package
1. Upload your war package to the Deployment manager (we use struts2-showcase.war as an example). You can download some examples for testing here.
2. Once the upload process is finished, deploy a WAR archive to the environment you have just created: specify the context name, for example struts, and click on the Deploy button.
If you use the same app for testing don’t deploy it to the ROOT context (otherwise you will get configuration errors later on).
3. After the deployment is successfully finished, launch the application in a web browser.
As you can see, the deployment has been successfully completed, and now your application is up and running!
- How to deploy your Spring application to Jelastic cloud (jelastic.com)
- Play! in the Cloud (jelastic.com)
- How to deploy PrimeFaces applications into Jelastic cloud (jelastic.com)