Hello,

Your CreateMessageAction class should extend
DispatchAction class, and then you should be able to
accomplish your requirement.

See this link:
http://struts.apache.org/api/org/apache/struts/actions/DispatchAction.html

You can have different methods in your DispatchAction
class like "get", "submit" etc.

So, you might have something like this:

public final ActionForward get(
                        ActionMapping mapping,
                        ActionForm form,
                        HttpServletRequest request,
                        HttpServletResponse response)
        throws Exception {
{

// retrieve collection for JSP and store it in the
request.

}

public final ActionForward submit(
                        ActionMapping mapping,
                        ActionForm form,
                        HttpServletRequest request,
                        HttpServletResponse response)
        throws Exception {
{

// do stuff that you do now in your
CreateMessageAction
}

You would also need to configure your
struts-config.xml accordingly.

eg. you might have:

<action    path="/createMessage"
               type="CreateMessageAction"
               name="createMessageForm"
               scope="request"
              input="create.jsp"
           validate="true" parameter="method">        
   
 <forward name="get"
path="/WEB-INF/pages/create.jsp"/>      
<forward name="submit"
path="/WEB-INF/pages/result.jsp"/>        

</action>

HTH,
Shyam


> Hello,
>  
> I have a jsp (create.jsp), a form-bean
> (CreateMessageForm.java), and an action
> (CreateMessageAction.java).
>  
> Currently, the user inputs their info into
> create.jsp, hits 'submit', and the action gets the
> info from the form-bean
> and does stuff with it.  Instead, I would like to
> get some information( collections) from a database
> and populate "create.jsp" with them. So I would like
> to:
>  
> - get a collection from the database
> - put this collection into the request
> - populate create.jsp from the request object
> -  let the user edit the form (including the
> pre-populated parts)
> - hit submit
> - CreateMessageAction gets info from form-bean and
> does stuff...
>  
> Do I have to write a separate Action class for
> putting the collection (from database) into the
> request object?  Or can I somehow incorporate this
> into my current CreateMessageAction class ?
>  
> please help,
> Anna Kerekes
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

Reply via email to