Did you happen to read through Ted Husted's excellent "Strut by Strut" 
example? If not it helps to pull all the pieces you mention below together. 
You can find it here http://husted.com/about/scaffolding/strutByStrut.htm

I've answered the questions I feel comfortable with.

HTH,
/\/\ark


>
>- struts-config.xml : where we specify the action mappings (local or global 
>forwards that are defined by the Action class). [Q# 1: what exactly do we 
>need to code in this file]
>

You code four things in this file: form-bean definitions, global forwards, 
and action mappings. You can also code data sources here, but this is 
something I haven't done yet. Form-bean definitions are just that - 
information the ActionController uses to know what beans it has available.

Global forwards are symbolic names for physical addresses that can be used 
throughout your application. Coding them in the XML file means that changes 
can be made with out altering your JAVA code.

Action mappings are the guts of your applicaiton. Each one identifies a 
symbolic path to a physical action. Instead of your application using 
physical html links to perform its activity, each link points thru the 
mapping to an Action class that determines what needs to happen next in the 
applicaiton flow.


>- ActionForm Beans: these are specific to each form and mainly have getters 
>and setters, along with validation methods handled by ActionErrors. [Q# 2: 
>are there any other methods that might be performed in the form beans] [Q# 
>3: what exactly is the ActionErrors object?]
>

Typically there is a reset() in the form bean that resets all attributes of 
that bean to their default values. This is used by the Controller, and can 
also be used in your Action classes.

The ActionErrors object is a collection of ActionError objects. This is a 
struts framework object that you use, but most likely won't extend. Each 
error object holds one error. When the Controller calls the validate() if 
any ActionError objects are returned it can re-display the originating JSP 
with the errors displayed for the user. (See Html:error tag in the 
documentation.)


>- ApplicationResources.properties file: defined in the web.xml file, and is 
>used for displaying error messages etc..
>
>- Action classes: the main method here is the perform( ). [Q# 4: I didnt 
>understand what exactly is done by these classes, since the example I 
>referred to showed some real complex code.. I got lost here ..]
>

The Action classes are the guts of your application from the struts 
controller point of view. Typically you would not put business logic in 
these classes, but rather delagate that work to other Java classes that you 
write. We have business objects here that contain the business rules logic. 
The action class calls the appropriate BO class to perform the requested 
function.


>- JSP pages: these would have code using the Struts tag library to access 
>html elements such as forms etc [Q# 5: would i have to learn the syntax of 
>this library before starting .. I am not much conversant with custom 
>taglibs in JSP]
>

Read "JSP and Tag Libraries for Web Development" by da Silva (New Riders 
publishing)


>- Action Servlet: the main controller servlet
>
>- web.xml [Q# 6: do i have to make any changes in this ?]

Yes. You identify the type of action mapping here (extension (*.do) or 
prefix (/do/*)). Also any tag libraries you want to use are identified here. 
You also can control the level of debugging statement printed to the servlet 
log here.


>
>As you might have noticed .. I kind of have the gist of these pieces, but 
>cant put them up together.... to summarize all my Questions, I would put it 
>this way..
>

Download the struts examples, load them, and run them. Start with a simple 
example (page A has a link that displays page B) and build on that. This 
isn't really something you can learn by reading about it, you have to get 
your hands dirty playing around with it. Add one bit at a time and don't 
move on until you understand it. Start with what you are most comfortable 
with and works towards your area of least comfort. I found it especially 
helpful to work with an example from an application I had to build using 
struts. I knew the business domain so I had a framework to hand my struts 
understanding and knowledge on, as I got more understanding I started to 
fill in the gaps in my test application.


/\/\

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to