aspose file tools*
The moose likes Struts and the fly likes Problem with indexed property ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with indexed property !" Watch "Problem with indexed property !" New topic
Author

Problem with indexed property !

Moniphal Say
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
Hi all,

With Struts, I use logic:iterate tag to iterate over a list of informations. In each iterate, it has the input text field.
When the action is execute, it has the errors.

This is my code in JSP page :

<logic:iterate scope="session" id="indexInfo" name="indexInfoList" >
<tr>
<td>
<html:text indexed="true" name="indexInfo" property="name" value="" />
</td>
</tr>
</logic:iterate>

"name" is the property of an object indexInfo.


And this is my Action Form :

public class SearchForm extends ActionForm {

private String[] name = new String[20];
...........

public String[] getName() {
return name;
}

public void setName(String[] strings) {
name = strings;
}
............
}


And this is my Action Servlet :

...........

String[] indexValue = ((SearchForm)form).getName();

...........


And when the action is execute, the error message is :

exception

javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


cause m�re

java.lang.IllegalArgumentException: No bean specified
org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:837)
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)





Any idear for this please !
I really need helps from you all !

regards,
Moniphal
[ August 17, 2004: Message edited by: Moniphal SAY ]

<b>The more we learn, the more we know !</b>
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134

<logic:iterate scope="session" id="indexInfo" name="indexInfoList" >


Is your bean indexInfoList in session scope?


"Failure is not when you fall down; its only when you fail to get up again."
Moniphal Say
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
Yes Shankar, I have saved the bean "indexInfoList" in the scope "session" !
I've tried this :
in the JSP, I take out the code : <html:text indexed="true" ..... />
and also take out the property : name and its setter and getter methods from my actionForm and actionServlet.

The errors messages disappear !!!
So I think the problem is with the <html:text indexed="true" ..... /> and in actionForm. But I really dont know how to solve it. And also I have to put it in my project.

Your help would be great !
Moniphal
Tankred Smult
Greenhorn

Joined: Jul 15, 2003
Posts: 16
Have you tried
<nested:text property="name"/>

instead of <html:text> ?

(Don't remember, but you might have to set the type in your iteration, something like:
<nested:iterate ... type="com.somepackage.IndexInfo">
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Hi,

I had gone through the <html:text> documentation for the indexed
property and according to my understanding, your code should work in this
way.

I suppose "indexInfoList" is of type collection/array/etc... , so when you
are putting the "indexed=true" in <html:text> it is interpreted as
indexInfo[1].name, indexInfo[2].name for each iteration incrementing the
count. Verify your indexInfoList bean. I had a similar situation but i
have used the nested tags.


Hope this should give some ideas to solve your problem.


Regards,
Shankar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with indexed property !