Advertisement :
   Log In    OR    Register  
  Topics :  
RMI Example

Home >>> Struts Struts 2 Example Tutorial >>> Struts2 DOJO >>> Example Tree TreeNode
Struts Tutorials:
Struts2 Tag CheckBoxList
, Checkbox, Iterator, IF
Struts2 Tag Library Example Struts2 Tiles Example Struts2 Tiles I18N Example Struts2 Questions Struts Tiles I18N Example Struts Eclipse MVC Struts2 Tags Struts2 Example and Tutorial Struts MVC Struts2 Validation
Hibernate Tutorials: Hibernate Case Study Class Hierarchy Persist Example Using Hibernate Interceptor Hibernate Questions with Answer Hibernate Many-to-Many Mapping Example Hibernate one-to-many Mapping Example Hibernate and ORM tools Spring Hibernate Example Hibernate SessionFactory Example Hibernate Mapping Class Hierarchy Hibernate Questions Hibernate SessionFactory Questions Spring Hibernate Example: Spring Hibernate Case Study

Written By : Amit
Title :
Struts2 example tutorial
Description : My First example using Apache Struts2
More...


Written By : ISHTEK
Title :
Struts2
Description : Tags such as IF Iterator Tags
More...


Written By : guddu
Title :
Struts Eclipse MVC
Description : Step by step demonstration
More...


Written By : Girish
Title :
Struts Tiles I18N Example
Description : Code with Sample Action
More...


Written By : ISHTEK
Title :
Struts2 questions
Description : open for discussion
More...


Written By : ISHTEK
Title :
Struts2 Tiles Example
Description : with Code and article
More...

Tags/Keywords : Struts, Struts2 Tutorial, Struts 2 Example, Struts2
Author : ISHTEK
Date (Year/Month/Date): 2010-05-28 Using Struts 2 Plugin along with DOJO Tags

Please be informed that NONE of the design/code/matter from this page is claiming to be some
sort of best practice and we DO NOT expect any of our visitor/reader of this page to assume
this as some sort of best practice for any context and should not be using this as it is
without appropriate evaluation.
This page intends only to provide bits and pieces of known ways  for doing some sort of example
and may not be fit for any other purpose.

In spite of all precautions taken to provide accurate and avoid any typo in these pages,
there might be some issues like grammatical mistakes and typo being observed in these pages,
We extend our sincerest apologies for the same.


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.
    
    
    	
    Please write your Comment on this Matter
    (This will be visible if found suitable):
    Name: *
    Email (will not be displayed): *
    Matter: *
    25,25
    Enter bigger number from above :*
    Home >>> Struts Struts 2 Example Tutorial >>> Struts2 DOJO >>> Example Tree TreeNode
    Visitor/User referred related external URL:
    (Visible upon review and approved by this site Administrator)
    
    Referred By Name *:
    Resource URL *: (e.g, URL should be starting with http://www.-----.---)
     
    Resource Short Description *:
    28,33
    Enter bigger number from above : *

    Please log in to add or reply to any matter<- requires login
    Log in or Register
    Copyright © 2008-2010, Interview-Questions-Tips-Forum, All Rights Reserved.
    CONTACT    PRIVACY POLICY    DISCLAIMER
     
    
    Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    Other names may be trademarks of their respective owners
    
    This web site's Terms of Use and Disclaimer :
    
    This web site provides some of the information about various technologies, example code, tips, tutorials etc. Like any printed materials,
    content of these pages may become out of date over a period of time. Therefore all visitor/users of this web site are requested/advised
    to refer to the originating parties/sources for the latest changes and happenings for detailed information. This information is not
    intended to be a substitute for the original reference provided by the originating parties/sources. These examples with source code or
    without source code, have not been thoroughly tested under all conditions. Interview-questions-tips-forum.net therefore, cannot guarantee
    or imply reliability of these example source code or programs.
    
    By accessing and using this website in any ways, including, without limitation, browsing the website pages, using any information, using
    any content and/or downloading any materials, you agree to and are bound by the terms of use described in this page and Usage Terms and Conditions.
    If you do not agree to all of the terms and conditions contained in the terms of use described in this page and
    Usage Terms and Conditions, do not use this website in any manner. If you are using the website on behalf of your
    employer, you represent that you are authorized to accept these Terms of Use on your employer's behalf.
    
    All Trademarks are property of their respective owner. Appropriate measure is being taken for providing accurate and up-to-date
    information but like any printed materials, these blog(s)/contents may eventually be outdated one day, so if you are using any of these
    information, please refer original content/documentation from respective sources. And under no circumstances shall the Author of these
    contents and/or this web site be liable for any loss, damage, expense incurred or suffered which is claimed to have occurred because of
    usage of the contents of this web site. If you have any questions/queries/feedback/suggestions then please write to this web site owner
    at contact.