• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Problem with indexed property !

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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



Is your bean indexInfoList in session scope?
 
Moniphal Say
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic