Struts”Hello World” (II)

8 January 2008

This post is a continuation of Struts”Hello World” (I). Here I will explain the code that is written in the first part.

Lets see how the code works.

Your browser sends to the web server a request for the URL.

1. The container receives from the web server a request for the resource HelloWorld.action. According to the settings loaded from the web.xml, the container finds that all requests are being routed to org.apache.struts2.dispatcher.FilterDispatcher, including the *.action requests. The FilterDispatcher is the entry point into the framework.

2. The framework looks for an action mapping named “HelloWorld”, and it finds that this mapping corresponds to the class “HelloWorld”. The framework instantiates the Action and calls the Action’s execute method.

3. The execute method sets the message and returns SUCCESS. The framework checks the action mapping to see what page to load if SUCCESS is returned. The framework tells the container to render as the response to the request, the resource HelloWorld.jsp.

4. As the page HelloWorld.jsp is being processed, the tag calls the getter getMessage of the HelloWorld Action, and the tag merges into the response the value of the message.

5. A pure HMTL response is sent back to the browser.

I hope this helps.

del.icio.us:Struts”Hello World” (II)  digg:Struts”Hello World” (II)  spurl:Struts”Hello World” (II)  wists:Struts”Hello World” (II)  simpy:Struts”Hello World” (II)  newsvine:Struts”Hello World” (II)  blinklist:Struts”Hello World” (II)  furl:Struts”Hello World” (II)  reddit:Struts”Hello World” (II)  fark:Struts”Hello World” (II)  blogmarks:Struts”Hello World” (II)  Y!:Struts”Hello World” (II)  smarking:Struts”Hello World” (II)  magnolia:Struts”Hello World” (II)  segnalo:Struts”Hello World” (II)  gifttagging:Struts”Hello World” (II)

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: Struts”Hello World” (II)

Leave a Reply