You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dan Allen <da...@mojavelinux.com> on 2003/03/13 06:32:13 UTC

logic:iterate and html:text

Sorry if this has been asked a million times but it doesn't seem to
be in the exercise-taglibs.war and that last thread I found on it
seemed inconclusive.

I have 5 text boxes where the user can enter names of clients, hence
I want

<input type="text" name="clients[]" value=""/>
<input type="text" name="clients[]" value=""/>
<input type="text" name="clients[]" value=""/>
<input type="text" name="clients[]" value=""/>
<input type="text" name="clients[]" value=""/>

Is the propery way to do it like so?

<logic:iterate id="client" name="myForm" property="clients">
    <html:text property="client" indexed="true" value="<%=client.toString%>" />
</logic:iterate>

Seems like with the scriplet in there it is not the "ideal" way to
do it.  Any takers?

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
umm... i guess this is my signature. 8-}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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


Re: logic:iterate and html:text

Posted by Dan Allen <da...@mojavelinux.com>.
> http://jakarta.apache.org/struts/faqs/indexedprops.html

Thank you!!!!!  That was the link I was hunting for!  Awesome!  Now
I totally understand what is going on with indexed form properties.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
"The Linux philosophy is to laugh in face of danger.  Oops. 
Wrong one. 'Do it yourself' That's it" 
 -- Linus Torvalds
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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


RE: mapped propeties problem and need advice

Posted by Jason Long <ja...@supernovasoftware.com>.
I am getting the following:
org.apache.jasper.JasperException: No getter method for property
stringMapped(102_price) of bean bean

I did get this to work with indexed properties, but I need to access the
values by name not an index number.  Have you ever used mapped properties?

I am hoping this is just some stupid syntax error.

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering

-----Original Message-----
From: Mark [mailto:struts@webpit.com]
Sent: Thursday, March 13, 2003 8:13 AM
To: struts-user@jakarta.apache.org
Subject: Re: mapped propeties problem and need advice


yes, thats the correct way to reference mapped properties.  what exactly is
the problem you're having?

*********** REPLY SEPARATOR  ***********

On 03/13/2003 at 3:47 AM Jason Long wrote:

>I have been trying to set up some mapped properties in a form.
>It is currently not working.
>Would someone please look over what I am trying to do and comment on the
>technique?
>
>This was taken from the following:
>http://jakarta.apache.org/struts/faqs/indexedprops.html
>
>I modified the code from the faq slightly, but it is essentially the same.
>
>If this works I was hoping to populate the map with the request parameters.
>Since I am using XSL to generate the pages, I can easily add <bean:write
>property="stringMapped(XXXXXXXX)" name="bean" />
>in order to repopulate the fields as the JSP recompiles.
>
>This method seems to solve the problems I am having.  I would appreciate
any
>advice anyone has.
>
>Thank you for your time,
>
>Jason Long - CEO and Chief Software Engineer
>Supernova Software - supernovasoftware.com
>BS Physics, MS  Chemical Engineering
>
>***************************************************************************
*
>******
>My setup
>***************************************************************************
*
>******
>
>ManagerForm.java
>***************************************************************************
*
>******
>public final class ManagerForm
>    extends ActionForm {
>  private HashMap map = new HashMap();
>
>  public ManagerForm() {
>    map.put("102_price", "578854");
>  }
>
>  public Object getStringMapped(String key) {
>    return (map.get(key));
>  }
>
>  public void setStringMapped(String key, Object value) {
>    map.put(key, value);
>  }
>
>  public void reset(ActionMapping mapping, HttpServletRequest request) {
>  }
>
>  public ActionErrors validate(ActionMapping mapping,
>                               HttpServletRequest request) {
>
>    ActionErrors errors = new ActionErrors();
>    return errors;
>  }
>}
>
>JSP Code
>***************************************************************************
*
>******
><jsp:useBean class="org.apache.struts.webapp.example.ManagerForm" id="bean"
>/>
><bean:write property="stringMapped(102_price)" name="bean" />
>
>Error:
>***************************************************************************
*
>******
>org.apache.jasper.JasperException: No getter method for property
>stringMapped(102_price) of bean bean
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org




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



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


Re: mapped propeties problem and need advice

Posted by Mark <st...@webpit.com>.
yes, thats the correct way to reference mapped properties.  what exactly is the problem you're having?

*********** REPLY SEPARATOR  ***********

On 03/13/2003 at 3:47 AM Jason Long wrote:

>I have been trying to set up some mapped properties in a form.
>It is currently not working.
>Would someone please look over what I am trying to do and comment on the
>technique?
>
>This was taken from the following:
>http://jakarta.apache.org/struts/faqs/indexedprops.html
>
>I modified the code from the faq slightly, but it is essentially the same.
>
>If this works I was hoping to populate the map with the request parameters.
>Since I am using XSL to generate the pages, I can easily add <bean:write
>property="stringMapped(XXXXXXXX)" name="bean" />
>in order to repopulate the fields as the JSP recompiles.
>
>This method seems to solve the problems I am having.  I would appreciate any
>advice anyone has.
>
>Thank you for your time,
>
>Jason Long - CEO and Chief Software Engineer
>Supernova Software - supernovasoftware.com
>BS Physics, MS  Chemical Engineering
>
>****************************************************************************
>******
>My setup
>****************************************************************************
>******
>
>ManagerForm.java
>****************************************************************************
>******
>public final class ManagerForm
>    extends ActionForm {
>  private HashMap map = new HashMap();
>
>  public ManagerForm() {
>    map.put("102_price", "578854");
>  }
>
>  public Object getStringMapped(String key) {
>    return (map.get(key));
>  }
>
>  public void setStringMapped(String key, Object value) {
>    map.put(key, value);
>  }
>
>  public void reset(ActionMapping mapping, HttpServletRequest request) {
>  }
>
>  public ActionErrors validate(ActionMapping mapping,
>                               HttpServletRequest request) {
>
>    ActionErrors errors = new ActionErrors();
>    return errors;
>  }
>}
>
>JSP Code
>****************************************************************************
>******
><jsp:useBean class="org.apache.struts.webapp.example.ManagerForm" id="bean"
>/>
><bean:write property="stringMapped(102_price)" name="bean" />
>
>Error:
>****************************************************************************
>******
>org.apache.jasper.JasperException: No getter method for property
>stringMapped(102_price) of bean bean
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org




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


RE: mapped propeties problem and need advice

Posted by Jason Long <ja...@supernovasoftware.com>.
I found the following:
http://ux-2d01.inf.fh-brs.de:8080/struts-documentation/userGuide/installatio
n.html

Running Struts Applications Under A Security Manager
Many application servers execute web applications under the control of a
Java security manager, with restricted permissions on what classes in the
web application can do. If you utilize form beans with mapped properties,
you may encounter security exceptions unless you add the following
permission to the set of permissions granted to your Struts application's
codebase:

permission java.lang.RuntimePermission "accessDeclaredMembers";

I am not sure is this is my problem.

Has anyone seem this or can explain how to add permission in tomcat?

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering

-----Original Message-----
From: Jason Long [mailto:jason@supernovasoftware.com]
Sent: Thursday, March 13, 2003 3:47 AM
To: Struts Users Mailing List
Subject: mapped propeties problem and need advice


I have been trying to set up some mapped properties in a form.
It is currently not working.
Would someone please look over what I am trying to do and comment on the
technique?

This was taken from the following:
http://jakarta.apache.org/struts/faqs/indexedprops.html

I modified the code from the faq slightly, but it is essentially the same.

If this works I was hoping to populate the map with the request parameters.
Since I am using XSL to generate the pages, I can easily add <bean:write
property="stringMapped(XXXXXXXX)" name="bean" />
in order to repopulate the fields as the JSP recompiles.

This method seems to solve the problems I am having.  I would appreciate any
advice anyone has.

Thank you for your time,

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering

****************************************************************************
******
My setup
****************************************************************************
******

ManagerForm.java
****************************************************************************
******
public final class ManagerForm
    extends ActionForm {
  private HashMap map = new HashMap();

  public ManagerForm() {
    map.put("102_price", "578854");
  }

  public Object getStringMapped(String key) {
    return (map.get(key));
  }

  public void setStringMapped(String key, Object value) {
    map.put(key, value);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
  }

  public ActionErrors validate(ActionMapping mapping,
                               HttpServletRequest request) {

    ActionErrors errors = new ActionErrors();
    return errors;
  }
}

JSP Code
****************************************************************************
******
<jsp:useBean class="org.apache.struts.webapp.example.ManagerForm" id="bean"
/>
<bean:write property="stringMapped(102_price)" name="bean" />

Error:
****************************************************************************
******
org.apache.jasper.JasperException: No getter method for property
stringMapped(102_price) of bean bean



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



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


RE: mapped propeties problem and need advice

Posted by Jason Long <ja...@supernovasoftware.com>.
I am not using logic:itererate.  I am generating each
property="stringMapped(XXXXXXXX)" using xsl.  It works with indexed
properties, but not with mapped ones.  I need to use mapped properties in my
application.

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering

-----Original Message-----
From: apachep2 [mailto:apachep2@hotmail.com]
Sent: Thursday, March 13, 2003 8:44 AM
To: 'Struts Users Mailing List'
Subject: RE: mapped propeties problem and need advice


I am switching from Collection to Map. What I am going to do is,

Before switching

<logic:iterate name="myactionform" property="myorder" id="mylineitem">
	<html:text name="mylineitem" property="myitemname"/>
	<html:text name="mylineitem" property="myorderquantity"/>
</logic:iterate>

After switching

<logic:iterate name="myactionform" property="myorder" id="key">
	<html:text name="key" property="value.myitemname"/>
	<html:text name="key" property="value.myorderquantity"/>
</logic:iterate>

logic:iterate tag doc tells us that "However, if you iterate over a Map,
the exposed object is of type Map.Entry that has two properties:".
According to Map.Entry Javadoc, it has getKey and getValue, in my case,
key is my item id and value returns my line item.

Don't know whether it will work but hope the above example give you some
hints.

-----Original Message-----
From: Jason Long [mailto:jason@supernovasoftware.com]
Sent: March 13, 2003 4:47 AM
To: Struts Users Mailing List
Subject: mapped propeties problem and need advice

I have been trying to set up some mapped properties in a form.
It is currently not working.
Would someone please look over what I am trying to do and comment on the
technique?

This was taken from the following:
http://jakarta.apache.org/struts/faqs/indexedprops.html

I modified the code from the faq slightly, but it is essentially the
same.

If this works I was hoping to populate the map with the request
parameters.
Since I am using XSL to generate the pages, I can easily add <bean:write
property="stringMapped(XXXXXXXX)" name="bean" />
in order to repopulate the fields as the JSP recompiles.

This method seems to solve the problems I am having.  I would appreciate
any
advice anyone has.

Thank you for your time,

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering

************************************************************************
****
******
My setup
************************************************************************
****
******

ManagerForm.java
************************************************************************
****
******
public final class ManagerForm
    extends ActionForm {
  private HashMap map = new HashMap();

  public ManagerForm() {
    map.put("102_price", "578854");
  }

  public Object getStringMapped(String key) {
    return (map.get(key));
  }

  public void setStringMapped(String key, Object value) {
    map.put(key, value);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
  }

  public ActionErrors validate(ActionMapping mapping,
                               HttpServletRequest request) {

    ActionErrors errors = new ActionErrors();
    return errors;
  }
}

JSP Code
************************************************************************
****
******
<jsp:useBean class="org.apache.struts.webapp.example.ManagerForm"
id="bean"
/>
<bean:write property="stringMapped(102_price)" name="bean" />

Error:
************************************************************************
****
******
org.apache.jasper.JasperException: No getter method for property
stringMapped(102_price) of bean bean



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

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



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


RE: mapped propeties problem and need advice

Posted by apachep2 <ap...@hotmail.com>.
I am switching from Collection to Map. What I am going to do is,

Before switching

<logic:iterate name="myactionform" property="myorder" id="mylineitem">
	<html:text name="mylineitem" property="myitemname"/>
	<html:text name="mylineitem" property="myorderquantity"/>
</logic:iterate>

After switching

<logic:iterate name="myactionform" property="myorder" id="key">
	<html:text name="key" property="value.myitemname"/>
	<html:text name="key" property="value.myorderquantity"/>
</logic:iterate>

logic:iterate tag doc tells us that "However, if you iterate over a Map,
the exposed object is of type Map.Entry that has two properties:".
According to Map.Entry Javadoc, it has getKey and getValue, in my case,
key is my item id and value returns my line item.

Don't know whether it will work but hope the above example give you some
hints.

-----Original Message-----
From: Jason Long [mailto:jason@supernovasoftware.com] 
Sent: March 13, 2003 4:47 AM
To: Struts Users Mailing List
Subject: mapped propeties problem and need advice

I have been trying to set up some mapped properties in a form.
It is currently not working.
Would someone please look over what I am trying to do and comment on the
technique?

This was taken from the following:
http://jakarta.apache.org/struts/faqs/indexedprops.html

I modified the code from the faq slightly, but it is essentially the
same.

If this works I was hoping to populate the map with the request
parameters.
Since I am using XSL to generate the pages, I can easily add <bean:write
property="stringMapped(XXXXXXXX)" name="bean" />
in order to repopulate the fields as the JSP recompiles.

This method seems to solve the problems I am having.  I would appreciate
any
advice anyone has.

Thank you for your time,

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering

************************************************************************
****
******
My setup
************************************************************************
****
******

ManagerForm.java
************************************************************************
****
******
public final class ManagerForm
    extends ActionForm {
  private HashMap map = new HashMap();

  public ManagerForm() {
    map.put("102_price", "578854");
  }

  public Object getStringMapped(String key) {
    return (map.get(key));
  }

  public void setStringMapped(String key, Object value) {
    map.put(key, value);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
  }

  public ActionErrors validate(ActionMapping mapping,
                               HttpServletRequest request) {

    ActionErrors errors = new ActionErrors();
    return errors;
  }
}

JSP Code
************************************************************************
****
******
<jsp:useBean class="org.apache.struts.webapp.example.ManagerForm"
id="bean"
/>
<bean:write property="stringMapped(102_price)" name="bean" />

Error:
************************************************************************
****
******
org.apache.jasper.JasperException: No getter method for property
stringMapped(102_price) of bean bean



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

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


mapped propeties problem and need advice

Posted by Jason Long <ja...@supernovasoftware.com>.
I have been trying to set up some mapped properties in a form.
It is currently not working.
Would someone please look over what I am trying to do and comment on the
technique?

This was taken from the following:
http://jakarta.apache.org/struts/faqs/indexedprops.html

I modified the code from the faq slightly, but it is essentially the same.

If this works I was hoping to populate the map with the request parameters.
Since I am using XSL to generate the pages, I can easily add <bean:write
property="stringMapped(XXXXXXXX)" name="bean" />
in order to repopulate the fields as the JSP recompiles.

This method seems to solve the problems I am having.  I would appreciate any
advice anyone has.

Thank you for your time,

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering

****************************************************************************
******
My setup
****************************************************************************
******

ManagerForm.java
****************************************************************************
******
public final class ManagerForm
    extends ActionForm {
  private HashMap map = new HashMap();

  public ManagerForm() {
    map.put("102_price", "578854");
  }

  public Object getStringMapped(String key) {
    return (map.get(key));
  }

  public void setStringMapped(String key, Object value) {
    map.put(key, value);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
  }

  public ActionErrors validate(ActionMapping mapping,
                               HttpServletRequest request) {

    ActionErrors errors = new ActionErrors();
    return errors;
  }
}

JSP Code
****************************************************************************
******
<jsp:useBean class="org.apache.struts.webapp.example.ManagerForm" id="bean"
/>
<bean:write property="stringMapped(102_price)" name="bean" />

Error:
****************************************************************************
******
org.apache.jasper.JasperException: No getter method for property
stringMapped(102_price) of bean bean



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


RE: logic:iterate and html:text -- mapped propeties????

Posted by Jason Long <ja...@supernovasoftware.com>.
I am also looking for an answer to a similar question.  I was reading about
Struts-EL.  What I need is to keep values that have been added before
validation.  Currently if one text box in not valid, all changes are reset.
I got this to work with multibox.  I need this to function in a similar
manner.

I am currently using XSL to generate the struts pages.
<html:text property="{@id}_price" value="{@price}" styleClass="input8"
onchange="changeColor('#B1BBD6');"/>

I can assign a unique id to every property, but I still do not I do not
really want to change my design to use logic:iterate.  I like creating the
jsps with XSL.
I have worked out a way to validate and specify which fields have errors.
Does anyone have any advice? Would it be possible to use mapped properties
for this case?

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering



-----Original Message-----
From: Mark [mailto:struts@webpit.com]
Sent: Wednesday, March 12, 2003 11:41 PM
To: struts-user@jakarta.apache.org
Subject: Re: logic:iterate and html:text


im not sure if i answered that completely, let me read it again and get back
to you ;)

*********** REPLY SEPARATOR  ***********

On 03/12/2003 at 11:38 PM Mark wrote:

>It would be easier for some of us if your emails didnt come through as
attachments ;)
>
>but to answer this you dont need value="" for this
>
>thats what the property does
>so what you want is
>
><logic:iterate id="client" name="myForm" property="clients">
>    <html:text property="client" indexed="true" />
></logic:iterate>
>
>And what kind of form bean are you storing this in?
>
>I have some other advice about a problem you're about to discover in struts
but i'll let you discover it first ;)
>
>Regards,
>Mark
>Aim/Yahoo Msgr: thetazzbot
>
>you wrote:
>
>Sorry if this has been asked a million times but it doesn't seem to
>be in the exercise-taglibs.war and that last thread I found on it
>seemed inconclusive.
>
>I have 5 text boxes where the user can enter names of clients, hence
>I want
>
><input type="text" name="clients[]" value=""/>
><input type="text" name="clients[]" value=""/>
><input type="text" name="clients[]" value=""/>
><input type="text" name="clients[]" value=""/>
><input type="text" name="clients[]" value=""/>
>
>Is the propery way to do it like so?
>
><logic:iterate id="client" name="myForm" property="clients">
>    <html:text property="client" indexed="true"
value="<%=client.toString%>" />
></logic:iterate>
>
>Seems like with the scriplet in there it is not the "ideal" way to
>do it.  Any takers?
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org




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



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


Re: logic:iterate and html:text

Posted by Mark <st...@webpit.com>.
im not sure if i answered that completely, let me read it again and get back to you ;)

*********** REPLY SEPARATOR  ***********

On 03/12/2003 at 11:38 PM Mark wrote:

>It would be easier for some of us if your emails didnt come through as attachments ;)
>
>but to answer this you dont need value="" for this
>
>thats what the property does
>so what you want is
>
><logic:iterate id="client" name="myForm" property="clients">
>    <html:text property="client" indexed="true" />
></logic:iterate>
>
>And what kind of form bean are you storing this in?
>
>I have some other advice about a problem you're about to discover in struts but i'll let you discover it first ;)
>
>Regards,
>Mark
>Aim/Yahoo Msgr: thetazzbot
>
>you wrote:
>
>Sorry if this has been asked a million times but it doesn't seem to
>be in the exercise-taglibs.war and that last thread I found on it
>seemed inconclusive.
>
>I have 5 text boxes where the user can enter names of clients, hence
>I want
>
><input type="text" name="clients[]" value=""/>
><input type="text" name="clients[]" value=""/>
><input type="text" name="clients[]" value=""/>
><input type="text" name="clients[]" value=""/>
><input type="text" name="clients[]" value=""/>
>
>Is the propery way to do it like so?
>
><logic:iterate id="client" name="myForm" property="clients">
>    <html:text property="client" indexed="true" value="<%=client.toString%>" />
></logic:iterate>
>
>Seems like with the scriplet in there it is not the "ideal" way to
>do it.  Any takers?
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org




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


Re: logic:iterate and html:text

Posted by Mark Lowe <ml...@officinedigitali.it>.
I think that using an old fashioned form bean is better when you're 
looking at generating forms in this manner..

do the nested tag tutorial is does what you are doing but it's not ugly 
as hell. www.keyboardmonkey.com

its what you are after...


Giovedì, 13 mar 2003, alle 08:23 Europe/Rome, Dan Allen ha scritto:

> Okay, I finally worked it out, but it is ugly as hell.  Pardon me if
> I step on toes or shine my ignorance, but it seems to me like this
> problem should be resolved more gracefully.  First of all, I have to
> resort to scriptlets and secondly, I have to include the name of the
> form in the logic:iterate tag, which means that I have to change it
> if I change the name of the form.  I guess that is okay, but it
> still doesn't seem right.  I guess it will keep me happy for now.
> For those interested:
>
> <logic:iterate id="item" name="testForm" property="items" indexId="i">
>   <html:text property="<%="items[" + i + "]"%>"/>
> </logic:iterate>
>
> Assuming I had a DynaActionForm with the definition
>
> <form-bean name="testForm" 
> type="org.apache.struts.action.DynaActionForm">
>   <form-property name="items" type="java.lang.String[]" 
> initial="{'','','',''}"/>
> </form-bean>
>
> It would render
>
> <html type="text" name="items[0]" value=""/>
> <html type="text" name="items[1]" value=""/>
> <html type="text" name="items[2]" value=""/>
> <html type="text" name="items[3]" value=""/>
>
> Dan
>
> p.s.
>
>> It would be easier for some of us if your emails didnt come
>> through as attachments ;)
> My e-mails definitely don't come as attachments, maybe it is just
> your e-mail client :)  My e-mails are as plain as plain/text can be,
> just as Mutt delivers them.  Perhaps your e-mail client renders text
> e-mails as attachments.  Sorry it causes you an inconvenience but I
> really don't think it is something I need to change on my part.
>
> -- 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Daniel Allen, <da...@mojavelinux.com>
> http://www.mojavelinux.com/
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Microsoft is not the answer, it is the question.
> The answer is NO!
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: logic:iterate and html:text

Posted by Dan Allen <da...@mojavelinux.com>.
Okay, I finally worked it out, but it is ugly as hell.  Pardon me if
I step on toes or shine my ignorance, but it seems to me like this
problem should be resolved more gracefully.  First of all, I have to
resort to scriptlets and secondly, I have to include the name of the
form in the logic:iterate tag, which means that I have to change it
if I change the name of the form.  I guess that is okay, but it
still doesn't seem right.  I guess it will keep me happy for now.
For those interested:

<logic:iterate id="item" name="testForm" property="items" indexId="i">
  <html:text property="<%="items[" + i + "]"%>"/>
</logic:iterate>

Assuming I had a DynaActionForm with the definition

<form-bean name="testForm" type="org.apache.struts.action.DynaActionForm">
  <form-property name="items" type="java.lang.String[]" initial="{'','','',''}"/>
</form-bean>

It would render

<html type="text" name="items[0]" value=""/>
<html type="text" name="items[1]" value=""/>
<html type="text" name="items[2]" value=""/>
<html type="text" name="items[3]" value=""/>

Dan

p.s.

> It would be easier for some of us if your emails didnt come
> through as attachments ;)
My e-mails definitely don't come as attachments, maybe it is just
your e-mail client :)  My e-mails are as plain as plain/text can be,
just as Mutt delivers them.  Perhaps your e-mail client renders text
e-mails as attachments.  Sorry it causes you an inconvenience but I
really don't think it is something I need to change on my part.

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Microsoft is not the answer, it is the question. 
The answer is NO!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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


Re: logic:iterate and html:text

Posted by Mark <st...@webpit.com>.
It would be easier for some of us if your emails didnt come through as attachments ;)

but to answer this you dont need value="" for this

thats what the property does
so what you want is

<logic:iterate id="client" name="myForm" property="clients">
    <html:text property="client" indexed="true" />
</logic:iterate>

And what kind of form bean are you storing this in?

I have some other advice about a problem you're about to discover in struts but i'll let you discover it first ;)

Regards,
Mark
Aim/Yahoo Msgr: thetazzbot

you wrote:

Sorry if this has been asked a million times but it doesn't seem to
be in the exercise-taglibs.war and that last thread I found on it
seemed inconclusive.

I have 5 text boxes where the user can enter names of clients, hence
I want

<input type="text" name="clients[]" value=""/>
<input type="text" name="clients[]" value=""/>
<input type="text" name="clients[]" value=""/>
<input type="text" name="clients[]" value=""/>
<input type="text" name="clients[]" value=""/>

Is the propery way to do it like so?

<logic:iterate id="client" name="myForm" property="clients">
    <html:text property="client" indexed="true" value="<%=client.toString%>" />
</logic:iterate>

Seems like with the scriplet in there it is not the "ideal" way to
do it.  Any takers?



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