Hello 

Recently I started working on Struts. I'm using Struts 1.0.2 version. 
Struts framework recommends to create separate ActionForm and Action object
for each JSP page.
Instead, I created a single Form object DynaForm which has a HashMap in it.
And I'm using this form object for all the JSP pages in my application. I
downloaded the Struts source. And added following lines of code in 
org.apache.struts.util.PropertyUtils::getSimpleProperty() method


if(bean instanceof DynaForm)
{
        try
        {
                return ((DynaForm)bean).getObject(name);
        }catch(Exception e)
        {
                log.debug(e.getMessage());
                return null;
        }
}

Also I have an XML file which defines the application flow

<?xml version="1.0"?>
<pageflows APP="test">
        <flow>
                <page>index</page>
                <nextpage appname="test">home</nextpage>
        </flow>
        <flow>
                <page>home</page>
                <nextpage appname="test">account</nextpage>
        </flow>
</pageflows>


All nextpage node values are defined in struts-config.xml in
<action-mappings> section. So based on this XML, I decide the application
flow from my Action object. 
I have a single Action object called as ActionHandler which is common across
the entire application.

Each JSP page is assigned to a separate Request Object which does the
business logic specific to that page. Another XML is defined for the mapping
of JSP page and Request object. Based on this XML, ActionHandler executes
exact Request object.

Now my doubts are..

1. First of all, is it advisable to change the Struts code for any reason?
In order to have a single Form object across the entire application, I did
not find any option other than changing Struts code. Is there any better way
of doing this?

2. I'm using Action object as a controller. The job of ActionHandler is to
do some generic stuff like session check, basic form validation and then
calling corresponding Request object. Is it advisable to have a single
Action object across the application? 

Please let me know your ideas on this. Thanks in advance !!


Njoy..
Nilesh

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

Reply via email to