You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2003/10/11 15:11:58 UTC

communication between control layer & factory/model

I've been happy until now passing objects backwards and forwards between 
my actions and my factories, and occasionally a int with the number of 
updates or deletes done, for example, to include in the status messages 
I show to the user, and throwing exceptions for anything else.

However I've just programmed a page with nested beans and the factory 
does the whole process in one transaction, covering three different 
operations which I would like to give three different status messages for.

In brief it is the realm user admin page and the list of nested beans 
are users - on which the admin op can update the email address, reset 
the password or delete the user entirely.

I want to tell the admin how many of each operation were done. I could 
either pass back an ActionMessages, but I don't want to mix struts into 
my factory layer, or I could pass back a string with different parts:

# of email updates
# of password resets
# of deletions

Which is not exactly elegant, since I have to tokenize it.

Anybody got any better solutions?

Adam

-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Hi Ted, where is scaffold.ExistsAttributeAction??

Posted by Ted Husted <hu...@apache.org>.
The source is under the Struts contrib folders.

Yes, the scaffold package has been stable for some time now.

The next thing might be a similar set of classes that work with the 
Commons Chain package. It would be the same strategy, though: use the 
Action as an adapter to call reusable business layer classes.

-Ted.


ZYD wrote:
> 
> Hi Ted,
>  
> I'm studying your artimus_1_1 codes.
> 
> I'm confused by some scaffold classes, such as org.apache.struts.scaffold.ExistsAttributeAction.
> 
> I cannot find it's source code, compiled class file and it's documentation anywhere. There are some other classes like this one.
> 
> I noticed that scaffold's last update was about one year ago.
> 
> Is scaffold still being working on?
> 
> Sincerely,
> Bruce.

-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Hi Ted, where is scaffold.ExistsAttributeAction??

Posted by ZYD <el...@hotmail.com>.

Hi Ted,
 
I'm studying your artimus_1_1 codes.

I'm confused by some scaffold classes, such as org.apache.struts.scaffold.ExistsAttributeAction.

I cannot find it's source code, compiled class file and it's documentation anywhere. There are some other classes like this one.

I noticed that scaffold's last update was about one year ago.

Is scaffold still being working on?

Sincerely,
Bruce.

Re: communication between control layer & factory/model

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Adam Hardy wrote:

> On 10/11/2003 04:31 PM Ted Husted wrote:
>
>> How about the Commons MessageResources?
>>
>> http://jakarta.apache.org/commons/sandbox/resources/index.html
>>
>> We ported the message collection over there for precisely this 
>> reason.  :)
>>
>> HTH, Ted.
>
>
> That seems to fit the spec perfectly!


One of the tasks along the 1.2 path is to make Struts itself use this 
package, in the same way that we use the beanutils and digester packages 
that were originally in org.apache.struts.util.  Among other things, 
that means we all benefit when additional Resources implementations are 
created for different data sources (like one to read resources from a 
database).

>
> Thanks
> Adam

Craig



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: communication between control layer & factory/model

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
On 10/11/2003 04:31 PM Ted Husted wrote:
> How about the Commons MessageResources?
> 
> http://jakarta.apache.org/commons/sandbox/resources/index.html
> 
> We ported the message collection over there for precisely this reason.  :)
> 
> HTH, Ted.

That seems to fit the spec perfectly!

Thanks
Adam

-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: communication between control layer & factory/model

Posted by Ted Husted <hu...@apache.org>.
How about the Commons MessageResources?

http://jakarta.apache.org/commons/sandbox/resources/index.html

We ported the message collection over there for precisely this reason.  :)

HTH, Ted.

Adam Hardy wrote:

> I've been happy until now passing objects backwards and forwards between 
> my actions and my factories, and occasionally a int with the number of 
> updates or deletes done, for example, to include in the status messages 
> I show to the user, and throwing exceptions for anything else.
> 
> However I've just programmed a page with nested beans and the factory 
> does the whole process in one transaction, covering three different 
> operations which I would like to give three different status messages for.
> 
> In brief it is the realm user admin page and the list of nested beans 
> are users - on which the admin op can update the email address, reset 
> the password or delete the user entirely.
> 
> I want to tell the admin how many of each operation were done. I could 
> either pass back an ActionMessages, but I don't want to mix struts into 
> my factory layer, or I could pass back a string with different parts:
> 
> # of email updates
> # of password resets
> # of deletions
> 
> Which is not exactly elegant, since I have to tokenize it.
> 
> Anybody got any better solutions?
> 
> Adam
> 

-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: communication between control layer & factory/model

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Yes, looked at that, seems the most elegant solution, at least until I 
get my hands on commons messages - I did something like this:

HashMap results = factory.updateAll(conn, users);
msg = new ActionMessage("userAdmin.status.savedEmail",
        "" + results.get(factory.EMAIL_RESULTS_KEY),
        new java.util.Date());
messages.add(ActionMessages.GLOBAL_MESSAGE, msg);
msg = new ActionMessage("userAdmin.status.resetPassword",
        "" + results.get(factory.PASSWORD_RESULTS_KEY),
        new java.util.Date());
messages.add(ActionMessages.GLOBAL_MESSAGE, msg);


On 10/13/2003 07:01 AM Navjot Singh wrote:
> can't you pass a HashMap back?
> 
> 
>>-----Original Message-----
>>From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
>>Sent: Saturday, October 11, 2003 6:42 PM
>>To: Struts Users Mailing List
>>Subject: communication between control layer & factory/model
>>
>>
>>I've been happy until now passing objects backwards and forwards between 
>>my actions and my factories, and occasionally a int with the number of 
>>updates or deletes done, for example, to include in the status messages 
>>I show to the user, and throwing exceptions for anything else.
>>
>>However I've just programmed a page with nested beans and the factory 
>>does the whole process in one transaction, covering three different 
>>operations which I would like to give three different status messages for.
>>
>>In brief it is the realm user admin page and the list of nested beans 
>>are users - on which the admin op can update the email address, reset 
>>the password or delete the user entirely.
>>
>>I want to tell the admin how many of each operation were done. I could 
>>either pass back an ActionMessages, but I don't want to mix struts into 
>>my factory layer, or I could pass back a string with different parts:
>>
>># of email updates
>># of password resets
>># of deletions
>>
>>Which is not exactly elegant, since I have to tokenize it.
>>
>>Anybody got any better solutions?
>>



-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: communication between control layer & factory/model

Posted by Navjot Singh <na...@net4india.net>.
can't you pass a HashMap back?

>-----Original Message-----
>From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
>Sent: Saturday, October 11, 2003 6:42 PM
>To: Struts Users Mailing List
>Subject: communication between control layer & factory/model
>
>
>I've been happy until now passing objects backwards and forwards between 
>my actions and my factories, and occasionally a int with the number of 
>updates or deletes done, for example, to include in the status messages 
>I show to the user, and throwing exceptions for anything else.
>
>However I've just programmed a page with nested beans and the factory 
>does the whole process in one transaction, covering three different 
>operations which I would like to give three different status messages for.
>
>In brief it is the realm user admin page and the list of nested beans 
>are users - on which the admin op can update the email address, reset 
>the password or delete the user entirely.
>
>I want to tell the admin how many of each operation were done. I could 
>either pass back an ActionMessages, but I don't want to mix struts into 
>my factory layer, or I could pass back a string with different parts:
>
># of email updates
># of password resets
># of deletions
>
>Which is not exactly elegant, since I have to tokenize it.
>
>Anybody got any better solutions?
>
>Adam
>
>-- 
>struts 1.1 + tomcat 5.0.12 + java 1.4.2
>Linux 2.4.20 RH9
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org