You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Carr <ja...@gmail.com> on 2009/08/17 18:39:17 UTC

Using a map provided by the action when using model driven?

Hi,

Maybe I'm missing something, but I am trying to use a map that I have
returned in the action (because the map is read in from a DAO) and
want to use it to populate my select box. My action contains the
method

   public Map<String, String> getFranchises(){
      return franchises.getFranchises();
   }

this method is unit tested and it is impossible for it not to return a
map, it ALWAYS will no matter what.

My select tag looks like this:
<s:select name="franchise" size="1" id="franchises" emptyOption="Make
Selection" list="franchises" />

One note of interest though is I am using the ModelDriven interface
for my action, but I would assume that OGNL would still resolve
against my action in addition to my model. when I load the page, I get
this error:

tag 'select', field 'list', name 'franchise': The requested list key
'franchises' could not be resolved as a
collection/array/map/enumeration/iterator type. Example: people or
people.{name}

Any ideas or help would be apperciated.

Thanks,
James

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using a map provided by the action when using model driven?

Posted by Musachy Barroso <mu...@gmail.com>.
Put a breakpoint in ListUIBean.evaluateExtraParams and you will find
out what is going on.

musachy

On Mon, Aug 17, 2009 at 11:09 AM, James Carr<ja...@gmail.com> wrote:
> I'm giving up and putting it on the model. It doesn't belong there,
> but at least it works. :(
>
>
>
> On Mon, Aug 17, 2009 at 1:06 PM, James Carr<ja...@gmail.com> wrote:
>> I tried #action.franchises and got the same error... is it literally
>> #action, or is it #nameOfActionDefinedInStrutsXml?
>>
>> On Mon, Aug 17, 2009 at 11:43 AM, Musachy Barroso<mu...@gmail.com> wrote:
>>> On Mon, Aug 17, 2009 at 9:39 AM, James Carr<ja...@gmail.com> wrote:
>>>> One note of interest though is I am using the ModelDriven interface
>>>> for my action, but I would assume that OGNL would still resolve
>>>> against my action in addition to my model. when I load the page, I get
>>>> this error:
>>>
>>> Either the action or the model is pushed into the stack, not both. Try
>>> "#action.franchises" that should find the map.
>>>
>>> musachy
>>> --
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using a map provided by the action when using model driven?

Posted by Musachy Barroso <mu...@gmail.com>.
Sending an email asking is a great idea, usually you find the answer 5
minutes later, it is like using Murphy's Law in your favor :)

musachy

On Mon, Aug 17, 2009 at 11:12 AM, James Carr<ja...@gmail.com> wrote:
> Nevermind, I'm a moron... The page I was trying to use it on didn't
> map to an action. :S
>
> Thanks,
> James
>
> On Mon, Aug 17, 2009 at 1:09 PM, James Carr<ja...@gmail.com> wrote:
>> I'm giving up and putting it on the model. It doesn't belong there,
>> but at least it works. :(
>>
>>
>>
>> On Mon, Aug 17, 2009 at 1:06 PM, James Carr<ja...@gmail.com> wrote:
>>> I tried #action.franchises and got the same error... is it literally
>>> #action, or is it #nameOfActionDefinedInStrutsXml?
>>>
>>> On Mon, Aug 17, 2009 at 11:43 AM, Musachy Barroso<mu...@gmail.com> wrote:
>>>> On Mon, Aug 17, 2009 at 9:39 AM, James Carr<ja...@gmail.com> wrote:
>>>>> One note of interest though is I am using the ModelDriven interface
>>>>> for my action, but I would assume that OGNL would still resolve
>>>>> against my action in addition to my model. when I load the page, I get
>>>>> this error:
>>>>
>>>> Either the action or the model is pushed into the stack, not both. Try
>>>> "#action.franchises" that should find the map.
>>>>
>>>> musachy
>>>> --
>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using a map provided by the action when using model driven?

Posted by James Carr <ja...@gmail.com>.
Nevermind, I'm a moron... The page I was trying to use it on didn't
map to an action. :S

Thanks,
James

On Mon, Aug 17, 2009 at 1:09 PM, James Carr<ja...@gmail.com> wrote:
> I'm giving up and putting it on the model. It doesn't belong there,
> but at least it works. :(
>
>
>
> On Mon, Aug 17, 2009 at 1:06 PM, James Carr<ja...@gmail.com> wrote:
>> I tried #action.franchises and got the same error... is it literally
>> #action, or is it #nameOfActionDefinedInStrutsXml?
>>
>> On Mon, Aug 17, 2009 at 11:43 AM, Musachy Barroso<mu...@gmail.com> wrote:
>>> On Mon, Aug 17, 2009 at 9:39 AM, James Carr<ja...@gmail.com> wrote:
>>>> One note of interest though is I am using the ModelDriven interface
>>>> for my action, but I would assume that OGNL would still resolve
>>>> against my action in addition to my model. when I load the page, I get
>>>> this error:
>>>
>>> Either the action or the model is pushed into the stack, not both. Try
>>> "#action.franchises" that should find the map.
>>>
>>> musachy
>>> --
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using a map provided by the action when using model driven?

Posted by James Carr <ja...@gmail.com>.
I'm giving up and putting it on the model. It doesn't belong there,
but at least it works. :(



On Mon, Aug 17, 2009 at 1:06 PM, James Carr<ja...@gmail.com> wrote:
> I tried #action.franchises and got the same error... is it literally
> #action, or is it #nameOfActionDefinedInStrutsXml?
>
> On Mon, Aug 17, 2009 at 11:43 AM, Musachy Barroso<mu...@gmail.com> wrote:
>> On Mon, Aug 17, 2009 at 9:39 AM, James Carr<ja...@gmail.com> wrote:
>>> One note of interest though is I am using the ModelDriven interface
>>> for my action, but I would assume that OGNL would still resolve
>>> against my action in addition to my model. when I load the page, I get
>>> this error:
>>
>> Either the action or the model is pushed into the stack, not both. Try
>> "#action.franchises" that should find the map.
>>
>> musachy
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using a map provided by the action when using model driven?

Posted by James Carr <ja...@gmail.com>.
I tried #action.franchises and got the same error... is it literally
#action, or is it #nameOfActionDefinedInStrutsXml?

On Mon, Aug 17, 2009 at 11:43 AM, Musachy Barroso<mu...@gmail.com> wrote:
> On Mon, Aug 17, 2009 at 9:39 AM, James Carr<ja...@gmail.com> wrote:
>> One note of interest though is I am using the ModelDriven interface
>> for my action, but I would assume that OGNL would still resolve
>> against my action in addition to my model. when I load the page, I get
>> this error:
>
> Either the action or the model is pushed into the stack, not both. Try
> "#action.franchises" that should find the map.
>
> musachy
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using a map provided by the action when using model driven?

Posted by Musachy Barroso <mu...@gmail.com>.
On Mon, Aug 17, 2009 at 9:39 AM, James Carr<ja...@gmail.com> wrote:
> One note of interest though is I am using the ModelDriven interface
> for my action, but I would assume that OGNL would still resolve
> against my action in addition to my model. when I load the page, I get
> this error:

Either the action or the model is pushed into the stack, not both. Try
"#action.franchises" that should find the map.

musachy
-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org