This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Form submit using Indexed properties -Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Form submit using Indexed properties -Struts" Watch "Form submit using Indexed properties -Struts" New topic
Author

Form submit using Indexed properties -Struts

Vani Bandargal
Greenhorn

Joined: Jun 20, 2005
Posts: 3
I need help in submitting a form which uses Indexed properties of Struts.

The ActionForm is Like this:

public class TestsupplementForm extends ValidatorActionForm {


private StringCaseKey;
/*
other properties goes here
*/


private LabResults[] data;



public LabResults[] getData() {
return vani;
}

public void setData(LabResults[] data) {
this.data = data;
}
}


public class LabResults {


private StringDiseaseGroup ;
private StringDisease_Code;


public String getDisease_Code() {
return Disease_Code;
}

public void setDisease_Code(String disease_Code) {
Disease_Code = disease_Code;
}

public String getDiseaseGroup() {
return DiseaseGroup;
}

public void setDiseaseGroup(String diseaseGroup) {
DiseaseGroup = diseaseGroup;
}

}

The Struts Config entry is like this:
<form-bean name="TestSupplement" type="TestsupplementForm "></form-bean>

<action name="TestSupplement" path="/testSupplement" scope="request" type="TestAction" parameter="method" validate="false">
<forward name="testSupplAddRow" path="/testSupplement.do?method=doAddLab" />
</action>

I am able to display my dynamic form which goes like this
<html>
<head>
<title>Communicable Disease Electronic Surveillance System</title>
</head>
<link rel="stylesheet" type="text/css" href="jsp/css/cdess.css">
<body class="BodyFont" >
<form name="TestSupplement" method="POST" action="/testSupplement.do" enctype="application/x-www-form-urlencoded">

<input type="text" name="data[0].diseaseGroup" value="31">

<input type="text" name="data[1].diseaseGroup" value="31">

<input type="text" name="data[2].diseaseGroup" value="31">

<input type="submit" name="method" accesskey="S" value="doAddLab">
</form>

</body>
</html>

When I submit my page using addLab I get the following error:
java.lang.NullPointerException
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:515)
.............................

Your help is greatly appreciated.
[ June 20, 2005: Message edited by: Vani Bandargal ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Form submit using Indexed properties -Struts
 
Similar Threads
Check box and Indexed properties
error occuring while use jsp
Indexed properties - I am totally stuck
JSP session
MULTIPART/FORM-DATA