Yes.
On 1/30/07, maskkkk <[EMAIL PROTECTED]> wrote:
So another words I should use just a Bible Object (as the form) and than it
should bind automatically both ways?
*From the form (void PropertyEditorSubclass.setAsText(String id))
*To the form (String PropertyEditorSubclass.getAsText(Object bible))
?
Thanks again,
Andrew J. Leer
Matt Raible-3 wrote:
>
> On 1/30/07, maskkkk <[EMAIL PROTECTED]> wrote:
>>
>> Um,
>>
>> I guess I'm afraid that there may be situations in which I need to add
>> more
>> properties to a form. (more than just Bibles) And forms are kind of 2
>> dimensional where as objects are 3 dimensional....*agh* I'm digressing to
>> Struts aren't I?
>
> Yep. ;-)
>
>>
>>
>>
>> Matt Raible-3 wrote:
>> >
>> > Why don't use use your Bible object directly instead of wrapping it in
>> > a BibleForm object?
>> >
>> > Matt
>> >
>> > On 1/30/07, maskkkk <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Let's say I'm populating my form via a given GET request parameter
>> >> (Constants.BIBLE_ID_REQUEST_PARAM) in the formBackingObject method.
>> The
>> >> implementation bellow works. But am I doing it right?
>> >>
>> >> I don't think I am doing it right, only because there are methods in
>> my
>> >> BiblePropertyEditor such as getAsText() which seem as though they
>> should
>> >> do
>> >> the bulk of that work for me, but never get called.
>> >>
>> >>
>> >>
>> >> > /**
>> >> > * Implementation of <strong>SimpleFormController</strong> that
>> >> interacts
>> >> > with
>> >> > * the [EMAIL PROTECTED] OSBManager} to retrieve/persist values to the
>> database.
>> >> > */
>> >> > public class BibleFormController extends BaseFormController {
>> >> >
>> >> > private OsbBaseObjectManager osbBaseObjectMgr;
>> >> >
>> >> > public void setOsbBaseObjectManager(OsbBaseObjectManager
>> >> > osbBaseObjectMgr)
>> >> > {
>> >> > this.osbBaseObjectMgr = osbBaseObjectMgr;
>> >> > }
>> >> >
>> >> > /**
>> >> > * Step 1: In a GET
>> >> > * Step 1: In a POST
>> >> > *
>> >> > * In a GET:
>> >> > * This should return a formbacking object
>> >> > * for populating the display on the front end.
>> >> > */
>> >> > protected Object formBackingObject(HttpServletRequest request)
>> >> > throws Exception
>> >> > {
>> >> > log.info("Begin: formBackingObject");
>> >> > String bibleId = null;
>> >> > BibleForm form = new BibleForm(); // Create the
>> >> form object
>> >> > Bible bible = null;
>> >> >
>> >> > // If the user has clicked a link
>> >> > // requesting to edit an existing Bible...
>> >> > //
>> >> > // ...place that Bible's properties
>> >> > // in the form/command object.
>> >> >
>> >> > bibleId = (String)
>> >> > request.getParameter(Constants.BIBLE_ID_REQUEST_PARAM);
>> >> > log.debug("Request Parameter: " + bibleId);
>> >> > if(bibleId != null)
>> >> > {
>> >> > bible = osbBaseObjectMgr.getBible(bibleId);
>> >> >
>> >> > form.setId("" + bible.getId());
>> >> > form.setLocale(bible.getLocale());
>> >> > form.setVersion(bible.getVersion());
>> >> > }
>> >> >
>> >> > log.info("Exit: formBackingObject");
>> >> > return form;
>> >> > }
>> >> >
>> >> > /**
>> >> > * Step 2: In a GET
>> >> > * Step 2: In a POST
>> >> > *
>> >> > * In a GET:
>> >> > * This method binds the object to the form using
>> >> > * PropertyEditorSupports to associate an
>> >> > * entire object with a primitive value stored in
>> >> > * the form. (PropertyEditorSupports are seprate
>> >> > * implementation classes)
>> >> > *
>> >> > * When we say bind we mean...what the property editor does,
>> >> > * associates an entire object with the values being populated
>> >> > * in the form.
>> >> > *
>> >> > */
>> >> > protected void initBinder(HttpServletRequest request,
>> >> >
>> >> ServletRequestDataBinder binder)
>> >> > {
>> >> > log.info("Begin: initBinder");
>> >> > BiblePropertyEditor propertyEditor = new
>> >> BiblePropertyEditor();
>> >> >
>> propertyEditor.setOsbBaseObjectManger(osbBaseObjectMgr);
>> >> >
>> >> > binder.registerCustomEditor(Bible.class, "bible",
>> >> propertyEditor);
>> >> >
>> >> > super.initBinder(request, binder);
>> >> > log.info("Exit: initBinder");
>> >> > }
>> >> >
>> >> > /**
>> >> > * Step 3: In a GET
>> >> > * This is the place to provide any thing that is
>> >> > * likely to populate othe elements in the view
>> >> > * for instance Lists for dropdowns and tables.
>> >> > *
>> >> > */
>> >> > protected Map referenceData(HttpServletRequest request,
>> >> > Object
>> >> command,
>> >> > Errors
>> >> errors)
>> >> > throws Exception
>> >> > {
>> >> > log.info("Begin: referenceData");
>> >> > Map model = new HashMap();
>> >> >
>> >> > // Nothing at the moment...
>> >> >
>> >> > log.info("Exit: referenceData");
>> >> > return model;
>> >> > }
>> >> > }
>> >> >
>> >>
>> >> Thank you,
>> >> Andrew J. Leer
>> >> --
>> >> View this message in context:
>> >>
>>
http://www.nabble.com/Correct-Controller-Implementation--tf3142315s2369.html#a8709179
>> >> Sent from the AppFuse - User mailing list archive at Nabble.com.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> > --
>> > http://raibledesigns.com
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/Correct-Controller-Implementation--tf3142315s2369.html#a8714200
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> --
> http://raibledesigns.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Correct-Controller-Implementation--tf3142315s2369.html#a8715917
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
http://raibledesigns.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]