Regarding request object

Hi all,

I need a small help. I wrote a jsp page like this

<form name="filedata1" action="/Bertha/servlet/ServletDisplay" method="post"enctype="multipart/form-data" onsubmit="return loginValidate()">

<table width="89%" border="0" align="center" >

<tr>

<td height="40" align="center" class="titles"><font> <b>Select Your Keyword</b> </font>

</td>

</tr>

</table>

<table width="443" border="0" align="center">

<tr>

<td width="145" height="50" align="right" nowrap class="slogen">Keywords List(csv and .txt only)</td>

<td width="10" ></td>

<td width="230" align="left"><input name="filedata" type="file" class="txt1"/></td>

<td width="130">

</td></tr><tr>

<td height="36" align="right" class="slogen">UserName</td>

<td > </td>

<td align="left" class="txt3"><input id="un" name="username1" type="text" value=""/></td>

</tr>

<tr>

</table>

<table width="142" height ="80" border="0" align="center">

<tr>

<td width="117" height="38" align="center" >

<input name="login" type="submit" value="UpLoad File" /></td>

<td width="50" height="38" align="center">

<input name="clear" type="reset" value=" Clear" /></td>

</tr>

</table>

And in servlet i want to catch username. In servlet i gave like this

String uname=request.getParameter("username1");

I am getting null pointer exception. please help me.

I apologize for my poor english.

Thanks in Advance,

Regards,

Rama Devi.

[1859 byte] By [RamaDevia] at [2007-11-27 6:34:18]
# 1
String uname=request.getParameter("username1"); ths statement will not through null pointer exception..try to print the uname using system.out.println and see u r getting the value or not...regardsShanu
mshanua at 2007-7-12 18:00:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
The above poster is right, request.getParameter() won't throw an NPE; you'll just get a null in the String. Maybe you're performing some operation on the string without checking if it's null or not.
nogoodatcodinga at 2007-7-12 18:00:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Hirequest.getPrarameter("username1") will not throw any exception if you are not givin any value in textbox.Check if you are using the value you got from request in database processing.regards bhargava
bachea at 2007-7-12 18:00:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...