In the following, shouldn't you set direction="form" .

>     <parameter name="selected" type="java.util.List"
> required="yes"
> direction="in"/>


Shing 



 --- David Ethell <[EMAIL PROTECTED]> wrote: 
> Update on my problems. This is not a valid solution,
> but it does allow a
> single instance of my control to work on a page. I
> just added this to
> the end of my handleSubmission() method to force the
> selected list to be
> sent back to the page:
> 
>       IPage page = cycle.getPage();
>       page.setProperty("list", selected);
> 
> Of course, that's not generic. It requires a
> property called list on the
> page instead of just setting the object passed to
> the control. So the
> question is, why is my control not updating the
> selected list passed to
> it from the page? My .jwc has this for the selecter
> parameter:
> 
>     <parameter name="selected" type="java.util.List"
> required="yes"
> direction="in"/>
> 
> The .page using it has this for the call to the
> component:
> 
>       <component id="selectSearchTable"
> type="MultiSelectTable">
>          <binding name="model"
> expression="searchParametersSelectionModel"/>
>          <binding name="selected"
> expression="list"/>
>       </component>
> 
> I'll keep plugging away trying to find out why the
> component doesn't
> update the variable from the page.
> 
> David
> 
> -----Original Message-----
> From: David Ethell [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, April 27, 2005 3:39 PM
> To: Tapestry users
> Subject: Problem retrieving object from component on
> submit - similar to
> Palette
> 
> I have a multi select component similar in
> functionality to the Palette
> component, but with a very different presentation.
> 
> I have everything working like I want it except for
> a problem retrieving
> the selected values. Just like Palette this
> component accepts a List
> called selected and I make sure to update the
> selected object on rewind,
> but my page doesn't seem to see the changes.
> 
> Here is my renderComponent method:
>   protected void renderComponent(IMarkupWriter
> writer, IRequestCycle
> cycle)
>   {
>       IForm form =
> Form.get(getPage().getRequestCycle());
> 
>       if (form == null)
>           throw new ApplicationRuntimeException(
>               "MultSelectTable component must be
> wrapped by a Form.",
>               this,
>               null,
>               null);
> 
>       setForm(form);
> 
>       setName(form.getElementId(this));
> 
>       if (form.isRewinding())
>         handleSubmission(cycle);
>       
>       super.renderComponent(writer, cycle);
>   }
> 
> Notice the handleSubmission code just like Palette.
> Here is the
> handleSubmission method:
>   private void handleSubmission(IRequestCycle cycle)
>   {
>       RequestContext context =
> cycle.getRequestContext();
>       String[] values =
> context.getParameters("select_array_id_" +
> getName());
> 
>       int count = Tapestry.size(values);
> 
>       if (count == 0)
>           return;
> 
>       System.out.println("selected table values: " +
> values[0]);
>       
>       List selected = new ArrayList();
>       IPropertySelectionModel model = getModel();
> 
>       //Transform the incoming "}}"-delimited string
> to an array using
> SPLIT
>       String[] valueArray =
> StringUtils.split(values[0], "}}");
>       for (int i = 0; i < valueArray.length; i++)
>       {
>           System.out.println("value " + i + ": " +
> valueArray[i]);
>           String value = valueArray[i];
>           Object option =
> model.translateValue(value);
> 
>           selected.add(option);
>       }
> 
>       setSelected(selected);
>   }
> 
> Where setSelected is abstract and my .jwc has an IN
> parameter defined
> just like the Palette. This all seems to work just
> fine. My System.out
> calls show that the selected values are being
> submitted correctly. Now
> in my page java code I have:
> 
>       public void submit(IRequestCycle cycle) {
>           
>          
>               System.out.println("start of submit");
>               Visit visit = (Visit)getVisit();
>               
>               List list = getList();
>               HashMap hash = new HashMap();
>               
>               //set all selected items recid and 
>               for(int i =0;i<list.size();i++){
>                   ParameterBean b = (ParameterBean) list.get(i);
> 
>                   hash.put(""+b.getRecid(),"Y");
>                 System.out.println("selected field " + i
> + ": " +
> b.getName());
>               }
>               ...
>       }
> 
> This happens to use an implementation of
> IPropertySelectionModel that
> uses our custom ParameterBean. The list object is
> our List that we have
> passed to the component in the .page file. This
> exact same code worked
> just fine with Palette, but doesn't work with the
> new component. The
> list only has the preselected entries in it when it
> gets to the submit
> listener. My system.out calls show that
> handleSubmission from the
> component is finished before the start of the
> submit.
> 
> Any ideas?
> 
> David
> 
> --------------------------------------
> David Ethell
> CTO, Vital Assets, Inc.
> Phone: 800.860.0607 Ex: 102
> Email: [EMAIL PROTECTED]
> 2020 Pennsylvania Avenue NW
> Suite 648
> Washington, DC 20006
> --------------------------------------  
> 
>
---------------------------------------------------------------------
> 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]
> 
> 
=== message truncated === 

Home page :
  http://uk.geocities.com/matmsh/index.html

Send instant messages to your online friends http://uk.messenger.yahoo.com 

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

Reply via email to