struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "fabrice dewasmes" <fdewas...@kaptech.com>
Subject RE: indexed property bug ???
Date Fri, 28 Jun 2002 09:01:14 GMT
HI,

thanks for your help. I tried to add the scope attribute and type attribute
but it still doesn't work. How do you get each of your workflowitembean
correctly set with the user input. For example, say that your
workflowItemBean has a text property 'comment' that you want your user to
fill. The displayed html page will be sthing like :

N° name status comment
1. userOrder OK <input type="text">
2. payment OK <input type="text">
3. sendOrderedItems OK <input type="text">

you want to get workflowItemsBean List correctly filled to update your
database. you would write sthing like this JSP code :

<logic:iterate id="workflowitembean" name="workflowitemsbean"
 property="tasks" scope="request"
 type="com.compuware.optimal.flow.webconsole.example.WorkFlowItemBean">
  <tr>
    <td><bean:write name="workflowitembean" property="name"/></td>
    <td><bean:write name="workflowitembean" property="state"/></td>
    <td><html:text name="workflowitembean" property="comment"/></td>
  </tr>
</logic:iterate>

if you don't use indexed property then you will always get the same name for
the text field. Using indexed="true" differentiates each text field in order
to place the right input text in the right comment property of the right
bean.

this works with session scope but not request scope...

> -----Message d'origine-----
> De : Lips, Kees [mailto:Kees_Lips@nl.compuware.com]
> Envoyé : vendredi 28 juin 2002 10:25
> À : 'struts-user@jakarta.apache.org'
> Objet : RE: indexed property bug ???
>
>
> > Hi,
> >
> > Just to show what I use and it works for me. This working
> example and code
> > can help you to get it to work too.
> > In the an Action class the workflowitemsbean is filled with
> objects of the
> > kind workflowitembean. The workflowitemsbean is saved in
> request scope in
> > the action class. In this way it is available in the jsp. If you want to
> > see the action class code as well just send me an email.
> > Hopefully this is of any help.
> >
> > Kind regards,
> > Kees Lips
> >
> > jsp code used:
> > <logic:iterate id="workflowitembean" name="workflowitemsbean"
> > property="tasks" scope="request"
> > type="com.compuware.optimal.flow.webconsole.example.WorkFlowItemBean">
> >
> > bean code:
> > package com.compuware.optimal.flow.webconsole.example;
> >
> > /**
> >  * This bean holds the data of the WorkflowConnector task object.
> >  *
> >  * A choice is made here to not directly access the list object TaskList
> >  * of the Workflow Connector. This to show that in this way you
> could add
> >  * other information to these beans as well. For example you
> could obtain
> >  * a specific parameter of a task and add this to the
> WorkFlowItemBean as
> > well.
> >  * Or do a translation of the State values and store the
> translated value
> > in the
> >  * bean.
> >  *
> >  * If you do not need extra information or you do not want to translate
> > values,
> >  * the same procedure could be followed as is done for the User-Driven
> > Tasks. Look at
> >  * the @see UserDrivenTaskListAction class.
> >  *
> >  */
> >
> > public class WorkFlowItemBean {
> >
> >    /**
> >     * The id of the task.
> >     */
> >    private String id;
> >
> >    /**
> >     * The name of the task.
> >     */
> >    private String name;
> >
> >    /**
> >     * The state of the task.
> >     */
> >    private String state;
> >
> >    /**
> >     * The priority of the task.
> >     */
> >    private String priority;
> >
> >    /**
> >     * The var1 property of the task. This property is used for unique
> > identification
> >     * of the task. Var1 holds the value of the process variable
> identified
> > by var1label.
> >     */
> >    private String var1;
> >
> >    /**
> >     * The var1label property of the task. Var1Label has the name of a
> > process variable that
> >     * was choosen to be used to identify the task.
> >     */
> >    private String var1label;
> >
> >    /**
> >     * The var2 property of the task. This property is used for unique
> > identification
> >     * of the task. Var2 holds the value of the process variable
> identified
> > by var2label.
> >     */
> >    private String var2;
> >
> >    /**
> >     * The var2label property of the task. Var2Label has the name of a
> > process variable that
> >     * was choosen to be used to identify the task.
> >     */
> >    private String var2label;
> >
> >    /**
> >     * The var3 property of the task. This property is used for unique
> > identification
> >     * of the task. Var3 holds the value of the process variable
> identified
> > by var3label.
> >     */
> >    private String var3;
> >
> >    /**
> >     * The var3label property of the task. Var3Label has the name of a
> > process variable that
> >     * was choosen to be used to identify the task.
> >     */
> >    private String var3label;
> >
> >    /**
> >     * The default empty constructor of this bean. All properties are
> > initialized here.
> >     */
> >    public WorkFlowItemBean() {
> >       this.id = "";
> >       this.name = "";
> >       this.state = "";
> >       this.priority = "";
> >       this.var1 = "";
> >       this.var1label = "";
> >       this.var2 = "";
> >       this.var2label = "";
> >       this.var3 = "";
> >       this.var3label = "";
> >    }
> >
> >    /**
> >     * Set the id of the task.
> >     */
> >    public void setId(String id) {
> > 	   this.id = id;
> >    }
> >
> >    /**
> >     * Get the id of the task.
> >     */
> >    public String getId() {
> > 	   return this.id;
> >    }
> >
> >    public void setName(String name) {
> > 	   this.name = name;
> >    }
> >
> >    public String getName() {
> > 	   return this.name;
> >    }
> >
> >    public void setState(String state) {
> > 	   this.state = state;
> >    }
> >
> >    public String getState() {
> > 	   return this.state;
> >    }
> >
> >    public void setPriority(String priority) {
> > 	   this.priority = priority;
> >    }
> >
> >    public String getPriority() {
> > 	   return this.priority;
> >    }
> >
> >    public void setVar1(String var1) {
> > 	   this.var1 = var1;
> >    }
> >
> >    public String getVar1() {
> > 	   return this.var1;
> >    }
> >
> >    public void setVar1Label(String var1label) {
> > 	   this.var1label = var1label;
> >    }
> >
> >    public String getVar1Label() {
> > 	   return this.var1label;
> >    }
> >
> >    public void setVar2(String var2) {
> > 	   this.var2 = var2;
> >    }
> >
> >    public String getVar2() {
> > 	   return this.var2;
> >    }
> >
> >    public void setVar2Label(String var2label) {
> > 	   this.var2label = var2label;
> >    }
> >
> >    public String getVar2Label() {
> > 	   return this.var2label;
> >    }
> >
> >    public void setVar3(String var3) {
> > 	   this.var3 = var3;
> >    }
> >
> >    public String getVar3() {
> > 	   return this.var3;
> >    }
> >
> >    public void setVar3Label(String var3label) {
> > 	   this.var3label = var3label;
> >    }
> >
> >    public String getVar3Label() {
> > 	   return this.var3label;
> >    }
> >
> > }
> >
> >
> > package com.compuware.optimal.flow.webconsole.example;
> >
> > import java.util.List;
> > import java.util.ArrayList;
> >
> > /**
> >  * Holds WorkFlowItemBean objects. This class is maintained in request
> > scope and is created
> >  * by the @see WorkFlowDrivenTaskListAction.
> >  */
> > public class WorkFlowItemsBean {
> >
> >    /**
> >     * The list of tasks or WorkFlowItemBean objects.
> >     */
> >    private List tasks;
> >
> >    /**
> >     * Creates a new WorkFlowItemsBean object.
> >     */
> >    public WorkFlowItemsBean() {
> >       this.tasks = new ArrayList();
> >    }
> >
> >    /**
> >     * Get the List of WorkFlowItemBeans.
> >     */
> >    public List getTasks() {
> > 	   return this.tasks;
> >    }
> >
> >    /**
> >     * Add a WorkFlowItemBean to the internal List of the
> WorkFlowItemsBean
> > object.
> >     */
> >    public void add(WorkFlowItemBean item) {
> > 	   boolean b = this.tasks.add(item);
> >    }
> >
> > }
> >
> >
> >
> >
> >
> > fabrice dewasmes [fdewasmes@kaptech.com] wrote:
> >
> > Hello, i post this again as noone seems to care...
> >
> > has anyone ever tried to use the indexed property with Struts1.1 ? My
> > problem is that i can't get it work when the form bean is in request
> > scope.
> > The collection that i'm getting from user input is null. Here's my jsp
> > code
> > :
> >
> > <logic:iterate id="loggerList" name="loggingForm" property="loggerList">
> >   <tr>
> >     <td><bean:write name="loggerList" property="name"
> filter="true"/></td>
> >     <td><html:radio name="loggerList" property="level" value="DEBUG"
> > indexed="true"/></td>
> >     <td><html:radio name="loggerList" property="level" value="INFO"
> > indexed="true"/></td>
> >     <td><html:radio name="loggerList" property="level" value="WARN"
> > indexed="true"/></td>
> >     <td><html:radio name="loggerList" property="level" value="ERROR"
> > indexed="true"/></td>
> >     <td><html:radio name="loggerList" property="level" value="FATAL"
> > indexed="true"/></td>
> >   </tr>
> > </logic:iterate>
> >
> >
> > and here's the form bean code :
> >
> > public void setLoggerList(java.util.ArrayList loggerList) {
> >   this.loggerList = loggerList;
> > }
> > public java.util.ArrayList getLoggerList() {
> >   return loggerList;
> > }
> > //method to get the indexed property
> > public LoggerBean getLoggerList(int index){
> >   return (LoggerBean)this.loggerList.get(index);
> > }
> > //method to set the indexed property
> > public void setLoggerList(int index,LoggerBean bean){
> >   loggerList.set(index,bean);
> > }
> >
> > private java.util.ArrayList loggerList;
> >
> > thanks for any help
> >
> > Fabrice
> >
> >
> >
> --
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it,
> or disclose
> it to anyone else. If you received it in error please notify us
> immediately
> and then destroy it.
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


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


Mime
View raw message