Use indices properties...
Danny Trieu
Internet Business Group
Downey Savings and Loan Association, F.A.
[EMAIL PROTECTED]
(949) 509-4564
The beginning of knowledge is the discovery of something we do not
understand.
- Frank Herbert (1920-1986)
The essence of knowledge is, having it, to apply
I don't understand what you mean. I know how to index the properties inside the
iterator tag.but how to declare those properties dynamically in the ActionForm class?
Thanks
Otávio Augusto
On Fri, 16 Jan 2004 08:56:16 -0800
Trieu, Danny [EMAIL PROTECTED] wrote:
Use indices properties...
Anyone got any ideas?
Thanks, Paul
Paul-J Woodward
Sorry but I haven't quite catch what you looking for...
Do you want to create a form in runtime? Is that it?
If you're using a DynaForm it already has map. You can't set new
properties to the form (it was built based on a DynaClass) but, if you
extend DynaForm to a XDynaForm and make
:
Subject: Re: Dynamic form property
names
30/12/2003 16:39
I thought there was something slightly awry in your thinking. I guess
that's where examples really do help. Good luck with it,
Adam
On 10/09/2003 03:15 AM Cornellious Mann wrote:
Adam,
I missed the point about adding the index to the input
field name. I was simply naming the field the same
Still it depends. How does the database handle the new products? Can you
at least categorise them?
On 10/08/2003 06:19 AM Cornellious Mann wrote:
Unfortunately, products can be added at runtime and
therefore I don't know what the full set is. From the
research I have done it sounds like
All we have is a product ID. There is no category.
How do you think category could help?
Also, have you used an indexed property and DynaForm?
--- Adam Hardy [EMAIL PROTECTED]
wrote:
Still it depends. How does the database handle the
new products? Can you
at least categorise them?
On
Yes you can have indexed properties dynaforms. I do not use them, I
prefer nested properties. But I think the docs are quite good on this
topic.
Re: your problem, I was just asking about categories because I have no
concept of how your database stores your products. Looking at your
database
Currently, we are a stateless application. So on each
request we will read the database and get a list of
products.
Then our JSP will generate a from a list of products.
Each product will have an input that can accept the
number of units per product.
The problem I have is that each input field
I think I see what you mean. If all you want is a list of product Id's
and the number of units per id, then your priority is to use indexed
properties, rather than DynaForm or normal Form.
If you are using indexed properties, you just name the field one name,
e.g. productId, and the indexing
I'm not sure about one thing though. If I name all of
my inputs on the HTML page the same name, when I
submit the form, won't only one of the inputs be
passed along?
--- Adam Hardy [EMAIL PROTECTED]
wrote:
I think I see what you mean. If all you want is a
list of product Id's
and the number
Yes, but because they're indexed, you will see the result as an array.
On 10/08/2003 07:45 PM Cornellious Mann wrote:
I'm not sure about one thing though. If I name all of
my inputs on the HTML page the same name, when I
submit the form, won't only one of the inputs be
passed along?
--- Adam
This worked. :) Do you know if the order is
guaranteed? From my testing it looks like the values
appear in the array in the same order the parameters
in the URL line.
--- Adam Hardy [EMAIL PROTECTED]
wrote:
Yes, but because they're indexed, you will see the
result as an array.
On
They're indexed! 0 becomes 0, 1 becomes 1 etc., i.e. the order they went
out with remains the same when they come back in. I think you must be
missing the point here somewhere
On 10/08/2003 10:34 PM Cornellious Mann wrote:
This worked. :) Do you know if the order is
guaranteed? From my
I just did this, maybe an example will help
Read the database and stuff the data into an
arraylist. Stuff the arraylist into the form. Call
the page and get something like this
tr
td class=datainput type=checkbox
name=feelistinfo[0].associated value=Y
checked=checked
I guess my question about order was more of
HTML/submit question than a question about arrays. I
just want to guarantee that the order of the values
being sumitted stay in the order they are on the page.
I was simply giving every input field the same name
such as product and catching the values
Adam,
I missed the point about adding the index to the input
field name. I was simply naming the field the same
thing. It actually worked, but it worried me. Thansk
for all of the help! :)
--- Adam Hardy [EMAIL PROTECTED]
wrote:
They're indexed! 0 becomes 0, 1 becomes 1 etc., i.e.
the
Hi Cornellious,
it depends whether you know beforehand what the full set of possible
fields could be, or whether the fields themselves are not limited in
name or type.
If the former, then it would be easy to make a form that defined them
all, and to use logic tags to display the needed fields
Indexed form property is what you want.. I'll avoid any clever
explanations, grandiose meta language or to try and sell you a book..
And give you an example..
form-bean name=productForm
form-property name=product type=java.util.ArrayList /
..
action name=productForm path=/products
Unfortunately, products can be added at runtime and
therefore I don't know what the full set is. From the
research I have done it sounds like ActionForms can
not handle this situation and I will need to handle it
myself in the Action. Do you agree?
--- Adam Hardy [EMAIL PROTECTED]
wrote:
Hi
Message -
From: Mark Lowe [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, August 13, 2003 12:54 PM
Subject: Re: Dynamic Form help
You use indexed property.
html:text property=permission indexed=true /
This stuff i quite well documented, what isn't well
You use indexed property.
html:text property=permission indexed=true /
This stuff i quite well documented, what isn't well documented is how
to dynamically change the length of an indexed property. I've been
using ArrayList for this..
form-property name=permission type=java.util.ArrayList /
Currently, I have a DynaValidatorForm defined in my web app. Some of
the properties of this form will be completely dynamic. I will read a
database and retrieve an ArrayList. This ArrayList will contain the
If I understand you correctly
for (Iterator iter = al.iterator (); iter.hasNext
Struts 1.1 supports map-backed forms, but that doesn't resolve the input
form issue.
I guess the key would be some type of tag that took a map and then
generated a column of input fields. (Wouldn't work for everyone, since a
lot of forms must be designed just so.) For extra credit, the entry
Mark,
Please, correct me if I'm wrong, but I think the action attribute in
the html:form tag is a run time expression, so there's no need to
extend the FormTag class in order to use a dynamic form action.
Regards
Jose
Mark wrote:
I just wanted to pass on a tidbit that might help
No, its not a runtime expression.
If you look at the code in FormTag you'll see that its not
results.append(\ action=\);
results.append(response.encodeURL(RequestUtils.getActionMappingURL(action,
pageContext)));
results.append(\);
It simply pulls the action mapping
The code you've quoted has no impact on whether or not the html:form tag's
action attribute is an rtexpr. Look at struts-html.tld:
tag
nameform/name
tagclassorg.apache.struts.taglib.html.FormTag/tagclass
bodycontentJSP/bodycontent
attribute
nameaction/name
requiredtrue/required
All that means is you can have
mysimpleTag value=%=scripletVariable%/
false means you cannot have a scriplet variable as a value
That's not quite what i wanted to do, but in a way accomplishes a similar task without
modifying struts. Its not sexy enough for me ;)
The whole point of MVC is
Right, so you'd put the code to determine the appropriate value for the action
attribute in your action, not in a JSP expression. That value could be stored in
a request attribute and accessed simply as:
html:form action='%= request.getAttribute(formaction) %'
html-el:form might even let you do
thanks, good ideas
*** REPLY SEPARATOR ***
On 03/14/2003 at 10:24 AM Kris Schneider wrote:
Right, so you'd put the code to determine the appropriate value for the action
attribute in your action, not in a JSP expression. That value could be stored in
a request attribute and
We'll i kind of interested in trying your solution.
Can you post some jsp codes in here.
I think many people will appreciate it.
Thanks.
- Original Message -
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 14, 2003 11:52 AM
Subject: Dynamic form actions
I just
Can you put them in an array?
- Original Message -
From: Jason Long [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 9:38 PM
Subject: Dynamic form value replacements???
I have a form that is dynamically created as a jsp in xml syntax.
:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 8:43 PM
To: Struts Users Mailing List
Subject: Re: Dynamic form value replacements???
Can you put them in an array?
- Original Message -
From: Jason Long [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, March
On Sat, 2 Nov 2002, Mr Alireza Fattahi wrote:
Date: Sat, 2 Nov 2002 05:21:12 + (GMT)
From: Mr Alireza Fattahi [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Dynamic form and Upload
Hi,
I want to use struts dynamic form feature.
Thanks for your reply,
I have seen the example and an work with it, But my
problem is I can not do that in an dynamic form. How
should I do it in dynamic form, and what should I put
in struts.config.xml?
As I told I got the class cast expetion.
Thanks
: Thursday, June 06, 2002 5:58 AM
Subject: RE: dynamic form properties
What do you want to know? I use maps and collections in form beans now to
capture multi-select list key-value pairs and checkbox array booleans,
respectively. I think it would be a simple extrapolation to map
key-values
1. Declare the bean's scope as session as an attribute of the form-bean
declaration in struts-config.xml and provide an empty reset() method in the
bean class;
2. Use java scriplets (though I do not recommend this) as in
% List myBean = (List) session.getAttribute( myBean);
Iterator i =
,
Daka
- Original Message -
From: Galbreath, Mark [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, June 06, 2002 5:58 AM
Subject: RE: dynamic form properties
What do you want to know? I use maps and collections in form beans now to
capture multi
What do you want to know? I use maps and collections in form beans now to
capture multi-select list key-value pairs and checkbox array booleans,
respectively. I think it would be a simple extrapolation to map key-values
for an entire HTML form, permitting a single action form to capture states
Are you talking about the DynaActionForm?
James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the Open Minded Developer Network
http://struts-atlanta.open-tools.org
ICQ: 27651409
AOLIM: jmitchtx (and NO I dont use AOL;)
-Original Message-
From: Zhihua Xu
Your first statement,
...I have a form that can have N number of images...
Does not warrant the use of nested tag library. Simply use the standard
iterator, and indexed properties of the html:file tag, to properly output
your file names as file[1], file[2], file[3].
-AP_
Elijah,
Sorry about the lack of the tag. It's on its way.
Pick it up in the next nightly build.
Arron.
Elijah Jacobs wrote:
hi all,
I have a form that can have N number of images. So in essence it's like the
Monkey struts example by Arron Bates except where he has bananas, i have
images.
It's difficult to do this in the 1.0.x release, but simple as pie in the
1.1 beta and nightly build.
http://jguru.com/forums/view.jsp?EID=567079
-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web:
SavePhoneNumberAction.java -- editPhoneNumbers.do
It may be that this is looking up the original phone number again.
If so, this is also where the recyling message could be coming into it.
Do you want to go back through the edit action, or straight to the
display page?
-- Ted Husted,
[mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 2:05 AM
To: 'Struts Users Mailing List'
Subject: RE: dynamic form action flow
Hi Jeff,
The struts-example.war app does just this, except it uses subscriptions
instead of phone numbers. It's part of the struts download, under webapps.
Jon
: Re: dynamic form action flow
SavePhoneNumberAction.java -- editPhoneNumbers.do
It may be that this is looking up the original phone number again.
If so, this is also where the recyling message could be coming into it.
Do you want to go back through the edit action, or straight
to the editPhoneNumbers.do action, directly re-display the
jsp.
-Original Message-
From: Jeff Oberlander
Sent: Friday, February 01, 2002 7:39 AM
To: 'Struts Users Mailing List'
Subject: RE: dynamic form action flow
I've tried going straight to the display page and then I get the new, blank
element
Hi John,
Are you able to slove this problem?if so, Can you help me out?
Stephen.
-Original Message-
From: John Townsend [SMTP:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 8:19 PM
To: [EMAIL PROTECTED]; 'Luis Olivares'
Subject: RE: Dynamic Form Beans?
The one
One part of the solution is to use the MappedProperty feature recently added
to the jakarta-commons bean-utils.
The original submission is in this message:
http://www.mail-archive.com/jakarta-commons@jakarta.apache.org/msg03005.html
It has been integrated into the commons source, as indicated by
I have the same 'problem'.
I would like to be able to create a form dynamically depending on the
structure of a table (I used to do this with 'plain' JSP).
Any ideas?
Regards.
Luis Olivares.
[EMAIL PROTECTED]
I heard Struts 1.1 will address this issue. In the mean time, I too am
interested to a working solution.
Thanks,
Thinh
-Original Message-
From: Luis Olivares [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 1:28 PM
To: [EMAIL PROTECTED]
Subject: Re: Dynamic Form Beans?
I
to go.
-Original Message-
From: Luis Olivares [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 11:28 AM
To: [EMAIL PROTECTED]
Subject: Re: Dynamic Form Beans?
I have the same 'problem'.
I would like to be able to create a form dynamically depending on the
structure of a table
I have the same problem too, and I'm sure there are many more like us. I
believe this is a problem struts has not addressed yet. Fortunately, they
are working on Dynamic form generation feature for struts1.1. I don't know
when it is going to be ready!!
Here is a work-around: Make your JSPs
]; 'Luis Olivares'
[EMAIL PROTECTED]
Sent: Wednesday, August 29, 2001 12:19 PM
Subject: RE: Dynamic Form Beans?
The one idea that I had was to create a new subclass of ActionForm
called ActionDataForm. This form would have get and put methods that use
keys instead of the usual pattern of numerous
Peter Alfors wrote:
Currently, we do not use the html:form tag.
I haven't had a chance to look into them yet.
I would think that the action attribute would not be required, but maybe there
is a good reason for it to be?
Someone with more experience with the html tags will have to help you
Currently, we do not use the html:form tag.
I haven't had a chance to look into them yet.
I would think that the action attribute would not be required, but maybe there
is a good reason for it to be?
Someone with more experience with the html tags will have to help you there.
Anyone?
Pete
Tom
In order to use forwards (that depend on the user action), wouldn't you
need some sort of router action class. Would all the pages then call this
class and set some flag to notify it which action to take?
Ted Husted wrote:
On 1/29/2001 at 3:12 PM Tom Janofsky wrote:
Or would a Struts guru
Wong Kok Wai wrote:
What's the recommended way to implement a dynamic form
using Struts? Typical scenario: an address book for
email where the number of contacts varies. No problem
with renderering the form in the JSP but how do I
associate the "input" with an attribute in an
instance of
59 matches
Mail list logo