Look into the nested tags.

-----Original Message-----
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 12:02 PM
To: Struts Users Mailing List
Subject: Re: Design Issue in struts


Shirish

By dynamically generating a form i mean querying a db table which contains
information about what fields etc to produce for the user to be able to add
content to their site.

I'm porting an existing cms written in perl on mysql, to java and oracle.

I have 2 forms:
1. Admin form that basically adds fields to an sql table
(AddCustomFieldAction). E.g. What kind of field would you like, etc?

2. The content manager then uses a form that is generated by the table
refered to in form 1.

There appears no elegant means of using struts for form 2, as the action
form cant know what to expect. The only thing i can think of is posting an
array of custom field values as an array and dealing with it when i get to
the action or associated logic.

Please tell me if i'm wrong in this, and i'm missing something. I hate not
to use something because of something I've not understood.

Many thanks

mark

On 3-12-2002 17:34, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> What u mean by dynamically generating a form?
> Its a normal form(Extends ActionForm).
> And the action to deal with will be what ever action u define to achieve
this
> functionality.It will be a very simple action.
> Home this clarifies the confusion.
> 
> regards,
> Shirish
> 
> -----Original Message-----
> From: marklowe [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 03, 2002 3:11 PM
> To: struts-user
> Cc: marklowe
> Subject: Re: Design Issue in struts
> 
> 
> If you're dynamically generating a form, what action would deal with the
> form produced?
> 
> I have this problem and i'm thinking of using standard java/jsp for this
> problem now.. As I'd have to pass an array of values and one form element
to
> an action. 
> 
> Any thoughts on this issue will be gratfully recieved.
> 
> Thanks in advance
> 
> Mark
> 
> 
> On 3-12-2002 12:10, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
> 
>> Hi,
>> I have implemented pretty much the same functionality in our application.
>> U can do this using Struts actions.When the user presses a button,call an
>> action.In the action add an empty row to the form(add a empty object to
the
>> list on form).And then call the same jsp which will just iterate over the
>> list
>> as earlier.
>> //Pseudo code
>> Form MyForm{
>> List rowList = new ArrayList();
>> public Bean getBean(int index){
>> if(rowList.size < index){
>> rowList.add(new Bean());
>> }
>> return rowList.get(index);
>> }// getObject
>> public void setBean(int index,Bean obj){
>> rowList.setObject(index,obj);
>> }//setBean
>> //getter setter for list
>> public List getRowList (){
>> }
>> public void setRowList (List list){
>> }
>> }//MyForm
>> 
>> //JSP //
>> <table><tr>
>> <logic:iterate name="myForm" property="rowList" indexId="i">
>> <td><html:text name="myForm" property="<%=\"bean[\" + i +
>> \"].name\"%>"></td>
>> <td><html:text name="myForm" property="<%=\"bean[\" + i +
>> \"].location\"%>"></td>
>> </logic:iterate>
>> </tr><table>
>> So when the action is called, all the data on screen will be preserved as
the
>> screen data gets repopulated in the form automatically.Then u add a new
>> object
>> and the jsp cretes new table with a empty row.
>> 
>> Hope this helps.
>> Regards,
>> Shirish
>> 
>> 
>> -----Original Message-----
>> From: graham.cook [mailto:[EMAIL PROTECTED]]
>> Sent: Tuesday, December 03, 2002 11:30 AM
>> To: struts-user
>> Subject: Design Issue in struts
>> 
>> 
>> 
>> Can I use struts to perform the following task:
>> 
>> generate a JSP page, but have multiple entry lines on the page. Im not
going
>> to know how many lines the user is going to enter, so i'd like them to
have
>> some kind of way ( maybe a button ) that the user can click on, the page
>> refreshes (retaining data) and shows a new blank line at the bottom of
the
>> page under the other lines. When im talking lines I mean eg. Name,
Location,
>> DOB, last contact
>> 
>> 
>> -----------------------------------------------
>> 
>> Security Code: 0162
>> 
>> Entry Date:      03/12/2002
>> 
>> 
>> 
>> Name        Location        DOB        Last Contact
>> --------        -----------            ------
>> ------------------
>> Fred        Woking            07/12/1973    11/11/2002
>> Bert        Wolverhampton        04/11/1976    11/11/2002
>> {Add}
>> 
>> 
>> {Submit}     {Reset}
>> -------------------------------------------------
>> 
>> Then when the user presses SUBMIT the action is called and all data
entered
>> into a database.
>> 
>> Has anyone got some real world example of this
>> Ta
>> 
>> 
>> 
>> 
****************************************************************************
*>>
*
>> **
>> ************
>> " This message contains information that may be privileged or
confidential
>> and
>> is the property of the Cap Gemini Ernst & Young Group. It is intended
only
>> for
>> the person to whom it is addressed. If you are not the intended
recipient,
>> you
>> are not authorized to read, print, retain, copy, disseminate, distribute,
or
>> use 
>> this message or any part thereof. If you receive this message in error,
>> please
>> notify the sender immediately and delete all copies of this message ".
>> 
****************************************************************************
*>>
*
>> **
>> ************
>> 
>> 
>> --
>> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>> 
>> 
> 
> 
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
> 
> 
> 
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
> 
> 


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to