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" <[EMAIL PROTECTED]>
Reply-To: "Martin Gainty" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@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" <[EMAIL PROTECTED]>
To: <user@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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]