View RSS Feed

Struts

Apache Struts is a free open-source framework for creating Java web applications.

  1. Struts 1 vs Struts 2

    by , 11-18-2011 at 06:17 PM (My Java Tips)
    In the following article, we are going to compare the various features between the two frameworks. Struts 2 is very simple as compared to struts 1, few of its important features are:


    1. Servlet Dependency

    Actions in Struts1 have dependencies on the servlet API since the HttpServletRequest and HttpServletResponse objects are passed to the execute method when an Action is invoked while in case of Struts 2, Actions are not container dependent because they are made of simple ...
  2. Struts Controller

    by , 11-18-2011 at 06:13 PM (My Java Tips)
    Let us see how to configure the struts-config.xml file to map the request to some destination servlet or jsp file.


    The class org.apache.struts.action.ActionServlet is at the heart of the Struts Framework. It is the Controller part of the Struts Framework. ActionServlet is configured as Servlet in the web.xml file as shown in the following code.

    <!-- Standard Action Servlet Configuration (with debugging) -->
    Java Code:
    <servlet>
         <servlet-name>action</servlet-name>
    ...
  3. Using Struts2 Tags

    by , 11-18-2011 at 04:59 PM (My Java Tips)
    Struts provides HTML tag library for easy creation of user interfaces. In this lesson I will show you what all Struts HTML Tags are available to the JSP for the development of user interfaces.



    To use the Struts HTML Tags we have to include the following line in our JSP file:
    Java Code:
    &lt;%@ taglib uri="/tags/struts-html" prefix="html" %&gt;
    above code makes available the tag to the jsp.

    Java Code:
    <html:message key="thekey"/>
    ...
    Categories
    Struts
  4. Struts Action Class

    by , 11-15-2011 at 06:39 PM (My Java Tips)
    In this article let us see how to use Struts Action Class and forward a jsp file through it.



    Introduction

    An Action class in the struts application extends Struts 'org.apache.struts.action.Action" Class. Action class acts as wrapper around the business logic and provides an interface to the application's Model layer. It acts as glue between the View and Model layer. It also transfers the data from the view layer to the specific business process layer and ...
  5. Using tags in Struts

    by , 11-15-2011 at 06:26 PM (My Java Tips)
    Web applications differ from conventional websites in that web applications can create a dynamic response. To make it easier to reference dynamic data from a page, the Struts framework offers a set of tags. Some of the tags mimic standard HTML tag while providing added value. Other tags create non-standard, but useful controls. While HTML provides a simple a tag for creating hyperlinks, the HTML tag often requires us to include redundant information. Also the HTML tag cannot easily access dynamic ...
    Categories
    Struts
  6. Struts”Hello World”

    by , 11-15-2011 at 06:15 PM (My Java Tips)
    Lets make a HelloWorld example using Struts.


    Suppose you want to create a simple "Hello World" example that displays a welcome message. To create a "Hello World" example, you need to do three things:

    1. Create a server page HelloWorld.jsp to present the messages

    Java Code:
    &lt;%@ taglib prefix="s" uri="/struts-tags" %&gt;
    <h2><s:property value="message"></s:property></h2>
    ...

    Updated 11-15-2011 at 06:21 PM by Java Tip

    Categories
    Struts
  7. Setup a Struts 2 application

    by , 11-15-2011 at 06:08 PM (My Java Tips)
    in this post, I will write about how to setup a Struts 2 application from scratch. This will be interesting for the developer who are using Struts for the very first time.


    Download the latest struts framework from the http://struts.apache.org. To get started with a new application you can setup a web infrastructure from scratch.

    Setup the Web Application File Structure as follows within webapps folder. (This tutorial assumes that you are using Apache Tomcat as a web ...
  8. Apache Struts

    by , 11-15-2011 at 06:03 PM (My Java Tips)
    Apache Struts is a free open-source framework for creating Java web applications. In this post, I will write about Apache Struts.


    In a standard Java EE web application, the client will typically submit information to the server via a web form. The information is then either handed over to a Java Servlet which processes it, interacts with a database and produces an HTML-formatted response, or it is given to a JavaServer Pages (JSP) document which intermingles HTML and Java code to ...