You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by fea jabi <zy...@hotmail.com> on 2005/10/27 21:16:00 UTC

how many Form beans

I am new to web development and struts too.

I am trying to create a jsp which has

a text field for display only for Name

and a Table below it with couple of rows and columns in it.


how many form beans do I have to create?

Do I have to create one for the jsp and one for the table alone?

do I have to use nested tag? not really sure. if so how do I have to use 
this in jsp?

I would appreciate if you can help me with the same.

Thanks.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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


Re: how many Form beans

Posted by Murray Collingwood <mu...@focus-computing.com.au>.
Hi

> 1...
> CurrencyValueList form has the attribute list right!!
> 
> can we use that in the logic:iterator using property??
> or is there any specific reason why the list is set to the request?

1. Don't mix your terms.  An attribute is a value you push into the request scope or 
session scope - it is accessible from your JSP code.  The CurrencyValueList is a class, 
extending an ActionForm containing a variable of type List.

You are on the right track though, since we pushed the form bean into the request (and 
in essence the form bean is not a type of List) we do need to use the 'property' 
parameter to access the list.

<logic:iterate name="cvList" property="entries" id="cv" type="CurrencyValue">

> 2...
> In the Struts config. I'll be specifying the formbean to use is 
> CurrencyValueList for that action.
> 
> How will the Jsp know about the CurrencyValue form?   do I have to import 
> this?
> I mean in the statement
> 
> ><logic:iterate name="cvList" id="cv" type="CurrencyValue">

You don't need to import it.

You don't need to specify it as a form bean unless it is part of a JSP page where the 
end-user will enter data to populate the form.  If you are only displaying values then no 
form-bean definition is required.

In my apps the 'type' is always declared fully, for example:
<logic:iterate name="cvList" property="entries" id="cv" 
type="com.abc.website.controller.form.CurrencyValue">

Kind regards
mc


> >From: "Murray Collingwood" <mu...@focus-computing.com.au>
> >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> >To: "Struts Users Mailing List" <us...@struts.apache.org>
> >Subject: Re: how many Form beans
> >Date: Sat, 29 Oct 2005 00:01:32 +1000
> >
> >Hi again
> >
> >
> > > CurrencyValueList must be extending the CurrencyValue right!!
> >
> >No.  CurrencyValueList extends ActionForm.  It contains one property that 
> >is a "List" (as
> >in java.util.List.   This property will contain a list of the 
> >CurencyValues.
> >
> >So, to build this in your Action form you will have some loop that either 
> >reads in values
> >of simply creates blank entries.  I will create 5 blank entries in this 
> >example:
> >
> >List mylist = new ArrayList();
> >for (int ix = 0; ix < 5; ix++) {
> >     CurrencyValue cv = new CurrencyValue();
> >     // if you were reading in values you could assign
> >     // them to the formbean here
> >     mylist.add(cv);
> >}
> >// mylist now contains 5 'CurrencyValue' elements
> >// let's set this list into the other formbean
> >CurrencyValueList cvl = new CurrencyValueList();
> >cvl.setEntries(mylist);
> >// finally we push this CurrencyValueList into the request scope
> >request.setAttribute("cvList", cvl);
> >
> >
> > > CurrencyValueList there are get and set methods for List?
> >
> >Yes, I wrote them for you below.
> >
> > > I created the String[][] in action.
> >
> >Remove it, it's bad.
> >
> > > how to convert that to a List?
> >
> >As above.  I usually use ArrayList().  This supports the abstract class 
> >"Collection" which
> >Struts requires for iterating and also handles methods such as "add()" and 
> >"size()".
> >These two methods will makeup 90% of your list handling.
> >
> >Glad to know this is helping.
> >
> >Kind regards
> >mc
> >
> >
> > > >From: "Murray Collingwood" <mu...@focus-computing.com.au>
> > > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > >To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > >Subject: Re: how many Form beans
> > > >Date: Fri, 28 Oct 2005 23:32:09 +1000
> > > >
> > > >Hi
> > > >
> > > >When I first read the subject line I thought the question was, "How 
> >many
> > > >form beans
> > > >does it take to change a light bulb?"  Maybe this is a question for the
> > > >more advanced
> > > >Struts user - I'm not sure of the answer to that question.  Any ideas 
> >Wendy
> > > >/ Laurie?
> > > >
> > > >I like to keep things simple....I think 'simple' is my favourite word.  
> >You
> > > >really need two
> > > >separate objects.
> > > >
> > > >// Your first object packages a single currency value, including the 
> >type,
> > > >currency and
> > > >// amount.  I have guessed at the types you might use.
> > > >public class CurrencyValue extends ActionForm {
> > > >     private int type;
> > > >     private String currency;
> > > >     private float amount;
> > > >
> > > >     CurrencyValue() {
> > > >     super();
> > > >     }
> > > >
> > > >     // include normal getters and setters here
> > > >}
> > > >
> > > >// The second class is then a simple collection of the above objects
> > > >public class CurrencyValueList extends ActionForm {
> > > >     private List entries;
> > > >
> > > >     CurrencyValueList() {
> > > >     super();
> > > >     }
> > > >
> > > >     public List getEntries() {
> > > >     return entries;
> > > >     }
> > > >     public void setEntries(List entries) {
> > > >     this.entries = entries;
> > > >     }
> > > >}
> > > >
> > > >
> > > >In your action class you then populate the form beans above and push 
> >them
> > > >into the
> > > >request scope (or session scope).  When you push them into the request
> > > >scope you
> > > >provide an identifier name as in "cvList" in the following example:
> > > >
> > > >     request.setAttribute("cvList", currencyValueList);
> > > >
> > > >In your JSP you can then iterate over them using:
> > > >
> > > ><logic:iterate name="cvList" id="cv" type="CurrencyValue">
> > > >   <jsp:getProperty name="cv" property="type"/>
> > > >   <jsp:getProperty name="cv" property="currency"/>
> > > >   <jsp:getProperty name="cv" property="amount"/>
> > > ></logic:iterate>
> > > >
> > > >I hope that helps makes things clearer.
> > > >
> > > >Kind regards
> > > >mc
> > > >
> > > >
> > > >On 28 Oct 2005 at 9:12, fea jabi wrote:
> > > >
> > > > >
> > > > > According to what you suggested
> > > > >
> > > > > I created the below in the action
> > > > > String row1[][] = {{"type1","currency1","amount1"},
> > > > >                             {"type2","currency2","amount2"},
> > > > >                             {"type3","currency3","amount3"},
> > > > >                             {"type4","currency4","amount4"},
> > > > >                             {"type5","currency5","amount5"},
> > > > >                           };
> > > > >
> > > > > and set it's value  to the form bean (i.e Form1) attribute which is
> > > > >
> > > > >     private String[][] rows;
> > > > >
> > > > >     public void setrows(String[][] rows) {
> > > > >         this.rows = rows;
> > > > >     }
> > > > >     public String[][] getrows() {
> > > > >         return rows;
> > > > >     }
> > > > >
> > > > >
> > > > > not really sure how to iterate now in jsp? how do I populated the 
> >data
> > > >now?
> > > > > under the columns type, currency, amount??
> > > > >
> > > > > <logic:iterate id="rowid" property="rows">
> > > > >                     <tr>
> > > > >
> > > > >                     </tr>
> > > > > </logic:iterate>
> > > > >
> > > > >
> > > > > Thanks.
> > > > >
> > > > >
> > > > > >From: Laurie Harper <la...@holoweb.net>
> > > > > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > > > >To: user@struts.apache.org
> > > > > >Subject: Re: how many Form beans
> > > > > >Date: Thu, 27 Oct 2005 22:33:06 -0400
> > > > > >
> > > > > >fea jabi wrote:
> > > > > >>thankyou for your responses.
> > > > > >>
> > > > > >>for my Jsp I created a formbean and for ---- Form1
> > > > > >>with attributes
> > > > > >>name
> > > > > >>row[]
> > > > > >>
> > > > > >>table row in the jsp created another formbean.--- Form2
> > > > > >>with attributes
> > > > > >>type
> > > > > >>currency
> > > > > >>amount
> > > > > >>
> > > > > >>In the action I created dummy data
> > > > > >>Form2[] ----- row[] and set it to the form1 attribute
> > > > > >
> > > > > >I'm not sure I understand what you're doing here. Are you saying 
> >that
> > > >Form1
> > > > > >and Form2 are ActionForm subclasses, and that 'row' in Form1 is an
> > > >array of
> > > > > >Form2 instances? And that the JSP is rendering a single form, part 
> >of
> > > >which
> > > > > >is shown in a table? In that case, Form2 doesn't have to be a form 
> >bean
> > > > > >(ActionForm instance), it can be any arbitrary java bean -- or you
> > > >could
> > > > > >have Form1 declare three arrays named type[], currency[] and 
> >amount[].
> > > > > >
> > > > > >There's lots of options here, depending on exactly what you're 
> >trying
> > > >to
> > > > > >achieve. That said, if I understand what you have then it should 
> >work.
> > > > > >
> > > > > >>Now I am not sure how this row[] values to be displayed using 
> >struts
> > > >in
> > > > > >>the jsp. i mean how to loop thru this to get values.
> > > > > >
> > > > > >To loop through a colllection of values, you would use the
> > > > > ><logic:iteratate> tag from Struts [1] or, if you have it available, 
> >the
> > > > > ><c:forEach> tag from JSTL.
> > > > > >
> > > > > >Maybe you could post your code, JSP and struts-config.xml so we can 
> >see
> > > > > >more clearly what you're doing.
> > > > > >
> > > > > >HTH,
> > > > > >
> > > > > >L.
> > > > > >
> > > > > >[1]
> > > > >
> > > > 
> > >http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#iterate
> > > > > >
> > > > > >>
> > > > > >>I would appreciate your help.
> > > > > >>
> > > > > >>can I do this?? or is there an easier way to display data in 
> >table?
> > > > > >>
> > > > > >>thanks.
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>>From: "Martin Gainty" <mg...@hotmail.com>
> > > > > >>>Reply-To: "Martin Gainty" <mg...@hotmail.com>
> > > > > >>>To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > > > >>>Subject: Re: how many Form beans
> > > > > >>>Date: Thu, 27 Oct 2005 17:16:09 -0400
> > > > > >>>
> > > > > >>>A couple of gotchas concerning TagLibs
> > > > > >>>
> > > > > >>>what version JSP container ?
> > > > > >>>if its 2.0 then consider JSTL 1.1.x tags
> > > > > >>>
> > > > > >>>On the other hand the struts html tag library outstrips anything
> > > > > >>>available from JSTL
> > > > > >>>But if you want performance steer clear Struts logic: tags as 
> >they
> > > >rank
> > > > > >>>slowest of all available Logic Taglibs
> > > > > >>>
> > > > > >>>If you are concerned about being tied into a TagLib that doesnt
> > > > > >>>accomplish everything you want to do go with scriptlets
> > > > > >>>and wait for JSF Tag Library
> > > > > >>>
> > > > > >>>Good Luck,
> > > > > >>>Martin-
> > > > > >>>----- Original Message ----- From: "Laurie Harper"
> > > ><la...@holoweb.net>
> > > > > >>>To: <us...@struts.apache.org>
> > > > > >>>Sent: Thursday, October 27, 2005 3:51 PM
> > > > > >>>Subject: Re: how many Form beans
> > > > > >>>
> > > > > >>>
> > > > > >>>>fea jabi wrote:
> > > > > >>>>
> > > > > >>>>>I am new to web development and struts too.
> > > > > >>>>>
> > > > > >>>>>I am trying to create a jsp which has
> > > > > >>>>>
> > > > > >>>>>a text field for display only for Name
> > > > > >>>>>
> > > > > >>>>>and a Table below it with couple of rows and columns in it.
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>>how many form beans do I have to create?
> > > > > >>>>>
> > > > > >>>>>Do I have to create one for the jsp and one for the table 
> >alone?
> > > > > >>>>>
> > > > > >>>>>do I have to use nested tag? not really sure. if so how do I 
> >have
> > > >to
> > > > > >>>>>use this in jsp?
> > > > > >>>>
> > > > > >>>>
> > > > > >>>>It's really up to you to a large extent. You can have a single 
> >form
> > > >bean
> > > > > >>>>for an entire application if you want. One for each page that 
> >has a
> > > >form
> > > > > >>>>on it is probably typical though.
> > > > > >>>>
> > > > > >>>>The User Guide section on developing view components [1] may 
> >help
> > > >you
> > > > > >>>>get a better overall understanding of what your options are.
> > > > > >>>>
> > > > > >>>>I'm not sure when you say 'nested tags' if you're referring to 
> >the
> > > > > >>>>'nested' tag library, or if you just mean having tags nested 
> >inside
> > > > > >>>>other tags. Assuming the former, no, you don't necessarily need 
> >to
> > > >use
> > > > > >>>>them, though they may make some things easier. I'd suggest 
> >getting
> > > >to
> > > > > >>>>grips with the basics first and then looking at the 'nested' 
> >taglib
> > > > > >>>>again later, when you'll be better able to understand if what it
> > > >offers
> > > > > >>>>applies to what you're doing.
> > > > > >>>>
> > > > > >>>>L.
> > > > > >>>>
> > > > > >>>>[1]
> > > >http://struts.apache.org/struts-core/userGuide/building_view.html
> > > > > >>>>
> > > > > >>>>
> > > > >
> > > > 
> > >>>>---------------------------------------------------------------------
> > > > > >>>>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
> > > > > >>>
> > > > > >>
> > > > >
> > >>_________________________________________________________________
> > > > > >>Is your PC infected? Get a FREE online computer virus scan from
> > > >McAfee®
> > > > > >>Security. 
> >http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > > > > >
> > > > > >
> > > > > >
> > > > > 
> > >---------------------------------------------------------------------
> > > > > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > > >For additional commands, e-mail: user-help@struts.apache.org
> > > > > >
> > > > >
> > > > > 
_________________________________________________________________
> > > > > Don’t just search. Find. Check out the new MSN Search!
> > > > > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> > > > >
> > > > >
> > > > > 
> >---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > > For additional commands, e-mail: user-help@struts.apache.org
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > No virus found in this incoming message.
> > > > > Checked by AVG Free Edition.
> > > > > Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date:
> > > >27/10/2005
> > > > >
> > > >
> > > >
> > > >
> > > >FOCUS Computing - web design
> > > >Mob: 0415 24 26 24
> > > >murray@focus-computing.com.au
> > > >http://www.focus-computing.com.au
> > > >
> > > >
> > > >
> > > >--
> > > >No virus found in this outgoing message.
> > > >Checked by AVG Free Edition.
> > > >Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 
> >27/10/2005
> > > >
> > > >
> > > >---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > >For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > >
> > > _________________________________________________________________
> > > Express yourself instantly with MSN Messenger! Download today - it's 
> >FREE!
> > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> > >
> > > --
> > > No virus found in this incoming message.
> > > Checked by AVG Free Edition.
> > > Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 
> >27/10/2005
> > >
> >
> >
> >
> >FOCUS Computing - web design
> >Mob: 0415 24 26 24
> >murray@focus-computing.com.au
> >http://www.focus-computing.com.au
> >
> >
> >
> >--
> >No virus found in this outgoing message.
> >Checked by AVG Free Edition.
> >Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
> 



FOCUS Computing - web design
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005


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


Re: how many Form beans

Posted by fea jabi <zy...@hotmail.com>.
I have 2 questions.
1...
CurrencyValueList form has the attribute list right!!

can we use that in the logic:iterator using property??
or is there any specific reason why the list is set to the request?

2...
In the Struts config. I'll be specifying the formbean to use is 
CurrencyValueList for that action.

How will the Jsp know about the CurrencyValue form?   do I have to import 
this?
I mean in the statement

><logic:iterate name="cvList" id="cv" type="CurrencyValue">

Thanks.


>From: "Murray Collingwood" <mu...@focus-computing.com.au>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Subject: Re: how many Form beans
>Date: Sat, 29 Oct 2005 00:01:32 +1000
>
>Hi again
>
>
> > CurrencyValueList must be extending the CurrencyValue right!!
>
>No.  CurrencyValueList extends ActionForm.  It contains one property that 
>is a "List" (as
>in java.util.List.   This property will contain a list of the 
>CurencyValues.
>
>So, to build this in your Action form you will have some loop that either 
>reads in values
>of simply creates blank entries.  I will create 5 blank entries in this 
>example:
>
>List mylist = new ArrayList();
>for (int ix = 0; ix < 5; ix++) {
>     CurrencyValue cv = new CurrencyValue();
>     // if you were reading in values you could assign
>     // them to the formbean here
>     mylist.add(cv);
>}
>// mylist now contains 5 'CurrencyValue' elements
>// let's set this list into the other formbean
>CurrencyValueList cvl = new CurrencyValueList();
>cvl.setEntries(mylist);
>// finally we push this CurrencyValueList into the request scope
>request.setAttribute("cvList", cvl);
>
>
> > CurrencyValueList there are get and set methods for List?
>
>Yes, I wrote them for you below.
>
> > I created the String[][] in action.
>
>Remove it, it's bad.
>
> > how to convert that to a List?
>
>As above.  I usually use ArrayList().  This supports the abstract class 
>"Collection" which
>Struts requires for iterating and also handles methods such as "add()" and 
>"size()".
>These two methods will makeup 90% of your list handling.
>
>Glad to know this is helping.
>
>Kind regards
>mc
>
>
> > >From: "Murray Collingwood" <mu...@focus-computing.com.au>
> > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >Subject: Re: how many Form beans
> > >Date: Fri, 28 Oct 2005 23:32:09 +1000
> > >
> > >Hi
> > >
> > >When I first read the subject line I thought the question was, "How 
>many
> > >form beans
> > >does it take to change a light bulb?"  Maybe this is a question for the
> > >more advanced
> > >Struts user - I'm not sure of the answer to that question.  Any ideas 
>Wendy
> > >/ Laurie?
> > >
> > >I like to keep things simple....I think 'simple' is my favourite word.  
>You
> > >really need two
> > >separate objects.
> > >
> > >// Your first object packages a single currency value, including the 
>type,
> > >currency and
> > >// amount.  I have guessed at the types you might use.
> > >public class CurrencyValue extends ActionForm {
> > >     private int type;
> > >     private String currency;
> > >     private float amount;
> > >
> > >     CurrencyValue() {
> > >     super();
> > >     }
> > >
> > >     // include normal getters and setters here
> > >}
> > >
> > >// The second class is then a simple collection of the above objects
> > >public class CurrencyValueList extends ActionForm {
> > >     private List entries;
> > >
> > >     CurrencyValueList() {
> > >     super();
> > >     }
> > >
> > >     public List getEntries() {
> > >     return entries;
> > >     }
> > >     public void setEntries(List entries) {
> > >     this.entries = entries;
> > >     }
> > >}
> > >
> > >
> > >In your action class you then populate the form beans above and push 
>them
> > >into the
> > >request scope (or session scope).  When you push them into the request
> > >scope you
> > >provide an identifier name as in "cvList" in the following example:
> > >
> > >     request.setAttribute("cvList", currencyValueList);
> > >
> > >In your JSP you can then iterate over them using:
> > >
> > ><logic:iterate name="cvList" id="cv" type="CurrencyValue">
> > >   <jsp:getProperty name="cv" property="type"/>
> > >   <jsp:getProperty name="cv" property="currency"/>
> > >   <jsp:getProperty name="cv" property="amount"/>
> > ></logic:iterate>
> > >
> > >I hope that helps makes things clearer.
> > >
> > >Kind regards
> > >mc
> > >
> > >
> > >On 28 Oct 2005 at 9:12, fea jabi wrote:
> > >
> > > >
> > > > According to what you suggested
> > > >
> > > > I created the below in the action
> > > > String row1[][] = {{"type1","currency1","amount1"},
> > > >                             {"type2","currency2","amount2"},
> > > >                             {"type3","currency3","amount3"},
> > > >                             {"type4","currency4","amount4"},
> > > >                             {"type5","currency5","amount5"},
> > > >                           };
> > > >
> > > > and set it's value  to the form bean (i.e Form1) attribute which is
> > > >
> > > >     private String[][] rows;
> > > >
> > > >     public void setrows(String[][] rows) {
> > > >         this.rows = rows;
> > > >     }
> > > >     public String[][] getrows() {
> > > >         return rows;
> > > >     }
> > > >
> > > >
> > > > not really sure how to iterate now in jsp? how do I populated the 
>data
> > >now?
> > > > under the columns type, currency, amount??
> > > >
> > > > <logic:iterate id="rowid" property="rows">
> > > >                     <tr>
> > > >
> > > >                     </tr>
> > > > </logic:iterate>
> > > >
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > >From: Laurie Harper <la...@holoweb.net>
> > > > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > > >To: user@struts.apache.org
> > > > >Subject: Re: how many Form beans
> > > > >Date: Thu, 27 Oct 2005 22:33:06 -0400
> > > > >
> > > > >fea jabi wrote:
> > > > >>thankyou for your responses.
> > > > >>
> > > > >>for my Jsp I created a formbean and for ---- Form1
> > > > >>with attributes
> > > > >>name
> > > > >>row[]
> > > > >>
> > > > >>table row in the jsp created another formbean.--- Form2
> > > > >>with attributes
> > > > >>type
> > > > >>currency
> > > > >>amount
> > > > >>
> > > > >>In the action I created dummy data
> > > > >>Form2[] ----- row[] and set it to the form1 attribute
> > > > >
> > > > >I'm not sure I understand what you're doing here. Are you saying 
>that
> > >Form1
> > > > >and Form2 are ActionForm subclasses, and that 'row' in Form1 is an
> > >array of
> > > > >Form2 instances? And that the JSP is rendering a single form, part 
>of
> > >which
> > > > >is shown in a table? In that case, Form2 doesn't have to be a form 
>bean
> > > > >(ActionForm instance), it can be any arbitrary java bean -- or you
> > >could
> > > > >have Form1 declare three arrays named type[], currency[] and 
>amount[].
> > > > >
> > > > >There's lots of options here, depending on exactly what you're 
>trying
> > >to
> > > > >achieve. That said, if I understand what you have then it should 
>work.
> > > > >
> > > > >>Now I am not sure how this row[] values to be displayed using 
>struts
> > >in
> > > > >>the jsp. i mean how to loop thru this to get values.
> > > > >
> > > > >To loop through a colllection of values, you would use the
> > > > ><logic:iteratate> tag from Struts [1] or, if you have it available, 
>the
> > > > ><c:forEach> tag from JSTL.
> > > > >
> > > > >Maybe you could post your code, JSP and struts-config.xml so we can 
>see
> > > > >more clearly what you're doing.
> > > > >
> > > > >HTH,
> > > > >
> > > > >L.
> > > > >
> > > > >[1]
> > > >
> > > 
> >http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#iterate
> > > > >
> > > > >>
> > > > >>I would appreciate your help.
> > > > >>
> > > > >>can I do this?? or is there an easier way to display data in 
>table?
> > > > >>
> > > > >>thanks.
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>>From: "Martin Gainty" <mg...@hotmail.com>
> > > > >>>Reply-To: "Martin Gainty" <mg...@hotmail.com>
> > > > >>>To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > > >>>Subject: Re: how many Form beans
> > > > >>>Date: Thu, 27 Oct 2005 17:16:09 -0400
> > > > >>>
> > > > >>>A couple of gotchas concerning TagLibs
> > > > >>>
> > > > >>>what version JSP container ?
> > > > >>>if its 2.0 then consider JSTL 1.1.x tags
> > > > >>>
> > > > >>>On the other hand the struts html tag library outstrips anything
> > > > >>>available from JSTL
> > > > >>>But if you want performance steer clear Struts logic: tags as 
>they
> > >rank
> > > > >>>slowest of all available Logic Taglibs
> > > > >>>
> > > > >>>If you are concerned about being tied into a TagLib that doesnt
> > > > >>>accomplish everything you want to do go with scriptlets
> > > > >>>and wait for JSF Tag Library
> > > > >>>
> > > > >>>Good Luck,
> > > > >>>Martin-
> > > > >>>----- Original Message ----- From: "Laurie Harper"
> > ><la...@holoweb.net>
> > > > >>>To: <us...@struts.apache.org>
> > > > >>>Sent: Thursday, October 27, 2005 3:51 PM
> > > > >>>Subject: Re: how many Form beans
> > > > >>>
> > > > >>>
> > > > >>>>fea jabi wrote:
> > > > >>>>
> > > > >>>>>I am new to web development and struts too.
> > > > >>>>>
> > > > >>>>>I am trying to create a jsp which has
> > > > >>>>>
> > > > >>>>>a text field for display only for Name
> > > > >>>>>
> > > > >>>>>and a Table below it with couple of rows and columns in it.
> > > > >>>>>
> > > > >>>>>
> > > > >>>>>how many form beans do I have to create?
> > > > >>>>>
> > > > >>>>>Do I have to create one for the jsp and one for the table 
>alone?
> > > > >>>>>
> > > > >>>>>do I have to use nested tag? not really sure. if so how do I 
>have
> > >to
> > > > >>>>>use this in jsp?
> > > > >>>>
> > > > >>>>
> > > > >>>>It's really up to you to a large extent. You can have a single 
>form
> > >bean
> > > > >>>>for an entire application if you want. One for each page that 
>has a
> > >form
> > > > >>>>on it is probably typical though.
> > > > >>>>
> > > > >>>>The User Guide section on developing view components [1] may 
>help
> > >you
> > > > >>>>get a better overall understanding of what your options are.
> > > > >>>>
> > > > >>>>I'm not sure when you say 'nested tags' if you're referring to 
>the
> > > > >>>>'nested' tag library, or if you just mean having tags nested 
>inside
> > > > >>>>other tags. Assuming the former, no, you don't necessarily need 
>to
> > >use
> > > > >>>>them, though they may make some things easier. I'd suggest 
>getting
> > >to
> > > > >>>>grips with the basics first and then looking at the 'nested' 
>taglib
> > > > >>>>again later, when you'll be better able to understand if what it
> > >offers
> > > > >>>>applies to what you're doing.
> > > > >>>>
> > > > >>>>L.
> > > > >>>>
> > > > >>>>[1]
> > >http://struts.apache.org/struts-core/userGuide/building_view.html
> > > > >>>>
> > > > >>>>
> > > >
> > > 
> >>>>---------------------------------------------------------------------
> > > > >>>>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
> > > > >>>
> > > > >>
> > > >
> >>_________________________________________________________________
> > > > >>Is your PC infected? Get a FREE online computer virus scan from
> > >McAfeeŽ
> > > > >>Security. 
>http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > > > >
> > > > >
> > > > >
> > > > 
> >---------------------------------------------------------------------
> > > > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > >For additional commands, e-mail: user-help@struts.apache.org
> > > > >
> > > >
> > > > _________________________________________________________________
> > > > Don’t just search. Find. Check out the new MSN Search!
> > > > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> > > >
> > > >
> > > > 
>---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > > >
> > > >
> > > > --
> > > > No virus found in this incoming message.
> > > > Checked by AVG Free Edition.
> > > > Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date:
> > >27/10/2005
> > > >
> > >
> > >
> > >
> > >FOCUS Computing - web design
> > >Mob: 0415 24 26 24
> > >murray@focus-computing.com.au
> > >http://www.focus-computing.com.au
> > >
> > >
> > >
> > >--
> > >No virus found in this outgoing message.
> > >Checked by AVG Free Edition.
> > >Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 
>27/10/2005
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >For additional commands, e-mail: user-help@struts.apache.org
> > >
> >
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today - it's 
>FREE!
> > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 
>27/10/2005
> >
>
>
>
>FOCUS Computing - web design
>Mob: 0415 24 26 24
>murray@focus-computing.com.au
>http://www.focus-computing.com.au
>
>
>
>--
>No virus found in this outgoing message.
>Checked by AVG Free Edition.
>Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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


Re: how many Form beans

Posted by fea jabi <zy...@hotmail.com>.
Thanksyou all for helping me thru this. I've got it working now.



>From: "Murray Collingwood" <mu...@focus-computing.com.au>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Subject: Re: how many Form beans
>Date: Sat, 29 Oct 2005 00:01:32 +1000
>
>Hi again
>
>
> > CurrencyValueList must be extending the CurrencyValue right!!
>
>No.  CurrencyValueList extends ActionForm.  It contains one property that 
>is a "List" (as
>in java.util.List.   This property will contain a list of the 
>CurencyValues.
>
>So, to build this in your Action form you will have some loop that either 
>reads in values
>of simply creates blank entries.  I will create 5 blank entries in this 
>example:
>
>List mylist = new ArrayList();
>for (int ix = 0; ix < 5; ix++) {
>     CurrencyValue cv = new CurrencyValue();
>     // if you were reading in values you could assign
>     // them to the formbean here
>     mylist.add(cv);
>}
>// mylist now contains 5 'CurrencyValue' elements
>// let's set this list into the other formbean
>CurrencyValueList cvl = new CurrencyValueList();
>cvl.setEntries(mylist);
>// finally we push this CurrencyValueList into the request scope
>request.setAttribute("cvList", cvl);
>
>
> > CurrencyValueList there are get and set methods for List?
>
>Yes, I wrote them for you below.
>
> > I created the String[][] in action.
>
>Remove it, it's bad.
>
> > how to convert that to a List?
>
>As above.  I usually use ArrayList().  This supports the abstract class 
>"Collection" which
>Struts requires for iterating and also handles methods such as "add()" and 
>"size()".
>These two methods will makeup 90% of your list handling.
>
>Glad to know this is helping.
>
>Kind regards
>mc
>
>
> > >From: "Murray Collingwood" <mu...@focus-computing.com.au>
> > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >Subject: Re: how many Form beans
> > >Date: Fri, 28 Oct 2005 23:32:09 +1000
> > >
> > >Hi
> > >
> > >When I first read the subject line I thought the question was, "How 
>many
> > >form beans
> > >does it take to change a light bulb?"  Maybe this is a question for the
> > >more advanced
> > >Struts user - I'm not sure of the answer to that question.  Any ideas 
>Wendy
> > >/ Laurie?
> > >
> > >I like to keep things simple....I think 'simple' is my favourite word.  
>You
> > >really need two
> > >separate objects.
> > >
> > >// Your first object packages a single currency value, including the 
>type,
> > >currency and
> > >// amount.  I have guessed at the types you might use.
> > >public class CurrencyValue extends ActionForm {
> > >     private int type;
> > >     private String currency;
> > >     private float amount;
> > >
> > >     CurrencyValue() {
> > >     super();
> > >     }
> > >
> > >     // include normal getters and setters here
> > >}
> > >
> > >// The second class is then a simple collection of the above objects
> > >public class CurrencyValueList extends ActionForm {
> > >     private List entries;
> > >
> > >     CurrencyValueList() {
> > >     super();
> > >     }
> > >
> > >     public List getEntries() {
> > >     return entries;
> > >     }
> > >     public void setEntries(List entries) {
> > >     this.entries = entries;
> > >     }
> > >}
> > >
> > >
> > >In your action class you then populate the form beans above and push 
>them
> > >into the
> > >request scope (or session scope).  When you push them into the request
> > >scope you
> > >provide an identifier name as in "cvList" in the following example:
> > >
> > >     request.setAttribute("cvList", currencyValueList);
> > >
> > >In your JSP you can then iterate over them using:
> > >
> > ><logic:iterate name="cvList" id="cv" type="CurrencyValue">
> > >   <jsp:getProperty name="cv" property="type"/>
> > >   <jsp:getProperty name="cv" property="currency"/>
> > >   <jsp:getProperty name="cv" property="amount"/>
> > ></logic:iterate>
> > >
> > >I hope that helps makes things clearer.
> > >
> > >Kind regards
> > >mc
> > >
> > >
> > >On 28 Oct 2005 at 9:12, fea jabi wrote:
> > >
> > > >
> > > > According to what you suggested
> > > >
> > > > I created the below in the action
> > > > String row1[][] = {{"type1","currency1","amount1"},
> > > >                             {"type2","currency2","amount2"},
> > > >                             {"type3","currency3","amount3"},
> > > >                             {"type4","currency4","amount4"},
> > > >                             {"type5","currency5","amount5"},
> > > >                           };
> > > >
> > > > and set it's value  to the form bean (i.e Form1) attribute which is
> > > >
> > > >     private String[][] rows;
> > > >
> > > >     public void setrows(String[][] rows) {
> > > >         this.rows = rows;
> > > >     }
> > > >     public String[][] getrows() {
> > > >         return rows;
> > > >     }
> > > >
> > > >
> > > > not really sure how to iterate now in jsp? how do I populated the 
>data
> > >now?
> > > > under the columns type, currency, amount??
> > > >
> > > > <logic:iterate id="rowid" property="rows">
> > > >                     <tr>
> > > >
> > > >                     </tr>
> > > > </logic:iterate>
> > > >
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > >From: Laurie Harper <la...@holoweb.net>
> > > > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > > >To: user@struts.apache.org
> > > > >Subject: Re: how many Form beans
> > > > >Date: Thu, 27 Oct 2005 22:33:06 -0400
> > > > >
> > > > >fea jabi wrote:
> > > > >>thankyou for your responses.
> > > > >>
> > > > >>for my Jsp I created a formbean and for ---- Form1
> > > > >>with attributes
> > > > >>name
> > > > >>row[]
> > > > >>
> > > > >>table row in the jsp created another formbean.--- Form2
> > > > >>with attributes
> > > > >>type
> > > > >>currency
> > > > >>amount
> > > > >>
> > > > >>In the action I created dummy data
> > > > >>Form2[] ----- row[] and set it to the form1 attribute
> > > > >
> > > > >I'm not sure I understand what you're doing here. Are you saying 
>that
> > >Form1
> > > > >and Form2 are ActionForm subclasses, and that 'row' in Form1 is an
> > >array of
> > > > >Form2 instances? And that the JSP is rendering a single form, part 
>of
> > >which
> > > > >is shown in a table? In that case, Form2 doesn't have to be a form 
>bean
> > > > >(ActionForm instance), it can be any arbitrary java bean -- or you
> > >could
> > > > >have Form1 declare three arrays named type[], currency[] and 
>amount[].
> > > > >
> > > > >There's lots of options here, depending on exactly what you're 
>trying
> > >to
> > > > >achieve. That said, if I understand what you have then it should 
>work.
> > > > >
> > > > >>Now I am not sure how this row[] values to be displayed using 
>struts
> > >in
> > > > >>the jsp. i mean how to loop thru this to get values.
> > > > >
> > > > >To loop through a colllection of values, you would use the
> > > > ><logic:iteratate> tag from Struts [1] or, if you have it available, 
>the
> > > > ><c:forEach> tag from JSTL.
> > > > >
> > > > >Maybe you could post your code, JSP and struts-config.xml so we can 
>see
> > > > >more clearly what you're doing.
> > > > >
> > > > >HTH,
> > > > >
> > > > >L.
> > > > >
> > > > >[1]
> > > >
> > > 
> >http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#iterate
> > > > >
> > > > >>
> > > > >>I would appreciate your help.
> > > > >>
> > > > >>can I do this?? or is there an easier way to display data in 
>table?
> > > > >>
> > > > >>thanks.
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>>From: "Martin Gainty" <mg...@hotmail.com>
> > > > >>>Reply-To: "Martin Gainty" <mg...@hotmail.com>
> > > > >>>To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > > >>>Subject: Re: how many Form beans
> > > > >>>Date: Thu, 27 Oct 2005 17:16:09 -0400
> > > > >>>
> > > > >>>A couple of gotchas concerning TagLibs
> > > > >>>
> > > > >>>what version JSP container ?
> > > > >>>if its 2.0 then consider JSTL 1.1.x tags
> > > > >>>
> > > > >>>On the other hand the struts html tag library outstrips anything
> > > > >>>available from JSTL
> > > > >>>But if you want performance steer clear Struts logic: tags as 
>they
> > >rank
> > > > >>>slowest of all available Logic Taglibs
> > > > >>>
> > > > >>>If you are concerned about being tied into a TagLib that doesnt
> > > > >>>accomplish everything you want to do go with scriptlets
> > > > >>>and wait for JSF Tag Library
> > > > >>>
> > > > >>>Good Luck,
> > > > >>>Martin-
> > > > >>>----- Original Message ----- From: "Laurie Harper"
> > ><la...@holoweb.net>
> > > > >>>To: <us...@struts.apache.org>
> > > > >>>Sent: Thursday, October 27, 2005 3:51 PM
> > > > >>>Subject: Re: how many Form beans
> > > > >>>
> > > > >>>
> > > > >>>>fea jabi wrote:
> > > > >>>>
> > > > >>>>>I am new to web development and struts too.
> > > > >>>>>
> > > > >>>>>I am trying to create a jsp which has
> > > > >>>>>
> > > > >>>>>a text field for display only for Name
> > > > >>>>>
> > > > >>>>>and a Table below it with couple of rows and columns in it.
> > > > >>>>>
> > > > >>>>>
> > > > >>>>>how many form beans do I have to create?
> > > > >>>>>
> > > > >>>>>Do I have to create one for the jsp and one for the table 
>alone?
> > > > >>>>>
> > > > >>>>>do I have to use nested tag? not really sure. if so how do I 
>have
> > >to
> > > > >>>>>use this in jsp?
> > > > >>>>
> > > > >>>>
> > > > >>>>It's really up to you to a large extent. You can have a single 
>form
> > >bean
> > > > >>>>for an entire application if you want. One for each page that 
>has a
> > >form
> > > > >>>>on it is probably typical though.
> > > > >>>>
> > > > >>>>The User Guide section on developing view components [1] may 
>help
> > >you
> > > > >>>>get a better overall understanding of what your options are.
> > > > >>>>
> > > > >>>>I'm not sure when you say 'nested tags' if you're referring to 
>the
> > > > >>>>'nested' tag library, or if you just mean having tags nested 
>inside
> > > > >>>>other tags. Assuming the former, no, you don't necessarily need 
>to
> > >use
> > > > >>>>them, though they may make some things easier. I'd suggest 
>getting
> > >to
> > > > >>>>grips with the basics first and then looking at the 'nested' 
>taglib
> > > > >>>>again later, when you'll be better able to understand if what it
> > >offers
> > > > >>>>applies to what you're doing.
> > > > >>>>
> > > > >>>>L.
> > > > >>>>
> > > > >>>>[1]
> > >http://struts.apache.org/struts-core/userGuide/building_view.html
> > > > >>>>
> > > > >>>>
> > > >
> > > 
> >>>>---------------------------------------------------------------------
> > > > >>>>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
> > > > >>>
> > > > >>
> > > >
> >>_________________________________________________________________
> > > > >>Is your PC infected? Get a FREE online computer virus scan from
> > >McAfeeŽ
> > > > >>Security. 
>http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > > > >
> > > > >
> > > > >
> > > > 
> >---------------------------------------------------------------------
> > > > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > >For additional commands, e-mail: user-help@struts.apache.org
> > > > >
> > > >
> > > > _________________________________________________________________
> > > > Don’t just search. Find. Check out the new MSN Search!
> > > > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> > > >
> > > >
> > > > 
>---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > > >
> > > >
> > > > --
> > > > No virus found in this incoming message.
> > > > Checked by AVG Free Edition.
> > > > Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date:
> > >27/10/2005
> > > >
> > >
> > >
> > >
> > >FOCUS Computing - web design
> > >Mob: 0415 24 26 24
> > >murray@focus-computing.com.au
> > >http://www.focus-computing.com.au
> > >
> > >
> > >
> > >--
> > >No virus found in this outgoing message.
> > >Checked by AVG Free Edition.
> > >Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 
>27/10/2005
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >For additional commands, e-mail: user-help@struts.apache.org
> > >
> >
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today - it's 
>FREE!
> > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 
>27/10/2005
> >
>
>
>
>FOCUS Computing - web design
>Mob: 0415 24 26 24
>murray@focus-computing.com.au
>http://www.focus-computing.com.au
>
>
>
>--
>No virus found in this outgoing message.
>Checked by AVG Free Edition.
>Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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


Re: how many Form beans

Posted by Murray Collingwood <mu...@focus-computing.com.au>.
Hi again


> CurrencyValueList must be extending the CurrencyValue right!!

No.  CurrencyValueList extends ActionForm.  It contains one property that is a "List" (as 
in java.util.List.   This property will contain a list of the CurencyValues.

So, to build this in your Action form you will have some loop that either reads in values 
of simply creates blank entries.  I will create 5 blank entries in this example:

List mylist = new ArrayList();
for (int ix = 0; ix < 5; ix++) {
    CurrencyValue cv = new CurrencyValue();
    // if you were reading in values you could assign
    // them to the formbean here
    mylist.add(cv); 
}
// mylist now contains 5 'CurrencyValue' elements
// let's set this list into the other formbean
CurrencyValueList cvl = new CurrencyValueList();
cvl.setEntries(mylist);
// finally we push this CurrencyValueList into the request scope
request.setAttribute("cvList", cvl);


> CurrencyValueList there are get and set methods for List?

Yes, I wrote them for you below.

> I created the String[][] in action.

Remove it, it's bad.

> how to convert that to a List?

As above.  I usually use ArrayList().  This supports the abstract class "Collection" which 
Struts requires for iterating and also handles methods such as "add()" and "size()".  
These two methods will makeup 90% of your list handling.

Glad to know this is helping.

Kind regards
mc


> >From: "Murray Collingwood" <mu...@focus-computing.com.au>
> >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> >To: "Struts Users Mailing List" <us...@struts.apache.org>
> >Subject: Re: how many Form beans
> >Date: Fri, 28 Oct 2005 23:32:09 +1000
> >
> >Hi
> >
> >When I first read the subject line I thought the question was, "How many 
> >form beans
> >does it take to change a light bulb?"  Maybe this is a question for the 
> >more advanced
> >Struts user - I'm not sure of the answer to that question.  Any ideas Wendy 
> >/ Laurie?
> >
> >I like to keep things simple....I think 'simple' is my favourite word.  You 
> >really need two
> >separate objects.
> >
> >// Your first object packages a single currency value, including the type, 
> >currency and
> >// amount.  I have guessed at the types you might use.
> >public class CurrencyValue extends ActionForm {
> >     private int type;
> >     private String currency;
> >     private float amount;
> >
> >     CurrencyValue() {
> >     super();
> >     }
> >
> >     // include normal getters and setters here
> >}
> >
> >// The second class is then a simple collection of the above objects
> >public class CurrencyValueList extends ActionForm {
> >     private List entries;
> >
> >     CurrencyValueList() {
> >     super();
> >     }
> >
> >     public List getEntries() {
> >     return entries;
> >     }
> >     public void setEntries(List entries) {
> >     this.entries = entries;
> >     }
> >}
> >
> >
> >In your action class you then populate the form beans above and push them 
> >into the
> >request scope (or session scope).  When you push them into the request 
> >scope you
> >provide an identifier name as in "cvList" in the following example:
> >
> >     request.setAttribute("cvList", currencyValueList);
> >
> >In your JSP you can then iterate over them using:
> >
> ><logic:iterate name="cvList" id="cv" type="CurrencyValue">
> >   <jsp:getProperty name="cv" property="type"/>
> >   <jsp:getProperty name="cv" property="currency"/>
> >   <jsp:getProperty name="cv" property="amount"/>
> ></logic:iterate>
> >
> >I hope that helps makes things clearer.
> >
> >Kind regards
> >mc
> >
> >
> >On 28 Oct 2005 at 9:12, fea jabi wrote:
> >
> > >
> > > According to what you suggested
> > >
> > > I created the below in the action
> > > String row1[][] = {{"type1","currency1","amount1"},
> > >                             {"type2","currency2","amount2"},
> > >                             {"type3","currency3","amount3"},
> > >                             {"type4","currency4","amount4"},
> > >                             {"type5","currency5","amount5"},
> > >                           };
> > >
> > > and set it's value  to the form bean (i.e Form1) attribute which is
> > >
> > >     private String[][] rows;
> > >
> > >     public void setrows(String[][] rows) {
> > >         this.rows = rows;
> > >     }
> > >     public String[][] getrows() {
> > >         return rows;
> > >     }
> > >
> > >
> > > not really sure how to iterate now in jsp? how do I populated the data 
> >now?
> > > under the columns type, currency, amount??
> > >
> > > <logic:iterate id="rowid" property="rows">
> > >                     <tr>
> > >
> > >                     </tr>
> > > </logic:iterate>
> > >
> > >
> > > Thanks.
> > >
> > >
> > > >From: Laurie Harper <la...@holoweb.net>
> > > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > >To: user@struts.apache.org
> > > >Subject: Re: how many Form beans
> > > >Date: Thu, 27 Oct 2005 22:33:06 -0400
> > > >
> > > >fea jabi wrote:
> > > >>thankyou for your responses.
> > > >>
> > > >>for my Jsp I created a formbean and for ---- Form1
> > > >>with attributes
> > > >>name
> > > >>row[]
> > > >>
> > > >>table row in the jsp created another formbean.--- Form2
> > > >>with attributes
> > > >>type
> > > >>currency
> > > >>amount
> > > >>
> > > >>In the action I created dummy data
> > > >>Form2[] ----- row[] and set it to the form1 attribute
> > > >
> > > >I'm not sure I understand what you're doing here. Are you saying that 
> >Form1
> > > >and Form2 are ActionForm subclasses, and that 'row' in Form1 is an 
> >array of
> > > >Form2 instances? And that the JSP is rendering a single form, part of 
> >which
> > > >is shown in a table? In that case, Form2 doesn't have to be a form bean
> > > >(ActionForm instance), it can be any arbitrary java bean -- or you 
> >could
> > > >have Form1 declare three arrays named type[], currency[] and amount[].
> > > >
> > > >There's lots of options here, depending on exactly what you're trying 
> >to
> > > >achieve. That said, if I understand what you have then it should work.
> > > >
> > > >>Now I am not sure how this row[] values to be displayed using struts 
> >in
> > > >>the jsp. i mean how to loop thru this to get values.
> > > >
> > > >To loop through a colllection of values, you would use the
> > > ><logic:iteratate> tag from Struts [1] or, if you have it available, the
> > > ><c:forEach> tag from JSTL.
> > > >
> > > >Maybe you could post your code, JSP and struts-config.xml so we can see
> > > >more clearly what you're doing.
> > > >
> > > >HTH,
> > > >
> > > >L.
> > > >
> > > >[1]
> > > 
> > >http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#iterate
> > > >
> > > >>
> > > >>I would appreciate your help.
> > > >>
> > > >>can I do this?? or is there an easier way to display data in table?
> > > >>
> > > >>thanks.
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>>From: "Martin Gainty" <mg...@hotmail.com>
> > > >>>Reply-To: "Martin Gainty" <mg...@hotmail.com>
> > > >>>To: "Struts Users Mailing List" <us...@struts.apache.org>
> > > >>>Subject: Re: how many Form beans
> > > >>>Date: Thu, 27 Oct 2005 17:16:09 -0400
> > > >>>
> > > >>>A couple of gotchas concerning TagLibs
> > > >>>
> > > >>>what version JSP container ?
> > > >>>if its 2.0 then consider JSTL 1.1.x tags
> > > >>>
> > > >>>On the other hand the struts html tag library outstrips anything
> > > >>>available from JSTL
> > > >>>But if you want performance steer clear Struts logic: tags as they 
> >rank
> > > >>>slowest of all available Logic Taglibs
> > > >>>
> > > >>>If you are concerned about being tied into a TagLib that doesnt
> > > >>>accomplish everything you want to do go with scriptlets
> > > >>>and wait for JSF Tag Library
> > > >>>
> > > >>>Good Luck,
> > > >>>Martin-
> > > >>>----- Original Message ----- From: "Laurie Harper" 
> ><la...@holoweb.net>
> > > >>>To: <us...@struts.apache.org>
> > > >>>Sent: Thursday, October 27, 2005 3:51 PM
> > > >>>Subject: Re: how many Form beans
> > > >>>
> > > >>>
> > > >>>>fea jabi wrote:
> > > >>>>
> > > >>>>>I am new to web development and struts too.
> > > >>>>>
> > > >>>>>I am trying to create a jsp which has
> > > >>>>>
> > > >>>>>a text field for display only for Name
> > > >>>>>
> > > >>>>>and a Table below it with couple of rows and columns in it.
> > > >>>>>
> > > >>>>>
> > > >>>>>how many form beans do I have to create?
> > > >>>>>
> > > >>>>>Do I have to create one for the jsp and one for the table alone?
> > > >>>>>
> > > >>>>>do I have to use nested tag? not really sure. if so how do I have 
> >to
> > > >>>>>use this in jsp?
> > > >>>>
> > > >>>>
> > > >>>>It's really up to you to a large extent. You can have a single form 
> >bean
> > > >>>>for an entire application if you want. One for each page that has a 
> >form
> > > >>>>on it is probably typical though.
> > > >>>>
> > > >>>>The User Guide section on developing view components [1] may help 
> >you
> > > >>>>get a better overall understanding of what your options are.
> > > >>>>
> > > >>>>I'm not sure when you say 'nested tags' if you're referring to the
> > > >>>>'nested' tag library, or if you just mean having tags nested inside
> > > >>>>other tags. Assuming the former, no, you don't necessarily need to 
> >use
> > > >>>>them, though they may make some things easier. I'd suggest getting 
> >to
> > > >>>>grips with the basics first and then looking at the 'nested' taglib
> > > >>>>again later, when you'll be better able to understand if what it 
> >offers
> > > >>>>applies to what you're doing.
> > > >>>>
> > > >>>>L.
> > > >>>>
> > > >>>>[1] 
> >http://struts.apache.org/struts-core/userGuide/building_view.html
> > > >>>>
> > > >>>>
> > > 
> > >>>>---------------------------------------------------------------------
> > > >>>>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
> > > >>>
> > > >>
> > > 
>>_________________________________________________________________
> > > >>Is your PC infected? Get a FREE online computer virus scan from 
> >McAfee®
> > > >>Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > > >
> > > >
> > > >
> > > >---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > >For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > >
> > > _________________________________________________________________
> > > Don’t just search. Find. Check out the new MSN Search!
> > > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> > >
> > > --
> > > No virus found in this incoming message.
> > > Checked by AVG Free Edition.
> > > Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 
> >27/10/2005
> > >
> >
> >
> >
> >FOCUS Computing - web design
> >Mob: 0415 24 26 24
> >murray@focus-computing.com.au
> >http://www.focus-computing.com.au
> >
> >
> >
> >--
> >No virus found in this outgoing message.
> >Checked by AVG Free Edition.
> >Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
> 



FOCUS Computing - web design
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005


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


Re: how many Form beans

Posted by fea jabi <zy...@hotmail.com>.
Thanks!!

CurrencyValueList must be extending the CurrencyValue right!!


CurrencyValueList there are get and set methods for List?

I created the String[][] in action.

how to convert that to a List?

Thanks.



>From: "Murray Collingwood" <mu...@focus-computing.com.au>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Subject: Re: how many Form beans
>Date: Fri, 28 Oct 2005 23:32:09 +1000
>
>Hi
>
>When I first read the subject line I thought the question was, "How many 
>form beans
>does it take to change a light bulb?"  Maybe this is a question for the 
>more advanced
>Struts user - I'm not sure of the answer to that question.  Any ideas Wendy 
>/ Laurie?
>
>I like to keep things simple....I think 'simple' is my favourite word.  You 
>really need two
>separate objects.
>
>// Your first object packages a single currency value, including the type, 
>currency and
>// amount.  I have guessed at the types you might use.
>public class CurrencyValue extends ActionForm {
>     private int type;
>     private String currency;
>     private float amount;
>
>     CurrencyValue() {
>     super();
>     }
>
>     // include normal getters and setters here
>}
>
>// The second class is then a simple collection of the above objects
>public class CurrencyValueList extends ActionForm {
>     private List entries;
>
>     CurrencyValueList() {
>     super();
>     }
>
>     public List getEntries() {
>     return entries;
>     }
>     public void setEntries(List entries) {
>     this.entries = entries;
>     }
>}
>
>
>In your action class you then populate the form beans above and push them 
>into the
>request scope (or session scope).  When you push them into the request 
>scope you
>provide an identifier name as in "cvList" in the following example:
>
>     request.setAttribute("cvList", currencyValueList);
>
>In your JSP you can then iterate over them using:
>
><logic:iterate name="cvList" id="cv" type="CurrencyValue">
>   <jsp:getProperty name="cv" property="type"/>
>   <jsp:getProperty name="cv" property="currency"/>
>   <jsp:getProperty name="cv" property="amount"/>
></logic:iterate>
>
>I hope that helps makes things clearer.
>
>Kind regards
>mc
>
>
>On 28 Oct 2005 at 9:12, fea jabi wrote:
>
> >
> > According to what you suggested
> >
> > I created the below in the action
> > String row1[][] = {{"type1","currency1","amount1"},
> >                             {"type2","currency2","amount2"},
> >                             {"type3","currency3","amount3"},
> >                             {"type4","currency4","amount4"},
> >                             {"type5","currency5","amount5"},
> >                           };
> >
> > and set it's value  to the form bean (i.e Form1) attribute which is
> >
> >     private String[][] rows;
> >
> >     public void setrows(String[][] rows) {
> >         this.rows = rows;
> >     }
> >     public String[][] getrows() {
> >         return rows;
> >     }
> >
> >
> > not really sure how to iterate now in jsp? how do I populated the data 
>now?
> > under the columns type, currency, amount??
> >
> > <logic:iterate id="rowid" property="rows">
> >                     <tr>
> >
> >                     </tr>
> > </logic:iterate>
> >
> >
> > Thanks.
> >
> >
> > >From: Laurie Harper <la...@holoweb.net>
> > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >To: user@struts.apache.org
> > >Subject: Re: how many Form beans
> > >Date: Thu, 27 Oct 2005 22:33:06 -0400
> > >
> > >fea jabi wrote:
> > >>thankyou for your responses.
> > >>
> > >>for my Jsp I created a formbean and for ---- Form1
> > >>with attributes
> > >>name
> > >>row[]
> > >>
> > >>table row in the jsp created another formbean.--- Form2
> > >>with attributes
> > >>type
> > >>currency
> > >>amount
> > >>
> > >>In the action I created dummy data
> > >>Form2[] ----- row[] and set it to the form1 attribute
> > >
> > >I'm not sure I understand what you're doing here. Are you saying that 
>Form1
> > >and Form2 are ActionForm subclasses, and that 'row' in Form1 is an 
>array of
> > >Form2 instances? And that the JSP is rendering a single form, part of 
>which
> > >is shown in a table? In that case, Form2 doesn't have to be a form bean
> > >(ActionForm instance), it can be any arbitrary java bean -- or you 
>could
> > >have Form1 declare three arrays named type[], currency[] and amount[].
> > >
> > >There's lots of options here, depending on exactly what you're trying 
>to
> > >achieve. That said, if I understand what you have then it should work.
> > >
> > >>Now I am not sure how this row[] values to be displayed using struts 
>in
> > >>the jsp. i mean how to loop thru this to get values.
> > >
> > >To loop through a colllection of values, you would use the
> > ><logic:iteratate> tag from Struts [1] or, if you have it available, the
> > ><c:forEach> tag from JSTL.
> > >
> > >Maybe you could post your code, JSP and struts-config.xml so we can see
> > >more clearly what you're doing.
> > >
> > >HTH,
> > >
> > >L.
> > >
> > >[1]
> > 
> >http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#iterate
> > >
> > >>
> > >>I would appreciate your help.
> > >>
> > >>can I do this?? or is there an easier way to display data in table?
> > >>
> > >>thanks.
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>>From: "Martin Gainty" <mg...@hotmail.com>
> > >>>Reply-To: "Martin Gainty" <mg...@hotmail.com>
> > >>>To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >>>Subject: Re: how many Form beans
> > >>>Date: Thu, 27 Oct 2005 17:16:09 -0400
> > >>>
> > >>>A couple of gotchas concerning TagLibs
> > >>>
> > >>>what version JSP container ?
> > >>>if its 2.0 then consider JSTL 1.1.x tags
> > >>>
> > >>>On the other hand the struts html tag library outstrips anything
> > >>>available from JSTL
> > >>>But if you want performance steer clear Struts logic: tags as they 
>rank
> > >>>slowest of all available Logic Taglibs
> > >>>
> > >>>If you are concerned about being tied into a TagLib that doesnt
> > >>>accomplish everything you want to do go with scriptlets
> > >>>and wait for JSF Tag Library
> > >>>
> > >>>Good Luck,
> > >>>Martin-
> > >>>----- Original Message ----- From: "Laurie Harper" 
><la...@holoweb.net>
> > >>>To: <us...@struts.apache.org>
> > >>>Sent: Thursday, October 27, 2005 3:51 PM
> > >>>Subject: Re: how many Form beans
> > >>>
> > >>>
> > >>>>fea jabi wrote:
> > >>>>
> > >>>>>I am new to web development and struts too.
> > >>>>>
> > >>>>>I am trying to create a jsp which has
> > >>>>>
> > >>>>>a text field for display only for Name
> > >>>>>
> > >>>>>and a Table below it with couple of rows and columns in it.
> > >>>>>
> > >>>>>
> > >>>>>how many form beans do I have to create?
> > >>>>>
> > >>>>>Do I have to create one for the jsp and one for the table alone?
> > >>>>>
> > >>>>>do I have to use nested tag? not really sure. if so how do I have 
>to
> > >>>>>use this in jsp?
> > >>>>
> > >>>>
> > >>>>It's really up to you to a large extent. You can have a single form 
>bean
> > >>>>for an entire application if you want. One for each page that has a 
>form
> > >>>>on it is probably typical though.
> > >>>>
> > >>>>The User Guide section on developing view components [1] may help 
>you
> > >>>>get a better overall understanding of what your options are.
> > >>>>
> > >>>>I'm not sure when you say 'nested tags' if you're referring to the
> > >>>>'nested' tag library, or if you just mean having tags nested inside
> > >>>>other tags. Assuming the former, no, you don't necessarily need to 
>use
> > >>>>them, though they may make some things easier. I'd suggest getting 
>to
> > >>>>grips with the basics first and then looking at the 'nested' taglib
> > >>>>again later, when you'll be better able to understand if what it 
>offers
> > >>>>applies to what you're doing.
> > >>>>
> > >>>>L.
> > >>>>
> > >>>>[1] 
>http://struts.apache.org/struts-core/userGuide/building_view.html
> > >>>>
> > >>>>
> > 
> >>>>---------------------------------------------------------------------
> > >>>>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
> > >>>
> > >>
> > >>_________________________________________________________________
> > >>Is your PC infected? Get a FREE online computer virus scan from 
>McAfeeŽ
> > >>Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > >
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >For additional commands, e-mail: user-help@struts.apache.org
> > >
> >
> > _________________________________________________________________
> > Don’t just search. Find. Check out the new MSN Search!
> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 
>27/10/2005
> >
>
>
>
>FOCUS Computing - web design
>Mob: 0415 24 26 24
>murray@focus-computing.com.au
>http://www.focus-computing.com.au
>
>
>
>--
>No virus found in this outgoing message.
>Checked by AVG Free Edition.
>Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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


Re: how many Form beans

Posted by Murray Collingwood <mu...@focus-computing.com.au>.
Hi

When I first read the subject line I thought the question was, "How many form beans 
does it take to change a light bulb?"  Maybe this is a question for the more advanced 
Struts user - I'm not sure of the answer to that question.  Any ideas Wendy / Laurie?

I like to keep things simple....I think 'simple' is my favourite word.  You really need two 
separate objects.

// Your first object packages a single currency value, including the type, currency and
// amount.  I have guessed at the types you might use.
public class CurrencyValue extends ActionForm {
    private int type;
    private String currency;
    private float amount;

    CurrencyValue() {
    super();
    }

    // include normal getters and setters here
}

// The second class is then a simple collection of the above objects
public class CurrencyValueList extends ActionForm {
    private List entries;

    CurrencyValueList() {
    super();
    }

    public List getEntries() {
    return entries;
    }
    public void setEntries(List entries) {
    this.entries = entries;
    }
}


In your action class you then populate the form beans above and push them into the 
request scope (or session scope).  When you push them into the request scope you 
provide an identifier name as in "cvList" in the following example:

    request.setAttribute("cvList", currencyValueList);

In your JSP you can then iterate over them using:

<logic:iterate name="cvList" id="cv" type="CurrencyValue">
  <jsp:getProperty name="cv" property="type"/>
  <jsp:getProperty name="cv" property="currency"/>
  <jsp:getProperty name="cv" property="amount"/>
</logic:iterate>

I hope that helps makes things clearer.

Kind regards
mc


On 28 Oct 2005 at 9:12, fea jabi wrote:

> 
> According to what you suggested
> 
> I created the below in the action
> String row1[][] = {{"type1","currency1","amount1"},
>                             {"type2","currency2","amount2"},
>                             {"type3","currency3","amount3"},
>                             {"type4","currency4","amount4"},
>                             {"type5","currency5","amount5"},
>                           };
> 
> and set it's value  to the form bean (i.e Form1) attribute which is
> 
>     private String[][] rows;
> 
>     public void setrows(String[][] rows) {
>         this.rows = rows;
>     }
>     public String[][] getrows() {
>         return rows;
>     }
> 
> 
> not really sure how to iterate now in jsp? how do I populated the data now? 
> under the columns type, currency, amount??
> 
> <logic:iterate id="rowid" property="rows">
>                     <tr>
> 
>                     </tr>
> </logic:iterate>
> 
> 
> Thanks.
> 
> 
> >From: Laurie Harper <la...@holoweb.net>
> >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> >To: user@struts.apache.org
> >Subject: Re: how many Form beans
> >Date: Thu, 27 Oct 2005 22:33:06 -0400
> >
> >fea jabi wrote:
> >>thankyou for your responses.
> >>
> >>for my Jsp I created a formbean and for ---- Form1
> >>with attributes
> >>name
> >>row[]
> >>
> >>table row in the jsp created another formbean.--- Form2
> >>with attributes
> >>type
> >>currency
> >>amount
> >>
> >>In the action I created dummy data
> >>Form2[] ----- row[] and set it to the form1 attribute
> >
> >I'm not sure I understand what you're doing here. Are you saying that Form1 
> >and Form2 are ActionForm subclasses, and that 'row' in Form1 is an array of 
> >Form2 instances? And that the JSP is rendering a single form, part of which 
> >is shown in a table? In that case, Form2 doesn't have to be a form bean 
> >(ActionForm instance), it can be any arbitrary java bean -- or you could 
> >have Form1 declare three arrays named type[], currency[] and amount[].
> >
> >There's lots of options here, depending on exactly what you're trying to 
> >achieve. That said, if I understand what you have then it should work.
> >
> >>Now I am not sure how this row[] values to be displayed using struts in 
> >>the jsp. i mean how to loop thru this to get values.
> >
> >To loop through a colllection of values, you would use the 
> ><logic:iteratate> tag from Struts [1] or, if you have it available, the 
> ><c:forEach> tag from JSTL.
> >
> >Maybe you could post your code, JSP and struts-config.xml so we can see 
> >more clearly what you're doing.
> >
> >HTH,
> >
> >L.
> >
> >[1] 
> >http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#iterate
> >
> >>
> >>I would appreciate your help.
> >>
> >>can I do this?? or is there an easier way to display data in table?
> >>
> >>thanks.
> >>
> >>
> >>
> >>
> >>
> >>
> >>>From: "Martin Gainty" <mg...@hotmail.com>
> >>>Reply-To: "Martin Gainty" <mg...@hotmail.com>
> >>>To: "Struts Users Mailing List" <us...@struts.apache.org>
> >>>Subject: Re: how many Form beans
> >>>Date: Thu, 27 Oct 2005 17:16:09 -0400
> >>>
> >>>A couple of gotchas concerning TagLibs
> >>>
> >>>what version JSP container ?
> >>>if its 2.0 then consider JSTL 1.1.x tags
> >>>
> >>>On the other hand the struts html tag library outstrips anything 
> >>>available from JSTL
> >>>But if you want performance steer clear Struts logic: tags as they rank 
> >>>slowest of all available Logic Taglibs
> >>>
> >>>If you are concerned about being tied into a TagLib that doesnt 
> >>>accomplish everything you want to do go with scriptlets
> >>>and wait for JSF Tag Library
> >>>
> >>>Good Luck,
> >>>Martin-
> >>>----- Original Message ----- From: "Laurie Harper" <la...@holoweb.net>
> >>>To: <us...@struts.apache.org>
> >>>Sent: Thursday, October 27, 2005 3:51 PM
> >>>Subject: Re: how many Form beans
> >>>
> >>>
> >>>>fea jabi wrote:
> >>>>
> >>>>>I am new to web development and struts too.
> >>>>>
> >>>>>I am trying to create a jsp which has
> >>>>>
> >>>>>a text field for display only for Name
> >>>>>
> >>>>>and a Table below it with couple of rows and columns in it.
> >>>>>
> >>>>>
> >>>>>how many form beans do I have to create?
> >>>>>
> >>>>>Do I have to create one for the jsp and one for the table alone?
> >>>>>
> >>>>>do I have to use nested tag? not really sure. if so how do I have to 
> >>>>>use this in jsp?
> >>>>
> >>>>
> >>>>It's really up to you to a large extent. You can have a single form bean 
> >>>>for an entire application if you want. One for each page that has a form 
> >>>>on it is probably typical though.
> >>>>
> >>>>The User Guide section on developing view components [1] may help you 
> >>>>get a better overall understanding of what your options are.
> >>>>
> >>>>I'm not sure when you say 'nested tags' if you're referring to the 
> >>>>'nested' tag library, or if you just mean having tags nested inside 
> >>>>other tags. Assuming the former, no, you don't necessarily need to use 
> >>>>them, though they may make some things easier. I'd suggest getting to 
> >>>>grips with the basics first and then looking at the 'nested' taglib 
> >>>>again later, when you'll be better able to understand if what it offers 
> >>>>applies to what you're doing.
> >>>>
> >>>>L.
> >>>>
> >>>>[1] http://struts.apache.org/struts-core/userGuide/building_view.html
> >>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>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
> >>>
> >>
> >>_________________________________________________________________
> >>Is your PC infected? Get a FREE online computer virus scan from McAfee® 
> >>Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> 
> _________________________________________________________________
> Don’t just search. Find. Check out the new MSN Search! 
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
> 



FOCUS Computing - web design
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005


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


Re: how many Form beans

Posted by fea jabi <zy...@hotmail.com>.
According to what you suggested

I created the below in the action
String row1[][] = {{"type1","currency1","amount1"},
                            {"type2","currency2","amount2"},
                            {"type3","currency3","amount3"},
                            {"type4","currency4","amount4"},
                            {"type5","currency5","amount5"},
                          };

and set it's value  to the form bean (i.e Form1) attribute which is

    private String[][] rows;

    public void setrows(String[][] rows) {
        this.rows = rows;
    }
    public String[][] getrows() {
        return rows;
    }


not really sure how to iterate now in jsp? how do I populated the data now? 
under the columns type, currency, amount??

<logic:iterate id="rowid" property="rows">
                    <tr>

                    </tr>
</logic:iterate>


Thanks.


>From: Laurie Harper <la...@holoweb.net>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: user@struts.apache.org
>Subject: Re: how many Form beans
>Date: Thu, 27 Oct 2005 22:33:06 -0400
>
>fea jabi wrote:
>>thankyou for your responses.
>>
>>for my Jsp I created a formbean and for ---- Form1
>>with attributes
>>name
>>row[]
>>
>>table row in the jsp created another formbean.--- Form2
>>with attributes
>>type
>>currency
>>amount
>>
>>In the action I created dummy data
>>Form2[] ----- row[] and set it to the form1 attribute
>
>I'm not sure I understand what you're doing here. Are you saying that Form1 
>and Form2 are ActionForm subclasses, and that 'row' in Form1 is an array of 
>Form2 instances? And that the JSP is rendering a single form, part of which 
>is shown in a table? In that case, Form2 doesn't have to be a form bean 
>(ActionForm instance), it can be any arbitrary java bean -- or you could 
>have Form1 declare three arrays named type[], currency[] and amount[].
>
>There's lots of options here, depending on exactly what you're trying to 
>achieve. That said, if I understand what you have then it should work.
>
>>Now I am not sure how this row[] values to be displayed using struts in 
>>the jsp. i mean how to loop thru this to get values.
>
>To loop through a colllection of values, you would use the 
><logic:iteratate> tag from Struts [1] or, if you have it available, the 
><c:forEach> tag from JSTL.
>
>Maybe you could post your code, JSP and struts-config.xml so we can see 
>more clearly what you're doing.
>
>HTH,
>
>L.
>
>[1] 
>http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#iterate
>
>>
>>I would appreciate your help.
>>
>>can I do this?? or is there an easier way to display data in table?
>>
>>thanks.
>>
>>
>>
>>
>>
>>
>>>From: "Martin Gainty" <mg...@hotmail.com>
>>>Reply-To: "Martin Gainty" <mg...@hotmail.com>
>>>To: "Struts Users Mailing List" <us...@struts.apache.org>
>>>Subject: Re: how many Form beans
>>>Date: Thu, 27 Oct 2005 17:16:09 -0400
>>>
>>>A couple of gotchas concerning TagLibs
>>>
>>>what version JSP container ?
>>>if its 2.0 then consider JSTL 1.1.x tags
>>>
>>>On the other hand the struts html tag library outstrips anything 
>>>available from JSTL
>>>But if you want performance steer clear Struts logic: tags as they rank 
>>>slowest of all available Logic Taglibs
>>>
>>>If you are concerned about being tied into a TagLib that doesnt 
>>>accomplish everything you want to do go with scriptlets
>>>and wait for JSF Tag Library
>>>
>>>Good Luck,
>>>Martin-
>>>----- Original Message ----- From: "Laurie Harper" <la...@holoweb.net>
>>>To: <us...@struts.apache.org>
>>>Sent: Thursday, October 27, 2005 3:51 PM
>>>Subject: Re: how many Form beans
>>>
>>>
>>>>fea jabi wrote:
>>>>
>>>>>I am new to web development and struts too.
>>>>>
>>>>>I am trying to create a jsp which has
>>>>>
>>>>>a text field for display only for Name
>>>>>
>>>>>and a Table below it with couple of rows and columns in it.
>>>>>
>>>>>
>>>>>how many form beans do I have to create?
>>>>>
>>>>>Do I have to create one for the jsp and one for the table alone?
>>>>>
>>>>>do I have to use nested tag? not really sure. if so how do I have to 
>>>>>use this in jsp?
>>>>
>>>>
>>>>It's really up to you to a large extent. You can have a single form bean 
>>>>for an entire application if you want. One for each page that has a form 
>>>>on it is probably typical though.
>>>>
>>>>The User Guide section on developing view components [1] may help you 
>>>>get a better overall understanding of what your options are.
>>>>
>>>>I'm not sure when you say 'nested tags' if you're referring to the 
>>>>'nested' tag library, or if you just mean having tags nested inside 
>>>>other tags. Assuming the former, no, you don't necessarily need to use 
>>>>them, though they may make some things easier. I'd suggest getting to 
>>>>grips with the basics first and then looking at the 'nested' taglib 
>>>>again later, when you'll be better able to understand if what it offers 
>>>>applies to what you're doing.
>>>>
>>>>L.
>>>>
>>>>[1] http://struts.apache.org/struts-core/userGuide/building_view.html
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>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
>>>
>>
>>_________________________________________________________________
>>Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 
>>Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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


Re: how many Form beans

Posted by Laurie Harper <la...@holoweb.net>.
fea jabi wrote:
> thankyou for your responses.
> 
> for my Jsp I created a formbean and for ---- Form1
> with attributes
> name
> row[]
> 
> table row in the jsp created another formbean.--- Form2
> with attributes
> type
> currency
> amount
> 
> In the action I created dummy data
> Form2[] ----- row[] and set it to the form1 attribute

I'm not sure I understand what you're doing here. Are you saying that 
Form1 and Form2 are ActionForm subclasses, and that 'row' in Form1 is an 
array of Form2 instances? And that the JSP is rendering a single form, 
part of which is shown in a table? In that case, Form2 doesn't have to 
be a form bean (ActionForm instance), it can be any arbitrary java bean 
-- or you could have Form1 declare three arrays named type[], currency[] 
and amount[].

There's lots of options here, depending on exactly what you're trying to 
achieve. That said, if I understand what you have then it should work.

> Now I am not sure how this row[] values to be displayed using struts in 
> the jsp. i mean how to loop thru this to get values.

To loop through a colllection of values, you would use the 
<logic:iteratate> tag from Struts [1] or, if you have it available, the 
<c:forEach> tag from JSTL.

Maybe you could post your code, JSP and struts-config.xml so we can see 
more clearly what you're doing.

HTH,

L.

[1] 
http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#iterate

> 
> I would appreciate your help.
> 
> can I do this?? or is there an easier way to display data in table?
> 
> thanks.
> 
> 
> 
> 
> 
> 
>> From: "Martin Gainty" <mg...@hotmail.com>
>> Reply-To: "Martin Gainty" <mg...@hotmail.com>
>> To: "Struts Users Mailing List" <us...@struts.apache.org>
>> Subject: Re: how many Form beans
>> Date: Thu, 27 Oct 2005 17:16:09 -0400
>>
>> A couple of gotchas concerning TagLibs
>>
>> what version JSP container ?
>> if its 2.0 then consider JSTL 1.1.x tags
>>
>> On the other hand the struts html tag library outstrips anything 
>> available from JSTL
>> But if you want performance steer clear Struts logic: tags as they 
>> rank slowest of all available Logic Taglibs
>>
>> If you are concerned about being tied into a TagLib that doesnt 
>> accomplish everything you want to do go with scriptlets
>> and wait for JSF Tag Library
>>
>> Good Luck,
>> Martin-
>> ----- Original Message ----- From: "Laurie Harper" <la...@holoweb.net>
>> To: <us...@struts.apache.org>
>> Sent: Thursday, October 27, 2005 3:51 PM
>> Subject: Re: how many Form beans
>>
>>
>>> fea jabi wrote:
>>>
>>>> I am new to web development and struts too.
>>>>
>>>> I am trying to create a jsp which has
>>>>
>>>> a text field for display only for Name
>>>>
>>>> and a Table below it with couple of rows and columns in it.
>>>>
>>>>
>>>> how many form beans do I have to create?
>>>>
>>>> Do I have to create one for the jsp and one for the table alone?
>>>>
>>>> do I have to use nested tag? not really sure. if so how do I have to 
>>>> use this in jsp?
>>>
>>>
>>> It's really up to you to a large extent. You can have a single form 
>>> bean for an entire application if you want. One for each page that 
>>> has a form on it is probably typical though.
>>>
>>> The User Guide section on developing view components [1] may help you 
>>> get a better overall understanding of what your options are.
>>>
>>> I'm not sure when you say 'nested tags' if you're referring to the 
>>> 'nested' tag library, or if you just mean having tags nested inside 
>>> other tags. Assuming the former, no, you don't necessarily need to 
>>> use them, though they may make some things easier. I'd suggest 
>>> getting to grips with the basics first and then looking at the 
>>> 'nested' taglib again later, when you'll be better able to understand 
>>> if what it offers applies to what you're doing.
>>>
>>> L.
>>>
>>> [1] http://struts.apache.org/struts-core/userGuide/building_view.html
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
> 
> _________________________________________________________________
> Is your PC infected? Get a FREE online computer virus scan from McAfee® 
> Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



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


Re: how many Form beans

Posted by fea jabi <zy...@hotmail.com>.
thankyou for your responses.

for my Jsp I created a formbean and for ---- Form1
with attributes
name
row[]

table row in the jsp created another formbean.--- Form2
with attributes
type
currency
amount

In the action I created dummy data
Form2[] ----- row[] and set it to the form1 attribute

Now I am not sure how this row[] values to be displayed using struts in the 
jsp. i mean how to loop thru this to get values.

I would appreciate your help.

can I do this?? or is there an easier way to display data in table?

thanks.






>From: "Martin Gainty" <mg...@hotmail.com>
>Reply-To: "Martin Gainty" <mg...@hotmail.com>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Subject: Re: how many Form beans
>Date: Thu, 27 Oct 2005 17:16:09 -0400
>
>A couple of gotchas concerning TagLibs
>
>what version JSP container ?
>if its 2.0 then consider JSTL 1.1.x tags
>
>On the other hand the struts html tag library outstrips anything available 
>from JSTL
>But if you want performance steer clear Struts logic: tags as they rank 
>slowest of all available Logic Taglibs
>
>If you are concerned about being tied into a TagLib that doesnt accomplish 
>everything you want to do go with scriptlets
>and wait for JSF Tag Library
>
>Good Luck,
>Martin-
>----- Original Message ----- From: "Laurie Harper" <la...@holoweb.net>
>To: <us...@struts.apache.org>
>Sent: Thursday, October 27, 2005 3:51 PM
>Subject: Re: how many Form beans
>
>
>>fea jabi wrote:
>>>I am new to web development and struts too.
>>>
>>>I am trying to create a jsp which has
>>>
>>>a text field for display only for Name
>>>
>>>and a Table below it with couple of rows and columns in it.
>>>
>>>
>>>how many form beans do I have to create?
>>>
>>>Do I have to create one for the jsp and one for the table alone?
>>>
>>>do I have to use nested tag? not really sure. if so how do I have to use 
>>>this in jsp?
>>
>>It's really up to you to a large extent. You can have a single form bean 
>>for an entire application if you want. One for each page that has a form 
>>on it is probably typical though.
>>
>>The User Guide section on developing view components [1] may help you get 
>>a better overall understanding of what your options are.
>>
>>I'm not sure when you say 'nested tags' if you're referring to the 
>>'nested' tag library, or if you just mean having tags nested inside other 
>>tags. Assuming the former, no, you don't necessarily need to use them, 
>>though they may make some things easier. I'd suggest getting to grips with 
>>the basics first and then looking at the 'nested' taglib again later, when 
>>you'll be better able to understand if what it offers applies to what 
>>you're doing.
>>
>>L.
>>
>>[1] http://struts.apache.org/struts-core/userGuide/building_view.html
>>
>>
>>---------------------------------------------------------------------
>>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
>

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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


Re: how many Form beans

Posted by Martin Gainty <mg...@hotmail.com>.
A couple of gotchas concerning TagLibs

what version JSP container ?
if its 2.0 then consider JSTL 1.1.x tags

On the other hand the struts html tag library outstrips anything available 
from JSTL
But if you want performance steer clear Struts logic: tags as they rank 
slowest of all available Logic Taglibs

If you are concerned about being tied into a TagLib that doesnt accomplish 
everything you want to do go with scriptlets
and wait for JSF Tag Library

Good Luck,
Martin-
----- Original Message ----- 
From: "Laurie Harper" <la...@holoweb.net>
To: <us...@struts.apache.org>
Sent: Thursday, October 27, 2005 3:51 PM
Subject: Re: how many Form beans


> fea jabi wrote:
>> I am new to web development and struts too.
>>
>> I am trying to create a jsp which has
>>
>> a text field for display only for Name
>>
>> and a Table below it with couple of rows and columns in it.
>>
>>
>> how many form beans do I have to create?
>>
>> Do I have to create one for the jsp and one for the table alone?
>>
>> do I have to use nested tag? not really sure. if so how do I have to use 
>> this in jsp?
>
> It's really up to you to a large extent. You can have a single form bean 
> for an entire application if you want. One for each page that has a form 
> on it is probably typical though.
>
> The User Guide section on developing view components [1] may help you get 
> a better overall understanding of what your options are.
>
> I'm not sure when you say 'nested tags' if you're referring to the 
> 'nested' tag library, or if you just mean having tags nested inside other 
> tags. Assuming the former, no, you don't necessarily need to use them, 
> though they may make some things easier. I'd suggest getting to grips with 
> the basics first and then looking at the 'nested' taglib again later, when 
> you'll be better able to understand if what it offers applies to what 
> you're doing.
>
> L.
>
> [1] http://struts.apache.org/struts-core/userGuide/building_view.html
>
>
> ---------------------------------------------------------------------
> 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: Showing my ignorance here. Sorry.

Posted by Murray Collingwood <mu...@focus-computing.com.au>.
It's a vote in favour of something.  -1 is a vote against.  

Kind regards
mc

On 28 Oct 2005 at 8:24, pantichd@firstenergycorp.com wrote:

> Hello,
> 
> Every once in a while I'll see an e-mail with a +1 in the body. Sorry for
> my ignorance but can someone please explain the meaning of "+1"?
> 
> Thanks!
> 
> 
> 
> -----------------------------------------
> The information contained in this message is intended only for the
> personal and confidential use of the recipient(s) named above. If the
> reader of this message is not the intended recipient or an agent
> responsible for delivering it to the intended recipient, you are hereby
> notified that you have received this document in error and that any
> review, dissemination, distribution, or copying of this message is
> strictly prohibited. If you have received this communication in error,
> please notify us immediately, and delete the original message.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
> 



FOCUS Computing
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005


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


Re: Showing my ignorance here. Sorry.

Posted by pa...@firstenergycorp.com.
Oh, OK.  Thanks for clearing that up.

By the way, I just want to say that this mailing list is awesome. I think
we all sometimes take for granted the unbelievable level of "support" we
get from something like this and all for free. Thanks everyone for donating
your time to help out.




                                                                           
             Larry Meadors                                                 
             <lmeadors@apache.                                             
             org>                                                       To 
             Sent by:                  Struts Users Mailing List           
             larry.meadors@gma         <us...@struts.apache.org>            
             il.com                                                     cc 
                                                                           
                                                                   Subject 
             10/28/2005 08:31          Re: Showing my ignorance here.      
             AM                        Sorry.                              
                                                                           
                                                                           
             Please respond to                                             
               "Struts Users                                               
               Mailing List"                                               
             <user@struts.apac                                             
                  he.org>                                                  
                                                                           
                                                                           




+1 == I agree, like if someone said your email discalimer was too long...I
would reply and say:

+1!

Larry


On 10/28/05, pantichd@firstenergycorp.com <pa...@firstenergycorp.com>
wrote:
>
> Hello,
>
> Every once in a while I'll see an e-mail with a +1 in the body. Sorry for
> my ignorance but can someone please explain the meaning of "+1"?
>
> Thanks!
>



-----------------------------------------
The information contained in this message is intended only for the
personal and confidential use of the recipient(s) named above. If the
reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is
strictly prohibited. If you have received this communication in error,
please notify us immediately, and delete the original message.



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


Re: Showing my ignorance here. Sorry.

Posted by Larry Meadors <lm...@apache.org>.
+1 == I agree, like if someone said your email discalimer was too long..I
would reply and say:

+1!

Larry


On 10/28/05, pantichd@firstenergycorp.com <pa...@firstenergycorp.com>
wrote:
>
> Hello,
>
> Every once in a while I'll see an e-mail with a +1 in the body. Sorry for
> my ignorance but can someone please explain the meaning of "+1"?
>
> Thanks!
>

Re: Showing my ignorance here. Sorry.

Posted by Wendy Smoak <ja...@wendysmoak.com>.
> Every once in a while I'll see an e-mail with a +1 in the body. Sorry for
> my ignorance but can someone please explain the meaning of "+1"?

Here are some links that explain how voting works at the ASF and in Struts:

   http://www.apache.org/foundation/voting.html

   http://struts.apache.org/bylaws.html#Voting

-- 
Wendy 



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


Showing my ignorance here. Sorry.

Posted by pa...@firstenergycorp.com.
Hello,

Every once in a while I'll see an e-mail with a +1 in the body. Sorry for
my ignorance but can someone please explain the meaning of "+1"?

Thanks!



-----------------------------------------
The information contained in this message is intended only for the
personal and confidential use of the recipient(s) named above. If the
reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is
strictly prohibited. If you have received this communication in error,
please notify us immediately, and delete the original message.


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


RE: Implementing Wizards

Posted by Mark Benussi <ma...@hotmail.com>.
Yep +1.

I did the same. Implemented my own. I was nervous about using yet another 
framework, when what I did instead was get a pen and paper and design it 
from scratch. Yes I had some time to kill (Although not that much) but I 
learnt a lot, about how users work as well as Struts.

Its not prefect, but when I need to change it, i know exactly what the code 
does.

There you have my tupence worth.

----Original Message Follows----
From: <bs...@psl.nmsu.edu>
Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
To: <us...@struts.apache.org>
Subject: RE: Implementing Wizards
Date: Thu, 27 Oct 2005 15:33:15 -0600

Hi Ross.  I created a User Wizard to add Users to Microsoft Active Directory 
from Linux.  I did look at the Workflow Extensions as a possibility but I 
found it cumbersome to use and chose to create a Wizard using pure Struts 
and not the extensions.  I have to tell you the Struts knowledge I gained 
from doing it from scratch was worth the effort and it was great fun (I have 
only been doing Struts for 2 1/2 weeks).

I used Struts 1.2.7 and used the LookupDispatchAction as the basis for my 
Wizard.  The book "Jakarta Struts Cookbook" on pages 199 to 203 gives a good 
example of how to do this.  Validating the Wizard form on pages 251 to 254 
is good also.

The action mapping is as follows:

  <!-- Wizard Mapping -->
	 <!-- Step 1 -->

	 <action path="/ViewStep1"
	 	name="wizardForm"
	 	scope="session"
	 	type="org.apache.struts.actions.ForwardAction"
	 	input="/step1.jsp"
	 	parameter="/step1.jsp"
	 	validate="false" />
      <action path="/ProcessStep1"
      	name="wizardForm"
      	scope="session"
      	type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction"
      	validate="true"
      	input="/step1.jsp"
      	parameter="methodToCall">
      		<forward name="next" path="/ViewStep2.do" />
      		<forward name="badnext" path="/ViewStep1.do" />
	</action>


	<!-- Step 2 -->

	<action path="/ViewStep2"
		name="wizardForm"
		scope="session"
		type="org.apache.struts.actions.ForwardAction"
		validate="false"
		input="/step2.jsp"
		parameter="/step2.jsp" />
	<action path="/ProcessStep2"
		name="wizardForm"
		scope="session"
		input="/step2.jsp"
		type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction"
		validate="true"
		parameter="methodToCall">
      		<forward name="previous" path="/ViewStep1.do" />
      		<forward name="next" path="/ViewStep3.do" />
	</action>


	<!-- Step 3 -->

	<action path="/ViewStep3"
		name="wizardForm"
		scope="session"
		input="/step3.jsp"
		validate="false"
		type="org.apache.struts.actions.ForwardAction"
		parameter="/step3.jsp" />
	<action path="/ProcessStep3"
		name="wizardForm"
		scope="session"
		input="/step3.jsp"
		validate="true"
		type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction"
		parameter="methodToCall">
      		<forward name="previous" path="/ViewStep2.do" />
      		<forward name="finish" path="/wizard_done.jsp" />
	</action>


   </action-mappings>


-----Original Message-----
From: Ross Gibb [mailto:ragibb@ucalgary.ca]
Sent: Thu 10/27/2005 2:58 PM
To: Struts Users Mailing List
Subject: Implementing Wizards

I know this comes up from time to time and yes I have read the previous
posts on implementing wizard like interfaces.  As a result of previous
posts I decided to give Struts Workflow Extension a shot,
http://www.livinglogic.de/Struts/.  I implemented a simple five screen
wizard like interface for adding a new user to my system.  I did get it
to work the way I wanted.  However, I found that using Struts Workflow
Extension was often counter-intuitive and at times frustrating.  Also, I
am using Struts 1.2.7 and I will have to make a few bug fixes to the
Struts Workflow Extension code to make it work properly.

My question is: has anyone used Struts Workflow Extension and then
switched to another wizard tool kit and found it to be superior to
Struts Workflow Extension?  I am specifically looking for input from
people who have actually used Struts Workflow Extension because even
though I knock it, I did get it to work the way I wanted it to and I am
reasonably sure I can easily fix the bugs I am experiencing with it.

Thanks,

Ross

---------------------------------------------------------------------
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



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


RE: Implementing Wizards

Posted by bs...@psl.nmsu.edu.
Hi Ross.  I created a User Wizard to add Users to Microsoft Active Directory from Linux.  I did look at the Workflow Extensions as a possibility but I found it cumbersome to use and chose to create a Wizard using pure Struts and not the extensions.  I have to tell you the Struts knowledge I gained from doing it from scratch was worth the effort and it was great fun (I have only been doing Struts for 2 1/2 weeks). 

I used Struts 1.2.7 and used the LookupDispatchAction as the basis for my Wizard.  The book "Jakarta Struts Cookbook" on pages 199 to 203 gives a good example of how to do this.  Validating the Wizard form on pages 251 to 254 is good also.  

The action mapping is as follows:

 <!-- Wizard Mapping -->
	 <!-- Step 1 -->
	  
	 <action path="/ViewStep1" 
	 	name="wizardForm" 
	 	scope="session" 
	 	type="org.apache.struts.actions.ForwardAction" 
	 	input="/step1.jsp" 
	 	parameter="/step1.jsp" 
	 	validate="false" />
     <action path="/ProcessStep1" 
     	name="wizardForm" 
     	scope="session" 
     	type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction" 
     	validate="true" 
     	input="/step1.jsp" 
     	parameter="methodToCall">
     		<forward name="next" path="/ViewStep2.do" />
     		<forward name="badnext" path="/ViewStep1.do" />
	</action>

	
	<!-- Step 2 -->
	 
	<action path="/ViewStep2" 
		name="wizardForm" 
		scope="session" 
		type="org.apache.struts.actions.ForwardAction" 
		validate="false" 
		input="/step2.jsp" 
		parameter="/step2.jsp" />
	<action path="/ProcessStep2" 
		name="wizardForm" 
		scope="session" 
		input="/step2.jsp" 
		type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction" 
		validate="true" 
		parameter="methodToCall">
     		<forward name="previous" path="/ViewStep1.do" />
     		<forward name="next" path="/ViewStep3.do" />
	</action>
	
	
	<!-- Step 3 -->
 
	<action path="/ViewStep3" 
		name="wizardForm" 
		scope="session" 
		input="/step3.jsp" 
		validate="false" 
		type="org.apache.struts.actions.ForwardAction" 
		parameter="/step3.jsp" />
	<action path="/ProcessStep3" 
		name="wizardForm" 
		scope="session" 
		input="/step3.jsp"
		validate="true"  
		type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction" 
		parameter="methodToCall">
     		<forward name="previous" path="/ViewStep2.do" />
     		<forward name="finish" path="/wizard_done.jsp" />
	</action>
	
					
  </action-mappings>


-----Original Message-----
From: Ross Gibb [mailto:ragibb@ucalgary.ca]
Sent: Thu 10/27/2005 2:58 PM
To: Struts Users Mailing List
Subject: Implementing Wizards
 
I know this comes up from time to time and yes I have read the previous 
posts on implementing wizard like interfaces.  As a result of previous 
posts I decided to give Struts Workflow Extension a shot, 
http://www.livinglogic.de/Struts/.  I implemented a simple five screen 
wizard like interface for adding a new user to my system.  I did get it 
to work the way I wanted.  However, I found that using Struts Workflow 
Extension was often counter-intuitive and at times frustrating.  Also, I 
am using Struts 1.2.7 and I will have to make a few bug fixes to the 
Struts Workflow Extension code to make it work properly.

My question is: has anyone used Struts Workflow Extension and then 
switched to another wizard tool kit and found it to be superior to 
Struts Workflow Extension?  I am specifically looking for input from 
people who have actually used Struts Workflow Extension because even 
though I knock it, I did get it to work the way I wanted it to and I am 
reasonably sure I can easily fix the bugs I am experiencing with it.

Thanks,

Ross

---------------------------------------------------------------------
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: Implementing Wizards

Posted by Michael Jouravlev <jm...@gmail.com>.
On 10/27/05, Ross Gibb <ra...@ucalgary.ca> wrote:
> I know this comes up from time to time and yes I have read the previous
> posts on implementing wizard like interfaces.  As a result of previous
> posts I decided to give Struts Workflow Extension a shot,
> http://www.livinglogic.de/Struts/.  I implemented a simple five screen
> wizard like interface for adding a new user to my system.  I did get it
> to work the way I wanted.  However, I found that using Struts Workflow
> Extension was often counter-intuitive and at times frustrating.  Also, I
> am using Struts 1.2.7 and I will have to make a few bug fixes to the
> Struts Workflow Extension code to make it work properly.
>
> My question is: has anyone used Struts Workflow Extension and then
> switched to another wizard tool kit and found it to be superior to
> Struts Workflow Extension?  I am specifically looking for input from
> people who have actually used Struts Workflow Extension because even
> though I knock it, I did get it to work the way I wanted it to and I am
> reasonably sure I can easily fix the bugs I am experiencing with it.

So, did you also try this:
http://struts.sourceforge.net/strutsdialogs/wizardaction.html
If you did, did you find it counterintuitive? complex? not doing what
you want? I would really appreciate the feedback.

I tried Struts Workflow Extension before, I was not completely
satisfied with it, because it is based on artificial steps, not on
model state. I even wrote a short comparison:
http://www.jroller.com/comments/javadujour/Weblog/spring_web_flow_vs_struts
Also, with SWE you can use navigation buttons, and then wizard will
bite you, telling that you cannot do it. But sometimes you can get SWE
wizard out of sync.

Michael.

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


Implementing Wizards

Posted by Ross Gibb <ra...@ucalgary.ca>.
I know this comes up from time to time and yes I have read the previous 
posts on implementing wizard like interfaces.  As a result of previous 
posts I decided to give Struts Workflow Extension a shot, 
http://www.livinglogic.de/Struts/.  I implemented a simple five screen 
wizard like interface for adding a new user to my system.  I did get it 
to work the way I wanted.  However, I found that using Struts Workflow 
Extension was often counter-intuitive and at times frustrating.  Also, I 
am using Struts 1.2.7 and I will have to make a few bug fixes to the 
Struts Workflow Extension code to make it work properly.

My question is: has anyone used Struts Workflow Extension and then 
switched to another wizard tool kit and found it to be superior to 
Struts Workflow Extension?  I am specifically looking for input from 
people who have actually used Struts Workflow Extension because even 
though I knock it, I did get it to work the way I wanted it to and I am 
reasonably sure I can easily fix the bugs I am experiencing with it.

Thanks,

Ross

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


Re: how many Form beans

Posted by Laurie Harper <la...@holoweb.net>.
fea jabi wrote:
> I am new to web development and struts too.
> 
> I am trying to create a jsp which has
> 
> a text field for display only for Name
> 
> and a Table below it with couple of rows and columns in it.
> 
> 
> how many form beans do I have to create?
> 
> Do I have to create one for the jsp and one for the table alone?
> 
> do I have to use nested tag? not really sure. if so how do I have to use 
> this in jsp?

It's really up to you to a large extent. You can have a single form bean 
for an entire application if you want. One for each page that has a form 
on it is probably typical though.

The User Guide section on developing view components [1] may help you 
get a better overall understanding of what your options are.

I'm not sure when you say 'nested tags' if you're referring to the 
'nested' tag library, or if you just mean having tags nested inside 
other tags. Assuming the former, no, you don't necessarily need to use 
them, though they may make some things easier. I'd suggest getting to 
grips with the basics first and then looking at the 'nested' taglib 
again later, when you'll be better able to understand if what it offers 
applies to what you're doing.

L.

[1] http://struts.apache.org/struts-core/userGuide/building_view.html


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