You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by chris j <kr...@zt.zamosc.tpsa.pl> on 2003/05/19 16:02:48 UTC

collections and populating them

Hi

On my JSP page I display the results of Database query

like this:
(mapKJ is in request)
        <html:select property="ko_id">
          <html:option
value="">--select--</html:option>
          <bean:define id="map" name="mapKJ"/>
          <html:options collection="map"
property="key" labelProperty="value"/>
        </html:select>
 and here some other <html:text .......> fields.

The point is that when I validate other text fields and I get back to the
same
JSP page but my collection disapears. And I get an error "Cannot find mapKJx
in
scope request".

My questions are:
Why do I get back to the same page with an error -like above- when
validation fails? (in this case I can't execute any code to get data from
the data base - why is that?)
What happens to my mapKJx collection, ?

Thanks in advance.

Chris


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


Using VO factory pattern in Struts Action class?

Posted by Leon <le...@hotmail.com>.
Hi,

VOs are glue through presentation, business and data tiers and Action class
has resposibilities to convert a FormBean to a VO. Should I implemente a VO
factory pattern and let Action class find a VO in order for decoupling
between client and implementation calsses?
Any suggestion?

Leon

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


Re: collections and populating them

Posted by Caroline Holanda <sp...@yahoo.com>.
 I have a similar issue, but I don't know how to
retrieve the selected itens in a multiple select
option field submitted by the user submitted and the
page should be shown back with an error.

 Please, image that the collection is session scoped,
how are the itens of the list shown when the page gets
back to, I mean, which will itens be shown selected?

 Thanks for any help!
 Caroline 

 --- Denis Avdic <de...@betterway.net> escreveu: > I
had an exact same issue and I overcame it in
> couple of different ways 
> (depending on the case):
> 
> 1st:  If a collection is used across the application
> (States, countries) 
> store it in the context
> 
> 2nd: Otherwise set the input page in the
> struts-config to the setup 
> action, not the jsp
> 
> (IE if you have a submit.jsp and a preSubmit.do,
> then input should be 
> preSubmit.do)
> That way, when the validation fails, it goes back to
> the setup action 
> and prepopulates the form.
> 
> Otherwise you have to store it in the session,
> because... Well, others 
> explained that part already.
> 
> Denis
> 
> chris j wrote:
> 
> >Hi
> >
> >On my JSP page I display the results of Database
> query
> >
> >like this:
> >(mapKJ is in request)
> >        <html:select property="ko_id">
> >          <html:option
> >value="">--select--</html:option>
> >          <bean:define id="map" name="mapKJ"/>
> >          <html:options collection="map"
> >property="key" labelProperty="value"/>
> >        </html:select>
> > and here some other <html:text .......> fields.
> >
> >The point is that when I validate other text fields
> and I get back to the
> >same
> >JSP page but my collection disapears. And I get an
> error "Cannot find mapKJx
> >in
> >scope request".
> >
> >My questions are:
> >Why do I get back to the same page with an error
> -like above- when
> >validation fails? (in this case I can't execute any
> code to get data from
> >the data base - why is that?)
> >What happens to my mapKJx collection, ?
> >
> >Thanks in advance.
> >
> >Chris
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> >
> >
> >
> >  
> >
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>  

=====
******************************
Cuide das pessoas que vc ama! 
Elas são presentes de Deus!

_______________________________________________________________________
Yahoo! Mail
O melhor e-mail gratuito da internet: 6MB de espaço, antivírus, acesso POP3, filtro contra spam. 
http://br.mail.yahoo.com/

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


Re: collections and populating them

Posted by Denis Avdic <de...@betterway.net>.
I had an exact same issue and I overcame it in couple of different ways 
(depending on the case):

1st:  If a collection is used across the application (States, countries) 
store it in the context

2nd: Otherwise set the input page in the struts-config to the setup 
action, not the jsp

(IE if you have a submit.jsp and a preSubmit.do, then input should be 
preSubmit.do)
That way, when the validation fails, it goes back to the setup action 
and prepopulates the form.

Otherwise you have to store it in the session, because... Well, others 
explained that part already.

Denis

chris j wrote:

>Hi
>
>On my JSP page I display the results of Database query
>
>like this:
>(mapKJ is in request)
>        <html:select property="ko_id">
>          <html:option
>value="">--select--</html:option>
>          <bean:define id="map" name="mapKJ"/>
>          <html:options collection="map"
>property="key" labelProperty="value"/>
>        </html:select>
> and here some other <html:text .......> fields.
>
>The point is that when I validate other text fields and I get back to the
>same
>JSP page but my collection disapears. And I get an error "Cannot find mapKJx
>in
>scope request".
>
>My questions are:
>Why do I get back to the same page with an error -like above- when
>validation fails? (in this case I can't execute any code to get data from
>the data base - why is that?)
>What happens to my mapKJx collection, ?
>
>Thanks in advance.
>
>Chris
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>  
>



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