Or you can put the city.id in the form as a hidden
field.
d.
--- "Hernandez, David" <[EMAIL PROTECTED]>
wrote:
>
> Sorry, The problem was that building has a member
> variable that is a
> class (City) which is going out of scope.
> Building.toString() calls
> city.getId() throwing the exception and returning
> null . . .
> Now, to keep that in scope somehow . . .
>
> -----Original Message-----
> From: Hernandez, David
> Sent: Thursday, November 15, 2007 3:12 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Form Submission Question
>
> I'm having a problem with my bean going out of
> scope. The form is
> populated with the bean information fine, but when I
> submit building is
> null? How do I keep it in scope? Do I have to pull
> it back out of the
> ActionContext?
>
> public class BuildingFormTestAction extends
> ActionSupport {
> private static final long serialVersionUID =
> 6692492667406189130L;
> private Building building;
> public String init() throws Exception
> {
> //Fetch Building from db . . .
> return ActionSupport.SUCCESS;
> }
> public String execute() throws Exception
> {
> System.out.println("Submitting: ");
> System.out.println(building);//PRINTS NULL!
> return ActionSupport.SUCCESS;
> }
> public void setBuilding(Building b)
> {
> building = b;
> }
> public Building getBuilding()
> {
> return building;
> }
> }
>
> Here's the JSP Form:
> <s:form action="setBuilding" method="POST">
> <s:push value="building">
> <s:textfield label="Name" name="name" />
> <s:textfield label="Address" name="streetAddress"
> />
> <s:textfield label="Lat" name="latitude" />
> <s:textfield label="Long" name="longitude" />
> <s:checkbox label="Active" name="active" />
> <s:textfield label="Zip" name="zip" />
> <s:submit />
> </s:push>
> </s:form>
>
> And Struts.xml exerpt:
> <action name="form" class="BuildingFormTestAction"
> method="init">
> <result>/buildingFormTest.jsp</result>
> <result name="input">/error.jsp</result>
> </action> <action
> name="setBuilding" class="BuildingFormTestAction"
> method="execute">
> <result>/buildingFormTest.jsp</result>
> <result name="error">/error.jsp</result> </action>
>
> -----Original Message-----
> From: Dave Newton [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 15, 2007 2:20 PM
> To: Struts Users Mailing List
> Subject: Re: Form Submission Question
>
> --- Gary Affonso <[EMAIL PROTECTED]> wrote:
> > Dave Newton wrote:
> >> The action that *processes* the form submission
> may extend
> >> ActionSupport.
> >
> > Dave knows that, of course, but I didn't want the
> emphasis on
> > "*processes*" above to make you think
> ActionSupport was only
> > appropriate for form processing actions.
>
> Yep, that was a good clarificaton to make :)
>
> d.
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
> - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - - - - - - - - - -
>
> This message is intended only for the personal and
> confidential use of the designated recipient(s)
> named above. If you are not the intended recipient
> of this message you are hereby notified that any
> review, dissemination, distribution or copying of
> this message is strictly prohibited. This
> communication is for information purposes only and
> should not be regarded as an offer to sell or as a
> solicitation of an offer to buy any financial
> product, an official confirmation of any
> transaction, or as an official statement of Lehman
> Brothers. Email transmission cannot be guaranteed
> to be secure or error-free. Therefore, we do not
> represent that this information is complete or
> accurate and it should not be relied upon as such.
> All information is subject to change without notice.
>
> --------
> IRS Circular 230 Disclosure:
> Please be advised that any discussion of U.S. tax
> matters contained within this communication
> (including any attachments) is not intended or
> written to be used and cannot be used for the
> purpose of (i) avoiding U.S. tax related penalties
> or (ii) promoting, marketing or recommending to
> another party any transaction or matter addressed
> herein.
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]