Hello all, 

 

I am trying to understand how to present an interface where I allow a
user to edit a master/detail relationship using an Ajax technique. I am
quite new to Struts2, so please forgive the dalliance. 

 

I have a form that presents the user the ability to edit the master of
the master/detail, and below the form a list of each of the child
records.  Each child record presents an Ajax enabled link to trigger a
method on the struts action, where I pick out the child record from the
list and put it in the session...

 

The link looks like this:

 

            <s:iterator id="guide" value="guides">

                        <s:url id="editGuide" action="getGuide"
namespace="/datacall" > 

                                    <s:param name="gid"
value="#guide.id" /> 

                        </s:url> 

                        <s:a theme="ajax" href="%{editGuide}"
notifyTopics="updateResult"><s:property
value="#guide.shortDescription"/></s:a> <br/>

            </s:iterator>

 

The method is triggered in the action, and I set the child into my
request session... 

request.getSession().setAttribute("guide", g);

 

And I have a form that I'm trying to bind to the object in the session.
The form is actually hidden in a div/panel I'm using the YUI to present
the form to the user after the round trip to the server.  The form isn't
bound to the correct variable, because its set via a user interaction
after the entire page is presented to the user.

The form looks like this:

 

<s:form theme="ajax" action="updateGuide" method="post">

            <s:hidden name="#session['guide'].id" />

            <s:textfield key="guide.shortDescription"
name="#session['guide'].shortDescription" />

            <s:textarea key="guide.instructions"
name="#session['guide'].instructions" cols="25" rows="8"/>

</s:form>

 

In Struts 1 I would have gotten a terrible error saying that the bean
wasn't found. Now the error fails silently. How can I make the form
somehow bind to the object in the session after the user clicks the
link? 

 

Any help would be much appreciated.

 

MG

 

Reply via email to