Sunday, July 24, 2011

Struts 2 Hello world Example

Hello World Appliction

In this tutorial, we will explain you how to create a simpler Struts 2 application and what are configurations are required before start your application. First we have to follow some fundamental configuration for Struts 2 application. The type of configuration is known as Declarative Architecture.

Declarative architecture is a specialized type of configuration that allows a developer to create an application’s architecture through description rather than programmatic intervention. The developer describes the architectural components in high level artifacts, such as XML files or Java annotations, from which the system will create the run time instance of the application.

Two mechanisms for declaring your architecture
1. XML based declaration architecture
2. Java Annotation based declaration architecture

Lets start with XML architecture :-
The following files are needed for this application.

  1. web.xml
  2. struts.xml
  3. HelloWorld.java
  4. index.jsp
  5. success.jsp
  6. error.jsp

The following picture shows the directory structure of the Hello World application.

















Open your eclipse, create a new Dynamic Web Project with name Struts2HelloWorld




















click on the finish button, Now press Ctrl + R and type web.xml
In the web.xml, use the code of figure in your workspace file

web.xml












struts.xml






HelloWorld.java








index.jsp










success.jsp








error.jsp





40 comments:

  1. Congratulations guys, quality information you have given!!!..Its really useful blog. Thanks for sharing this useful information
    java training institutes in chennai | java j2ee training institutes in velachery

    ReplyDelete
  2. Really very informative and creative contents. This concept is a good way to enhance the knowledge.
    thanks for sharing. please keep it up.
    Struts Training in Gurgaon

    ReplyDelete
  3. Superb article.The information I have been searching Was You Uploaded Exactly. It helped me a lot. Keep coming with more such informative articles. We Would love to follow them.
    big Data Hadoop online training in Bangalore

    ReplyDelete
  4. It seems you are so busy in last month. The detail you shared about your work and it is really impressive that's why i am waiting for your post because i get the new ideas over here and you really write so well.
    Java training in Chennai

    Java training in Bangalore

    ReplyDelete

  5. This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb.
    This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolites festivity to pity. I appreciated what you ok extremely here 


    Selenium training in bangalore
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. nice course. thanks for sharing this post this post harried me a lot.
    Cloud Computing Training in Delhi

    ReplyDelete
  8. This is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.

    Premium Travel Concierge
    Business Travel
    Best wedding Organiser in Delhi Ncr
    Best Luxury Wedding Planners in Delhi

    ReplyDelete
  9. Thank for sharing this knowledgeable information with us.....
    Vashikaran Specialist in Delhi

    ReplyDelete
  10. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
    free classifieds list in UK

    ReplyDelete
  11. Really awesome and nice thanks for sharing this incredible Post ....#
    Buy Women t-shirt online in Delhi

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Aaditri Technology is a leading website design, web development company in Delhi, India we offer custom website development and all types of digital marketing services.
    Travel Website Design Company
    Best Seo Company in Delhi

    ReplyDelete
  18. Dinkcart is famous and reputed company in Delhi/NCR for manufacturing of printed t-shirts. Get customized t shirts for various purpose and occasions.
    T shirt manufacturer in Delhi
    Mom –Son Tees Online

    ReplyDelete
  19. Coin Casino (2021) Review | Games - Casinowow
    Coin Casino 카지노사이트 Review 인카지노 · Slots · Live Casino · Live Dealer · Live Casino · Poker Games · Virtuals 바카라 사이트 · Poker.

    ReplyDelete