You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Uladzimir Kavalchuk <Ul...@epam.com> on 2001/12/13 12:44:03 UTC
RE: How to extract multiple columns of data in an
tag ?
I had to do the same thing. My bean model is Iterator. Everything WORKS.
Use nested iterate tags on the same name, BUT! you must call previous() in
nested iterate.
<logic:iterate id="dummy" name="groupModel">
<tr><jsp:setProperty name="groupModel" property="back"
value=""/>
<logic:iterate id="dummy2" name="groupModel"
length="2">
<td width="49%" valign="top">...
<jsp:getProperty name="groupModel"
property="procDescription"/>
</td>...
</logic:iterate>
</tr>
</logic:iterate>
Please notice:
1. Usage of length attribute in nested <iterate>;
2. Call to "hack" setProperty/back, which does something similar to
previous().
I think this SHOULD be fixed by Struts writers:
...EVERYTHING IS APPROXIMATE:
.... IterateTag.java...
boolean dontNext;
Tag tag = findAncestorWithClass( this, IterateTag.class);
if( tag != null && tag.getName().equals(getName()) ) { // we are in
nested iterate on the same name
dontNext = true; // parent tag also hasNext, otherwise how could we
come here?
}
... if( ! dontNext) // add this line
... next() ....
-----Original Message-----
From: SHURTLEFF,ROBERT (HP-FtCollins,ex1) [mailto:robert_shurtleff@hp.com]
Sent: 13 ??????? 2001 ?. 3:33
To: struts-user@jakarta.apache.org
Subject: How to extract multiple columns of data in an <logic:iterate> tag ?
Assume that the ActionForm has the getter for the below "myhashtable" that
returns a Map.
Assume that the .value returns an Array of Strings (or whatever)
I want to build a <table> with 4 columns in it with the <logic:iterate> .
I copied the below code from the STRUTS Developers Guide:
<logic:iterate id="element" name="myhashtable">
Next element is <bean:write name="element" property="value"/>
</logic:iterate>
Assume that a typical record is like:
Map.key = "myKey"
Map.value = [ "myvalue", "mydesc", "myotherdata" ]
But, how do I get the 0th, 1st, 2nd, etc. columns data out of the .value?
Does this work?
<logic:iterate id="element" name="myhashtable">
Next element key is <bean:write name="element" property="key"/>
Next element value 0 is <bean:write name="element" property="value[0]"/>
Next element value 1 is <bean:write name="element" property="value[0]"/>
Next element value 2 is <bean:write name="element" property="value[0]"/>
</logic:iterate>
What if .value was a Class like
public class myRecord{
.getValue()
.getDesc()
.getOtherData()
}
How would you call the getters to get the data?
All help is appreciated.
Robert
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Problem with Multipart form-data
Posted by Pranjal Bhatnagar <pr...@liqwidkrystal.com>.
Hi!!
I am a new user of Struts and would really appreciate if one of u
could help us with the problem we are facing.
We are trying to use getParameter method of MultipartRequestWrapper class.
We prepare a HTML form with enctype=multipart/form-data. On Submit, the
doPost method of the Servlet is called. In the post method, we instantiate
MultipartRequestWrapper by
MultipartRequestWrapper mrw = new MultipartRequestWrapper(request); //
HttpServletRequest request
We then try to get a parameter title using the following call
mrw.getParameter("title");
This parameter was set initially in the form. However getParameter() returns
a null on execution.
Even getParameterNames() returns null;
How can we retrieve the value of this parameter correctly ?
Thanks in advance,
Pranjal
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>