Dear Struts users:

For a couple of weeks now, I've been trying to use the ProcessAction class
in Struts Scaffold, following the book "Struts in Action" and the example
Artimus application in which it was demonstrated.  It's pretty convenient in
that it simplifies the design of my business logic classes, making them
completely reusable outside of Struts or even a web app.

I just have a number of issues with it that I haven't resolved, despite
having stepped through the source code and closely studying the Artimus app:

1. How do you display a confirmation message when, say, a record was
successfully saved?  I use a ProcessResult to wrap the results, and there is
a method ProcessResult.addMessage() which seems to allow you to add a
message to it.  Here is the snippet of code...

start of Java code snippet ----------------------

        ...

        UserManager manager = getUserManager();
        List users = manager.getAllUsers();

        ResultList resultList = new ResultListBase(users);
        result = new ProcessResultBase(resultList);
        if (resultList.getSize()> 0) {
                result.addMessage("users.found");
                result.addMessage(new Integer(resultList.getSize()));
        } else {
                result.addMessage("users.none.found");
        }
        result.setDispatch("success");

end of Java code snippet ----------------------

and here is the JSP fragment that attempts to display the message...

start of JSP fragment -------------------------

        ...

        <logic:messagesPresent>
           <UL>
           <html:messages id="error">
             <LI><bean:write name="error"/></LI>
           </html:messages>
           </UL>
        </logic:messagesPresent>
        <logic:messagesPresent message="true">
           <UL>
           <html:messages id="message">
             <LI><bean:write name="message"/></LI>
           </html:messages>
           </UL>
        </logic:messagesPresent>

        ...

end of JSP fragment -------------------------

This is a verbatim copy of the message.jsp in the example Artimus
application.  However, when I hit the page, an exception is thrown with the
message "could not find bean message..."

END OF FIRST ISSUE
======================================================================

2. How do you set a transactional token?  From the code in ProcessAction (at
the very end of the preProcess() method), it appears that I have to define a
forward whose name is stored in Tokens.SET_TOKEN for a token to be set.
Does this mean that I have to define a local forward for each data entry
form that I need to guard against multiple submissions?

END OF SECOND ISSUE
=====================================================================

I hope I've explained the issues above clearly.  I've been looking at this
for two weeks, searching through the archives for answers without much
success.  I hope that with this post, someone can give me some clues as to
where to look.

Thank you very much, and a Happy New Year to all!

Noel Lecaros



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

Reply via email to