Hello,

Context:
I'm trying to realise a kind of "log module" that I could use and reuse in
all of my applications.
I'm not talking about log4J or anything that can help me to debug my apps
but this would be logs that record actions in a database and then would be
displayed for client users usage on a JSP page.
For exemple : I make an action that add a record in my db. Later, users
would read on a jsp page that this action has been done by another user at a
certain time. Then he could delete or archive this log, etc.

General issue:
Anyway, my problem is that I would like to execute an action (LogAction
here) just before any action is about to forward into a success target. I
would like to avoid writing code within each of my my actions as well....

Here's in details what I'm planning to do:
I'd like to specify a sort of "set-property" value in my struts-config.xml
like <set-property property="logKey" value="xxxx">
I would set this property in any action I want. Depending on this value, the
action, after being successfully executed, would invoke automatically the
LogAction with the good key value. After that, actionMapping is not
forwarded by the LogAction but by the first action.

exemple:
Let's say we have a SaveAction that I want to log.
- In struts-config, for SaveAction, I add a <forward name="success"
path="actionSaved.jsp"/> and a <set-property property="logKey"
value="saving"/>
- the SaveAction succeeded and just before forwarding to success, it calls a
LogAction.execute() that get the logKey.
- LogAction save the log thanks to the logKey to the db and it gives the
hand back to SaveAction
- SaveAction goes to forward success = actionSaved.jsp


I've found on the net a Struts extension named "Struts Workflow" and I
thought it could help me on this task. But it's not so simple. I loose the
success target value of the first action... I don't know how to sort it out.

The other point of vue would be to change or extend the
ActionMapping.findForward so that it executes automatically some actions
before really forwarding but I don't know how to do.

Does anybody have an idea about what I have to change or extend?

Thank you very much for reading this long mail, I didn't succeeded in being
synthetic.
Kind Regards
Amine



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

Reply via email to