Hello all,
Thanks a lot for your replies. As I'm French, I hope I will clearly expose my
problem. It has been a long time since my last English draft. :)
I've worked for one month on an application. It was created with Woody
framework, which is no longer supported. Consequently my mission is to turn it
to Struts. Work is almost completed, but there is one problem left, I've been
trying fixing it since Monday but I can't do anything, I have a Beanutils
exception :-((.
The application is composed of MySQl 5.0, Hibernate 3.0 and Struts 1.3.10. My
problem is on a formular, hence Struts.
I have a two beans :
- Personne (French translation of Character) with String attributs name and
firstname,
- PageFormulaire (extends ActionForm), with only one attribut, Personne[]
listP.
**I'm sure the exception is caused by this dynamic array.** If I put an unique
bean in PageFormulaire, application perfectly works.
Both beans have setters and getters but I created in PageFormulaire two more :
- public void setNom(int index , Personne nom)
- public Personne getNom(int index)
An action instanciates a PageFormulaire bean, fills in with datas in MySQL,
puts it in request then calls a JSP. That's OK, the formular appears with the
datas. But when clicking submit button, application crashes, and shows this
accursed exception :
javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:475)
org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:50)
org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:60)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
java.lang.NullPointerException
org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:505)
org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:408)
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:760)
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:837)
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:903)
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:830)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:433)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:473)
org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:50)
org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:60)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Here's the JSP :
<%@ taglib uri="/WEB-INF/tld/struts-nested.tld" prefix="n" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="h" %>
<h:html>
<head>
</head>
<body>
<table>
<n:form action="/traitement.do">
<n:iterate name="CLE" property="liste">
<tr>
<td>Nom</td>
<td><n:text property="nom"/></td>
<td>Prénom</td>
<td><n:text property="prenom"/></td>
</tr>
</n:iterate>
<tr>
<td colspan="4"><n:submit value="Enregistrer"/></td>
</tr>
</table>
</n:form>
</body>
</h:html>
I thought I forgot the put the bean on session scope, but although I write it
on struts-config.xml, nothing to do...
<form-beans>
<form-bean name="pageForm" type="bean.PageFormulaire"/>
</form-beans>
<action-mappings>
<action path="/traitement" name="pageForm"
type="presentation.Traitement" scope="session"/>
</action-mappings>
Note : class pathes are obviously correct :)
So, does anyone have an idea ?... If necessary, I may send by mail the WAR
files containing all Java sources.
Thanks for your help.
Sincerly,
Dominique
--- En date de : Jeu 25.11.10, Lukasz Lenart <[email protected]> a
écrit :
> De: Lukasz Lenart <[email protected]>
> Objet: Re: javax.servlet.ServletException: BeanUtils.populate
> À: "Struts Users Mailing List" <[email protected]>
> Date: Jeudi 25 novembre 2010, 22h31
> 2010/11/25 Dominique JUSTE <[email protected]>:
> > Although I have used Struts for five years, I have
> been facing a trouble since Monday and I don't understand
> what's happening...
>
> "Monday, monday ... manic monday..."
>
> http://www.youtube.com/watch?v=lAZgLcK5LzI
>
>
> Kind regards ;-)
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> Kapituła Javarsovia 2010 http://javarsovia.pl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]