Hello All:

I'd like to request any input and comments that you might have on our design
& efforts to integrate Struts with Expresso (an open-source app framework,
but with a different "tilt" than Struts). Expresso is designed to allow this
kind of integration, and we think it looks like a pretty good fit from our
perspective, but would appreciate any and all comments on what we're doing &
how we're going about it.

Feel free to email me off-list if you prefer, or post to the Forums or
mailing list on our site at http://www.jcorporate.com

We've got an initial plan on how we're going about the integration that was
submitted by one of our contributors on the site at
http://www.jcorporate.com/html/products/expresso/struts_integration.html,
and most of what's discussed in that is either done or well underway. There
are no mods required to Struts itself, and the changes for Expresso are
pretty straightforward.

Thanks!

Regards,

Mike
Jcorporate Ltd.
[EMAIL PROTECTED]
http://www.jcorporate.com






> -----Original Message-----
> From: Torsten Terp [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 19, 2001 5:44 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Long Story short
>
>
> Hi
>
> Dave, let me tell you this, if you are ever in
> my neighborhood beers on me :-)
>
> Finally i got it working, what i didnt realise
> was that i had to split up the action in the
> show and save parts, like you do in your code!
>
> ... so little hair left, for such a small mistake :-)
>
> This is great, thanks a lot!!
>
> ^terp
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 19, 2001 9:05 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Long Story short
>
>
>
>
> Torsten,
>
> Hi.  Please find attached some of my code, as requested in your mail to me
> directly (was not a problem!).  Here's what I do:
>
> I basically call ShowParameters to get the underlying parameters,
> and fill the
> form, which is in Session  scope.  User is then presented with
> parameters.jsp
> (note, this is fairly complicated, but you should be able to
> follow it through).
>
> When they submit the page, SaveParameters is called, and the
> updated parameters
> in the Vector are processed.
>
> Would recommend you try sticking the form in session scope, if you are
> prefilling it in another action.
>
> Let me know if I can help further.
>
> Cheers,
>
> Dave
>
> (See attached file: indexedexample.zip)
>
>
>
> "Torsten Terp" <[EMAIL PROTECTED]> on
> 07/19/2001 05:01:38
> AM
>
> Please respond to [EMAIL PROTECTED]
>
> To:   [EMAIL PROTECTED]
> cc:    (bcc: David Hay/Lex/Lexmark)
> Subject:  Re: Long Story short
>
>
>
> Hi,
>
> Although i have followed the example below i still have the
> problem with saving
> the indexed fields. It is driving me nuts so if anybody who have
> it working
> would
> take the time to see if they can spot the error i will be very
> very greatfull.
>
> The source below is with a vector instead of an array. What
> happens is that when
> the action code is executed the vector in the form is empy
> although the simple
> String
> element is saved alright!
>
> My form looks like this:
>
> public final class ParametersForm extends ActionForm
> {
>    // ---------------------------------------------------
> Instance Variables
>
>           private Vector parameterList = new Vector();
>           private String tester;
>
>    // -----------------------------------------------------------
> Properties
>
>           public String getTester() { return tester; }
>
>           public void setTester(String  v) { this.tester = v; }
>
>           public Vector getParameterList() { return(this.parameterList); }
>
>           public void setParameterList(Vector parameterList) {
> this.parameterList = parameterList; }
>
>           public Parameter getParameter(int index){     return
> (Parameter)parameterList.elementAt(index); }
> }
>
> The Parameter class used for each row:
>
> public class Parameter {
>
>           String key;
>           String desc;
>           String value;
>
>           public String getKey() {return key;}
>           public void setKey(String  v) {this.key = v;}
>
>           public String getDesc() {return desc;}
>           public void setDesc(String  v) {this.desc = v;}
>
>           public String getValue() {return value;}
>           public void setValue(String  v) {this.value = v;}
> }
>
> The action looks like this:
>
> public final class SaveParametersAction extends Action {
>
>     // ---------------------------------------------------------
> Public Methods
>
>     public ActionForward perform(ActionMapping mapping,
>                             ActionForm form,
>                             HttpServletRequest request,
>                             HttpServletResponse response)
>                                throws IOException, ServletException {
>
>                     ParametersForm paramForm = (ParametersForm) form;
>
>                     // Get the simple tester
>                     String test = paramForm.getTester();
>                     System.out.println("paramForm tester was =
> '"+ test + "'");
>
>                     // Get the parameter list
>                     Vector paramList = paramForm.getParameterList();
>                     Parameter parm1 = new Parameter();
>                     parm1 = (Parameter)paramList.elementAt(0);
>
> System.out.println("parm1.getValue():"+parm1.getValue());
>
>                     // Forward control to the specified success URI
>                     return (mapping.findForward("success"));
>           }
> }
>
> My JSP looks like this:
>
>
> <%
>    //cheating to get the objects in the request...
>
>    ParametersForm parametersForm =  new ParametersForm();
>
>    Vector parametersList = new Vector();
>
>    Parameter parameter1 = new Parameter();
>    Parameter parameter2 = new Parameter();
>
>    parameter1.setKey("key0");
>    parameter1.setDesc("desc0");
>    parameter1.setValue("value0");
>    parameter2.setKey("key1");
>    parameter2.setDesc("desc1");
>    parameter2.setValue("value1");
>
>    parametersList.addElement(parameter1);
>    parametersList.addElement(parameter2);
>
>    parametersForm.setParameterList(parametersList);
>    parametersForm.setTester("Testing non-indexed");
>
>    pageContext.setAttribute("parametersForm", parametersForm,
> PageContext.REQUEST_SCOPE);
> %>
>
> <html>
> <head>
> </head>
> <body>
> <html:form action="parameters">
> <table>
>      <logic:iterate id="parameter" name="parametersForm"
> property="parameterList">
>      <tr>
>           <td width="50%">
>                <bean:write name="parameter" property="key"/>
>                <bean:write name="parameter" property="desc"/>
>           </td>
>           <td width="50%">
>                <html:text name="parameter" property="value" indexed="true"
> onchange="validate(this)"/>
>           </td>
>      </tr>
>      </logic:iterate>
>      <tr>
>           <td width="50%">
>                tester:
>           </td>
>           <td width="50%">
>                <html:text name="parametersForm" property="tester"
> onchange="validate(this)"/>
>           </td>
>      </tr>
> </table>
> <html:submit property="submit">submit</html:submit>
> </html:form>
> </body>
> </html>
>
>
> And finally the struts-config.xml elements related to this:
>
> <struts-config>
>
>   <form-beans>
>     <!-- index test -->
>     <form-bean name="parametersForm"
>                type="full.classname.ParametersForm"/>
>   </form-beans>
>
>   <action-mappings>
>     <!-- index test -->
>     <action    path="/parameters"
>                type="full.classname.SaveParametersAction"
>                name="parametersForm"
>                scope="request"
>                input="/parameters.jsp">
>       <forward name="error"                path="/parameters.jsp"/>
>       <forward name="success"              path="/parametersSuccess.jsp"/>
>     </action>
>   </action-mappings>
>
> </struts-config>
>
> I apologize for the long post (i dosnt quite live up to the title
> anymore :-)
>
> I can see from logging that when i press submit the setTester() method is
> called,
> and the getParameter(int index) but not the setValue on the
> parameter, isnt'
> that
> was is supposed to happen, i.e., getParameter(1).setValue("someValue")?
>
> Guys, im on my knees here, can anybody spot the error? If there
> is some more
> info
> you need, just say so!
>
> Thanks _alot_ in advance...
>
> Regards,
> Torsten
>
>
> -----Oprindelig meddelelse-----
> Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sendt: 12. juli 2001 20:00
> Til: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Emne: Re: Long Story short
>
> PLEASE IGNORE LAST POST!!!
>
> Sorry, guys - please ignore my ramblings in the last post.  Was a
> mistake on my
> part converting everything to arrays.
>
> My iteration DOES work with arrays, as well as collections!  As follows:
>
> public final class ParametersForm extends ActionForm
> {
>    // ---------------------------------------------------
> Instance Variables
>
>    /**
>     * The parameter list
>     */
>    private Parameter[] parameterList;
>    // -----------------------------------------------------------
> Properties
>
>    /**
>     * Return the list of parameters
>     */
>    public Parameter[] getParameterList()
>    {
>       return(this.parameterList);
>    }
>
>    /**
>     * Set the list of parameters
>     *
>     * @param parameterList The new list
>     */
>    public void setParameterList(Parameter[] parameterList)
>    {
>       this.parameterList = parameterList;
>    }
>
>    /**
>     * Get a particular parameter from the parameterList, based on index
>     *
>     * @param   index The index of the parameter to retrieve
>     */
>    public Parameter getParameter(int index)
>    {
>       return parameterList[index];
>    }
> }
>
> In parameters.jsp:
>
>       ....
>       <logic:iterate id="parameter" name="ParametersForm"
> property="parameterList">
>       <TR>
>          <TD WIDTH="50%">
>             bean:write name="parameter" property="key"/>
>             <bean:write name="parameter" property="desc"/>
>          </TD>
>          <TD WIDTH="50%">
>                     <html:text name="parameter" property="value"
> indexed="true"
> onchange="validate(this)"/>
>          </TD>
>       </TR>
>       </logic:iterate>
>      ....
>
> In my SaveParametersAction.java I simply get the paramList from
> the form and
> process them...
>
>    public ActionForward perform(ActionMapping mapping,
>                                 ActionForm form,
>                                 HttpServletRequest request,
>                                 HttpServletResponse response)
>    throws IOException, ServletException
>    {
>       ...
>       ParametersForm paramForm = (ParametersForm) form;
>
>       // Get the parameter list
>       Parameter[] paramList = paramForm.getParameterList();
>
>      ...do stuff with paramList
>    }
>
> So, Frank, not sure what you're doing differently!  Maybe you can
> check the code
>  above and see if you spot anything?
>
> Cheers, and sorry for the confusion - too little sleep, I think!
>
> Dave
>
>
>
>
>
>
>
>
>

Reply via email to