You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Frank Hamilton <ii...@hotmail.com> on 2009/03/11 19:05:09 UTC

Load html select in cascade.

I need to load some select in cascade.

Example:

    A: Colors            --> if select Colors then -->  B: Blue
             Number                                                               
Red
                .                                                                     
Cian
                .

When I execute my initParameter() in the usecase handler (extend
AbstractUsecase), I load the A options, and the B options is empty. I
setParameter(lstA) and get in jx file.

When change the select with the A options I need to set the options in
select attribute. I prefer not use ajax for this.

Now I use this in jx:
...
<select name="idA" id="A"
  onchange="location.href='?idA='+this.value" >
....

Then I start the usecase again,and in the initParameter() get the request
parameter idA execute my method getAtributeByA(getParameter(idA)). Then I
sent the list of attribute and fill up the B select  in jx.

But need  to set again  A list, or save this in session In the first execute
of usecase to get it in the second execute or usecase.

How can I use a workflow of usecase form keep attributes in usecase.

Can somebody see me an example for this.

Thanks very much.





-- 
View this message in context: http://www.nabble.com/Load-html-select-in-cascade.-tp22461093p22461093.html
Sent from the Lenya - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Load html select in cascade.

Posted by Andreas Hartmann <an...@apache.org>.
Hi Frank,

Frank Hamilton schrieb:
> Thanks Andreas, but I need use a list in usecase parameter, to not destroy
> it when I call advance().
> 
> <component-instance name="modprueba" logger="lenya.usecase.modPrueba"
>       class="org.apache.lenya.cms.modPrueba.ModPrueba">
>      
>       <view uri="modules/modPrueba/usecases/modPrueba.jx" menu="true"/>
>       <parameter name="usecaseParam" value=""/> ---> this I need a list.
> 
> </component-instance>

In this case I'd recommend you to extend the configure() method in your 
usecase handler class. There you can read arbitrary markup from the 
configuration, e.g.

<component-instance name="modprueba" logger="lenya.usecase.modPrueba"
       class="org.apache.lenya.cms.modPrueba.ModPrueba">

   <view uri="modules/modPrueba/usecases/modPrueba.jx" menu="true"/>
   <parameter name="usecaseParam" value=""/> ---> this I need a list.
   <myListName>
     <entry>foo</entry>
     <entry>bar</entry>
     …
   </myListName>
</component-instance>


HTH,

-- Andreas



-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Load html select in cascade.

Posted by Frank Hamilton <ii...@hotmail.com>.


Andreas Hartmann wrote:
> 
> Hi Frank
> 
> Frank Hamilton schrieb:
> 
> […]
> 
>> Can  I pass a java object, like a list, in the usecase param ?
> 
> Sure.
> 
>> how? 
> 
> http://lenya.apache.org/apidocs/2.0/modules/usecase/org/apache/lenya/cms/usecase/Usecase.html#setParameter(java.lang.String,%20java.lang.Object)
> 
> HTH,
> 
> -- Andreas
> 
> 
> -- 
> Andreas Hartmann, CTO
> BeCompany GmbH
> http://www.becompany.ch
> Tel.: +41 (0) 43 818 57 01
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 
> 
> 


Thanks Andreas, but I need use a list in usecase parameter, to not destroy
it when I call advance().

<component-instance name="modprueba" logger="lenya.usecase.modPrueba"
      class="org.apache.lenya.cms.modPrueba.ModPrueba">
     
      <view uri="modules/modPrueba/usecases/modPrueba.jx" menu="true"/>
      <parameter name="usecaseParam" value=""/> ---> this I need a list.

</component-instance>

Althoug the value of this parameter in any state of the usecase is the same
that I defined in module definition.
I need like a form parameter (list) in Struts, that mantain his value in
each call to server. Now I need to save the list in session and  for each
iteration with server I can get it.

Any idea. Thanks





-- 
View this message in context: http://www.nabble.com/Load-html-select-in-cascade.-tp22461093p22555029.html
Sent from the Lenya - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Load html select in cascade.

Posted by Andreas Hartmann <an...@apache.org>.
Hi Frank

Frank Hamilton schrieb:

[…]

> Can  I pass a java object, like a list, in the usecase param ?

Sure.

> how? 

http://lenya.apache.org/apidocs/2.0/modules/usecase/org/apache/lenya/cms/usecase/Usecase.html#setParameter(java.lang.String,%20java.lang.Object)

HTH,

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Load html select in cascade.

Posted by Frank Hamilton <ii...@hotmail.com>.


Andreas Hartmann wrote:
> 
> Thorsten Scherler schrieb:
>> On Wed, 2009-03-11 at 11:05 -0700, Frank Hamilton wrote:
>>> I need to load some select in cascade.
>>>
>>> Example:
>>>
>>>     A: Colors            --> if select Colors then -->  B: Blue
>>>              Number                                                               
>>> Red
>>>                 .                                                                     
>>> Cian
>>>                 .
>>>
>>> When I execute my initParameter() in the usecase handler (extend
>>> AbstractUsecase), I load the A options, and the B options is empty. I
>>> setParameter(lstA) and get in jx file.
>>>
>>> When change the select with the A options I need to set the options in
>>> select attribute. I prefer not use ajax for this.
>>>
>>> Now I use this in jx:
>>> ...
>>> <select name="idA" id="A"
>>>   onchange="location.href='?idA='+this.value" >
>>> ....
>>>
>>> Then I start the usecase again,and in the initParameter() get the
>>> request
>>> parameter idA execute my method getAtributeByA(getParameter(idA)). Then
>>> I
>>> sent the list of attribute and fill up the B select  in jx.
>>>
>>> But need  to set again  A list, or save this in session In the first
>>> execute
>>> of usecase to get it in the second execute or usecase.
>>>
>>> How can I use a workflow of usecase form keep attributes in usecase.
>>>
>>> Can somebody see me an example for this.
>> 
>> As I understand Frank, his problem is that he needs a multiple step
>> usecase and he does not know how to do it.
>> 
>> His example is comparable with the typical car flow example of cocoon,
>> where you select one thing and the next select box depends on that. It
>> would be fairly easy to implement this with custom flow however I am
>> unsure myself how to do this multiple step flow with our usecase
>> framework. 
>> 
>> If somebody has an suggestion or experience how to implement this it
>> would be wonderful to share it.
> 
> 
> http://lenya.apache.org/docu20/reference/usecase-framework/usecase-framework-overview.html
> 
> advance()
> 
> "This method is called to advance the usecase after the a user 
> interaction. In contrast to execute(), this method is not called when 
> the <input type="submit" name="submit"> was pressed, but for every other 
> submitting of the form. A typical usecase is the multiple forms editor 
> where advance() is used to update the document when the user switched to 
> another element."
> 
> All usecase parameters are preserved unless they are explicitly deleted 
> or overwritten. Just be careful not to use fields, because the usecase 
> handler object is destroyed and re-created for each request. BTW, in 
> Lenya 2.2 you can use fields because Spring doesn't require to release 
> the component.
> 
> 
> HTH,
> 
> -- Andreas
> 
> 
> -- 
> Andreas Hartmann, CTO
> BeCompany GmbH
> http://www.becompany.ch
> Tel.: +41 (0) 43 818 57 01
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 
> 
> 

Thank Thorsten and Andreas for reply.

Can  I pass a java object, like a list, in the usecase param ?

how? 

Thanks again.

-- 
View this message in context: http://www.nabble.com/Load-html-select-in-cascade.-tp22461093p22493786.html
Sent from the Lenya - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Load html select in cascade.

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Thu, 2009-03-12 at 14:16 +0100, Andreas Hartmann wrote:
> Thorsten Scherler schrieb:
> >...
> > As I understand Frank, his problem is that he needs a multiple step
> > usecase and he does not know how to do it.
> > 
> > His example is comparable with the typical car flow example of cocoon,
> > where you select one thing and the next select box depends on that. It
> > would be fairly easy to implement this with custom flow however I am
> > unsure myself how to do this multiple step flow with our usecase
> > framework. 
> > 
> > If somebody has an suggestion or experience how to implement this it
> > would be wonderful to share it.
> 
> 
> http://lenya.apache.org/docu20/reference/usecase-framework/usecase-framework-overview.html
> 
> advance()
> 
> "This method is called to advance the usecase after the a user 
> interaction. In contrast to execute(), this method is not called when 
> the <input type="submit" name="submit"> was pressed, but for every other 
> submitting of the form. A typical usecase is the multiple forms editor 
> where advance() is used to update the document when the user switched to 
> another element."
> 
> All usecase parameters are preserved unless they are explicitly deleted 
> or overwritten. Just be careful not to use fields, because the usecase 
> handler object is destroyed and re-created for each request. BTW, in 
> Lenya 2.2 you can use fields because Spring doesn't require to release 
> the component.

Thank you very much Andreas for the pointer, typical case of RTFM. ;)

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Load html select in cascade.

Posted by Andreas Hartmann <an...@apache.org>.
Thorsten Scherler schrieb:
> On Wed, 2009-03-11 at 11:05 -0700, Frank Hamilton wrote:
>> I need to load some select in cascade.
>>
>> Example:
>>
>>     A: Colors            --> if select Colors then -->  B: Blue
>>              Number                                                               
>> Red
>>                 .                                                                     
>> Cian
>>                 .
>>
>> When I execute my initParameter() in the usecase handler (extend
>> AbstractUsecase), I load the A options, and the B options is empty. I
>> setParameter(lstA) and get in jx file.
>>
>> When change the select with the A options I need to set the options in
>> select attribute. I prefer not use ajax for this.
>>
>> Now I use this in jx:
>> ...
>> <select name="idA" id="A"
>>   onchange="location.href='?idA='+this.value" >
>> ....
>>
>> Then I start the usecase again,and in the initParameter() get the request
>> parameter idA execute my method getAtributeByA(getParameter(idA)). Then I
>> sent the list of attribute and fill up the B select  in jx.
>>
>> But need  to set again  A list, or save this in session In the first execute
>> of usecase to get it in the second execute or usecase.
>>
>> How can I use a workflow of usecase form keep attributes in usecase.
>>
>> Can somebody see me an example for this.
> 
> As I understand Frank, his problem is that he needs a multiple step
> usecase and he does not know how to do it.
> 
> His example is comparable with the typical car flow example of cocoon,
> where you select one thing and the next select box depends on that. It
> would be fairly easy to implement this with custom flow however I am
> unsure myself how to do this multiple step flow with our usecase
> framework. 
> 
> If somebody has an suggestion or experience how to implement this it
> would be wonderful to share it.


http://lenya.apache.org/docu20/reference/usecase-framework/usecase-framework-overview.html

advance()

"This method is called to advance the usecase after the a user 
interaction. In contrast to execute(), this method is not called when 
the <input type="submit" name="submit"> was pressed, but for every other 
submitting of the form. A typical usecase is the multiple forms editor 
where advance() is used to update the document when the user switched to 
another element."

All usecase parameters are preserved unless they are explicitly deleted 
or overwritten. Just be careful not to use fields, because the usecase 
handler object is destroyed and re-created for each request. BTW, in 
Lenya 2.2 you can use fields because Spring doesn't require to release 
the component.


HTH,

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Load html select in cascade.

Posted by Thorsten Scherler <th...@apache.org>.
On Wed, 2009-03-11 at 11:05 -0700, Frank Hamilton wrote:
> I need to load some select in cascade.
> 
> Example:
> 
>     A: Colors            --> if select Colors then -->  B: Blue
>              Number                                                               
> Red
>                 .                                                                     
> Cian
>                 .
> 
> When I execute my initParameter() in the usecase handler (extend
> AbstractUsecase), I load the A options, and the B options is empty. I
> setParameter(lstA) and get in jx file.
> 
> When change the select with the A options I need to set the options in
> select attribute. I prefer not use ajax for this.
> 
> Now I use this in jx:
> ...
> <select name="idA" id="A"
>   onchange="location.href='?idA='+this.value" >
> ....
> 
> Then I start the usecase again,and in the initParameter() get the request
> parameter idA execute my method getAtributeByA(getParameter(idA)). Then I
> sent the list of attribute and fill up the B select  in jx.
> 
> But need  to set again  A list, or save this in session In the first execute
> of usecase to get it in the second execute or usecase.
> 
> How can I use a workflow of usecase form keep attributes in usecase.
> 
> Can somebody see me an example for this.

As I understand Frank, his problem is that he needs a multiple step
usecase and he does not know how to do it.

His example is comparable with the typical car flow example of cocoon,
where you select one thing and the next select box depends on that. It
would be fairly easy to implement this with custom flow however I am
unsure myself how to do this multiple step flow with our usecase
framework. 

If somebody has an suggestion or experience how to implement this it
would be wonderful to share it.

TIA

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source <consulting, training and solutions>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org