Tech I Enjoy Logo

Custom Search




  Home >> Struts


Using DOJO and Struts2 example :

In this example I shall be showing one of the way to create
a Tree of treenodes using Struts2 Plugin for Dojo.

For this example I am using Struts2 version 2.1.8.1
along with JDK 6 and Tomcat web server 6.0.18 to be
very precise. As I have testing this example only with
the above software versions, I am not sure how this example
will behave in any other versions of Struts 2 Framework.

Now coming back to this example, let me touch upon a very
brief explanation to the objective I am trying to emphasis.

This example is going to create or show a very simple tree
structure like as follows, with some interleaved tree nodes.



This example is about statically supplied tree and tree nodes, this means this tree structure is not controlled by any change in application data, instead this tree is just showing the values those are statically defined/supplied at compile time. Later point of time, I shall definitely find some time to re-create this example tree with some dynamically supplied values from some data store. For now let us try to setup the web application deployment environment using Struts2 Framework along with DOJO specific plugin such as for my example I have used following JAR files under /WEB-INF/lib folder:
  • commons-fileupload-1.2.1.jar
  • commons-io-1.3.2.jar
  • commons-logging-1.1.jar
  • freemarker-2.3.13.jar
  • ognl-2.6.11.jar
  • struts2-core-2.1.8.1.jar
  • struts2-dojo-plugin-2.1.8.1.jar
  • xwork-core-2.1.6.jar
  • As I have used web app 2.3 as the web application descriptor setting and the Struts 2 specific prepare and execute filter needs to be set up in web.xml file: So my example web.xml file for your reference as follows:
    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">
    
    <web-app>
        <display-name>Struts2 & DOJO example</display-name>
      <filter>
      <filter-name>sample-filter</filter-name>
      <filter-class> 
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
      </filter-class>
      </filter>
      <filter-mapping>
        <filter-name>sample-filter</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
    </web-app>
    
    As I havn't used any type server side action as such, so this example is pretty much stripped down to only two example specific files such as sample.jsp and the web.xml: sample.jsp for your reference as follows:
    
    
    <%@ taglib uri="/struts-dojo-tags" prefix="s2d"%>
    <html>
    <head><title></title>
    <s2d:head cache="true"/>
    </head>
    <body>
    <div>
    <s2d:tree id="books" label="Books" title="test" >
      <s2d:treenode label="Java" title="test">
        <s2d:treenode id="Thread-Books" label="Multi-threading" />
        <s2d:treenode id="Thread-Books" label="Core-Java" />
        <s2d:treenode id="Thread-Books" label="Networking" />
      </s2d:treenode>
    </s2d:tree>
    </div>
    </body>
    </html>
    
    So very important points to remember here is one, the entry for the tag library specific to dojo, two, DOJO head tag should be present inside the HTML head tag. Hope this is quite simple enough to try out, without really spending much time on setting up the software environment to start with. If anything missed out , please let me know at techienjoy at yahoo . com
    Apache Struts 2 Radio Tag Example :
    Example Steps of using Struts 2 Radio Tags
    and code explained.
    Apache Struts with DOJO Example Part-4 :
    Example of DOJO Toolkit with Struts and 
    code explained.
    Apache Struts 2 and XSLT With Example :
    XSLT Example using Struts 2 and Example 
    code explained.
    Apache Struts 2 Tags Example :
    Example Steps of using Struts 2 Tags
    and code explained.
    Struts 2 Result Chain Example :
    Example using Result Chain with Struts 2 and 
    code explained.
    Apache Struts 2 Tiles and I18N Example :
    Example Steps of using Struts 2 With Tiles
    and I18N code explained.
    List of Struts Example :
    Examples List using Struts 2 and 
    code explained.
    Apache Struts with DOJO Example Part-3 :
    Example of DOJO Toolkit with Struts and 
    code explained.
    Apache Struts 2 Validation Example :
    Validation Example Steps of using Struts 2
    and Example code explained.
    Apache Struts 2 PDF Result :
    Example Steps of using Struts 2 with PDF Result
    and code explained.
    Apache Struts 2 upload Example :
    Uploading Example Steps of using Struts 2
    and Example code explained.
    Apache Struts 2 Validation With Example :
    Validation Example using Struts 2
    and Example code explained.
    Apache Struts 2 Custom Validator :
    Example Steps of using Struts 2 with Custom Validator
    and code explained.
    Apache Struts with DOJO Example Part-1 :
    Example of DOJO Toolkit with Struts and 
    code explained.
    Apache Struts 2 Example Steps :
    Example Steps of using Struts 2 and code explained.
    Struts 2 Plugin Example :
    Example using Struts 2 Plugin
    Apache Struts Validation with Example :
    Example of Validation using Struts and 
    code explained.
    Apache Struts 2 Result PlainText Example :
    Example Steps of using Struts 2 PlainText Result
    and code explained.
    Apache Struts 2 Tags Example :
    Example of Struts 2 Tags and code explained.
    Apache Struts Date Validation with Example :
    Example of Date Validation using Struts and 
    code explained.
    Struts 2 Tiles and I18N Example :
    Example using Tiles and I18N with Struts 2 and 
    code explained.
    Apache Struts 2 Validation With Expression :
    Validation with Expression using Struts 2
    and Example code explained.
    Struts 2 with JSF Example :
    Example using JSF with Struts 2 and 
    code explained.
    Apache Struts with DOJO Example Part-2 :
    Example of DOJO Toolkit with Struts and 
    code explained.
    Struts Validation Example :
    Example using Validation with Struts 2 and 
    code explained.


    References :
    Tags: Struts 1 Struts2 plugin
    Tags: struts jsf integrate
    Tags: struts result chain
    Tags: struts tiles i18n
    Tags: Struts validation struggle
    Tags: Struts
    Tags: struts1 date validation
    Tags: struts1 struts2 validation
    Tags: struts2 dojo 1
    Tags: struts2 dojo 2
    Tags: struts2 dojo 3
    Tags: struts2 dojo 4
    Tags: Struts2 example steps Tag usage
    Tags: Struts2 example steps
    Tags: struts2 own validator
    Tags: struts2 pdf result
    Tags: struts2 radio tag example
    Tags: struts2 result plaintext
    Tags: struts2 tags example
    Tags: struts2 tiles i18n
    Tags: struts2 upload example
    Tags: struts2 validation 1
    Tags: struts2 validation expression
    Tags: struts2 validation
    Tags: struts2 xslt article
    

    
    
    DISCLAIMER :
    The content provided in this page is not warranted and/or guaranteed by techienjoy.com. 
    techienjoy.com is not liable for any negative consequences that may result/arise from 
    implementing directly/indirectly any information covered in these pages/articles/tutorials.
    
    All contents of this site is/are written and provided on an "AS IS" basis,
    without WARRANTIES or conditions of any kind, either express or implied, including, without
    limitation, merchantability, or fitness for a particular purpose. You are solely responsible
    for determining the appropriateness of using or refering this and assume any risks associated
    with this.
    
    In spite of all precautions taken to avoid any typo in these pages, there might be some 
    issues like grammatical mistakes and typos being observed in these pages, techienjoy.com
    extends sincerest apologies to all our visitors for the same.
    
    
    

    Android Examples || Android Examples

    © Copyright 2010-2012, TECHIENJOY, All Rights Reserved.      Privacy Policy     Disclaimer & Terms & Conditions