Hi All,
I have my JSP page which obtains user entered values and utilizes them to be sent as parameters to a function inside the governing java class.
So my custom elements are as follows
JSP - sendToDistributionList.jsp
JAVA - DummyComponent.java
The JSP has a list box to obtain multiple values from the user.
<tr>
<td scope="row" valign="middle" class="sendToListLabelPadding fieldLabel">
<dmf:label nlsid='MSG_TARGET_LANGUAGE'/>
</td>
<td class="leftAlignment">
<dmf:panel name="test">
<tr><td align="right">
<dmf:listbox width="180" name="<%=DummyComponent.TARLANG_LISTBOX_CONTROL_NAME%>" size='5' multiselect='true' cssclass='BrowseNumberList' runatclient='true' >
<dmf:option id = "item1" value="fr-fr" label="French(France)" />
<dmf:option id = "item2" value="zh-cn" label="Chinese(Simplified)" />
<dmf:option id = "item3" value="zh-tw" label="Chinese(Taiwan)" />
<dmf:option id = "item4" value="da-dk" label="Danish" />
</dmf:listbox>
</dmf:panel>
</td></tr>
</td>
</tr>
In the class file i have assumed that the control will be simply acessing the user selected values and passing them through "DummyComponent.TARLANG_LISTBOX_CONTROL_NAME".So i declared the String in the class file and wrote a function to obtain the user selected multiple values.
public
static final String TARLANG_LISTBOX_CONTROL_NAME = "_TARLANG_LISTBOX_CONTROL_NAME";..
private String [] tarLang ;
...
privateString[]readTarLanguages(){ListBox control = (ListBox)getControl("__TARLANG_LISTBOX_CONTROL_NAME");
if (control != null){
tarLang = control.getParameterNames();
}
System.out.println("This is Target Language" + tarLang[1]);
return tarLang;}
To check whether the user entered value has been captured i wrote the Sysout "System.out.println("This is Target Language" + tarLang[1]);".
This is where i am getting my Null Pointer exception.
I am not sure where the errors is. Is it in the JSP at the location of values acquisition?Or is it in using the control.getParameterNames(); inside my class?
Could any one kindly guide me as to where i can rectify the mistake.
Thank You
Regards.