Hi,
I developed one html page that contains one combo box for selectig mulltiple products to purchase with required quantity. I used innerHTML to add the textfield dynamically to enter the required number of quantity to selected products.
The problem arises when i submit the form and try to get all corresponding values in another jsp page using request.getPara meterValues("va l") and request.getPara meter("sale") its working perfectly in Internet Explorer(IE) without any error, but when i tried to run the same files in Mozilla Firefox it showed java.lang.NullP ointerException .
Herewith i also add the code for your consideration. What i made a mistake in those file,
If anybody knows the solution let me know....
I am using Mozilla, Internet Explorer and Apache Tomcat 4.1.3, OS: Windows
Thanks in Advance,
V. Prasath
Html File:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Order Brief</title>
</head>
<body>
<SCRIPT language=javasc ript>
function showSelection(i ndex)
{
//alert("In showSelection() ");
// var selections=docu ment.search.IND EX_NAME.selecte d
var selections="";
for(var i=0;i<index.opt ions.length;i++ )
{
if(index.option s[i].selected)
selections+="<d iv><table><tr>< td width='148' colspan='4' height='19' align='right'>< font color='red' face='verdana' size='2'>"+inde x.options[i].text+":</td><td width='359' height='19'>&nb sp; &nb sp;<input type='text' name='val' size=5><br></td></tr></table></div>";
}
if( selections.leng th !=0)
{
selections=sele ctions.substrin g(0,selections. length-1);
}
document.getEle mentById("selec tedIndexes").in nerHTML=selecti ons;
// alert("Selectio ns :"+selection s);
}
</SCRIPT>
<table bgcolor="white" >
<form name="test" method="post" action="test.js p">
<tr>
<td width="335" colspan="3" height="19"><b> <font face="Verdana" size="2">
<span style="backgrou nd-color: #FFE680"> Select Products :</span></font></b></td>
<td width="8" height="19">&nb sp;</td>
<td width="12" height="19">&nb sp;</td>
<td width="148" colspan="4" height="19"><b> <font face="Verdana" size="2">Name of Products</font></b></td>
<td width="359" height="19"><b> <font face="Verdana" size="2"> Quantity</font></b></td>
</tr>
<tr>
<td width="335" colspan="3" rowspan="3" height="59">
<p align="center">
<SELECT onchange=showSe lection(this) multiple size=4 name=INDEX_NAME style="font-family: Verdana; font-size: 10pt; font-weight: bold">
<OPTION value=CAP>
Spirovit SP-1<OPTION value=TOIA>PC Spirometry<OPTI ON value=TOIBG>
Cardioplus<OPTI ON value=TOIKM>Vis tron CT<OPTION value=TOIPU>
Mark V Provis<OPTION value=TOIL>BP-102 plus<OPTION value=TOIH>
Maglife C Plus</SELECT></td>
<td width="8" height="19">&nb sp;</td>
<td width="12" height="57" rowspan="3">&nb sp;</td>
<td width="507" colspan="5" rowspan="3" height="59"><SP AN id=selectedInde xes></span></td>
</tr>
<tr>
<td >
</td>
</tr><tr>
<td >
</td>
</tr><tr>
<td width="862" colspan="10" height="19" valign="top"><b >
<font size="1" face="Verdana">
<font color="#FF0000" > &n bsp; Press <span class="td_greyB old">
Ctrl key</span> to select multiple products</font></font></b><font color="#FF0000" >.</font></td>
</tr>
<tr>
<td width="187" height="22">
<p align="right">< font face="Verdana" size="2"><b>Sal es Person :</b></font></td>
<td width="5" height="22"></td>
<td width="144" height="22">
<b><font face="Verdana">
<input type="text" name="sale" size="20"></font></b></td>
<td width="8" height="22">&nb sp;</td>
<td width="12" height="22">&nb sp;</td>
<td width="135" height="22">
</tr>
<tr>
<td > &n bsp;   ; &n bsp;
&nb sp; &nb sp;
&nb sp; &nb sp;
<input type="submit" value="Save" name="B1">
</td>
</tr></form>
</body>
</html>
Jsp File:
<%@ page language="java" contentType="te xt/html" %>
<% String get_values[];
get_values=requ est.getParamete rValues("val");
for(int i=0;i<get_value s.length;i++)
{
out.println("Qt y = "+get_value s[i]);
}
out.println("Sa les = "+request.getPa rameter("sale") );
%>
I developed one html page that contains one combo box for selectig mulltiple products to purchase with required quantity. I used innerHTML to add the textfield dynamically to enter the required number of quantity to selected products.
The problem arises when i submit the form and try to get all corresponding values in another jsp page using request.getPara meterValues("va l") and request.getPara meter("sale") its working perfectly in Internet Explorer(IE) without any error, but when i tried to run the same files in Mozilla Firefox it showed java.lang.NullP ointerException .
Herewith i also add the code for your consideration. What i made a mistake in those file,
If anybody knows the solution let me know....
I am using Mozilla, Internet Explorer and Apache Tomcat 4.1.3, OS: Windows
Thanks in Advance,
V. Prasath
Html File:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Order Brief</title>
</head>
<body>
<SCRIPT language=javasc ript>
function showSelection(i ndex)
{
//alert("In showSelection() ");
// var selections=docu ment.search.IND EX_NAME.selecte d
var selections="";
for(var i=0;i<index.opt ions.length;i++ )
{
if(index.option s[i].selected)
selections+="<d iv><table><tr>< td width='148' colspan='4' height='19' align='right'>< font color='red' face='verdana' size='2'>"+inde x.options[i].text+":</td><td width='359' height='19'>&nb sp; &nb sp;<input type='text' name='val' size=5><br></td></tr></table></div>";
}
if( selections.leng th !=0)
{
selections=sele ctions.substrin g(0,selections. length-1);
}
document.getEle mentById("selec tedIndexes").in nerHTML=selecti ons;
// alert("Selectio ns :"+selection s);
}
</SCRIPT>
<table bgcolor="white" >
<form name="test" method="post" action="test.js p">
<tr>
<td width="335" colspan="3" height="19"><b> <font face="Verdana" size="2">
<span style="backgrou nd-color: #FFE680"> Select Products :</span></font></b></td>
<td width="8" height="19">&nb sp;</td>
<td width="12" height="19">&nb sp;</td>
<td width="148" colspan="4" height="19"><b> <font face="Verdana" size="2">Name of Products</font></b></td>
<td width="359" height="19"><b> <font face="Verdana" size="2"> Quantity</font></b></td>
</tr>
<tr>
<td width="335" colspan="3" rowspan="3" height="59">
<p align="center">
<SELECT onchange=showSe lection(this) multiple size=4 name=INDEX_NAME style="font-family: Verdana; font-size: 10pt; font-weight: bold">
<OPTION value=CAP>
Spirovit SP-1<OPTION value=TOIA>PC Spirometry<OPTI ON value=TOIBG>
Cardioplus<OPTI ON value=TOIKM>Vis tron CT<OPTION value=TOIPU>
Mark V Provis<OPTION value=TOIL>BP-102 plus<OPTION value=TOIH>
Maglife C Plus</SELECT></td>
<td width="8" height="19">&nb sp;</td>
<td width="12" height="57" rowspan="3">&nb sp;</td>
<td width="507" colspan="5" rowspan="3" height="59"><SP AN id=selectedInde xes></span></td>
</tr>
<tr>
<td >
</td>
</tr><tr>
<td >
</td>
</tr><tr>
<td width="862" colspan="10" height="19" valign="top"><b >
<font size="1" face="Verdana">
<font color="#FF0000" > &n bsp; Press <span class="td_greyB old">
Ctrl key</span> to select multiple products</font></font></b><font color="#FF0000" >.</font></td>
</tr>
<tr>
<td width="187" height="22">
<p align="right">< font face="Verdana" size="2"><b>Sal es Person :</b></font></td>
<td width="5" height="22"></td>
<td width="144" height="22">
<b><font face="Verdana">
<input type="text" name="sale" size="20"></font></b></td>
<td width="8" height="22">&nb sp;</td>
<td width="12" height="22">&nb sp;</td>
<td width="135" height="22">
</tr>
<tr>
<td > &n bsp;   ; &n bsp;
&nb sp; &nb sp;
&nb sp; &nb sp;
<input type="submit" value="Save" name="B1">
</td>
</tr></form>
</body>
</html>
Jsp File:
<%@ page language="java" contentType="te xt/html" %>
<% String get_values[];
get_values=requ est.getParamete rValues("val");
for(int i=0;i<get_value s.length;i++)
{
out.println("Qt y = "+get_value s[i]);
}
out.println("Sa les = "+request.getPa rameter("sale") );
%>
Comment