• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get multple text fields values in jsp  RSS feed

 
suganya vijaykumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried for getting all textfields values. but i'm getting null values. help me please.

<tr>
<td><label id="label1">label1</label></td><td>
<input type="text" name="textfield1" value="textfield1"></td></tr>
<tr><td><label id="label2">label2</label></td><td>
<input type="text" name="textfield2" value="textfield2"></td></tr>
</table>


<%
String val;
for(int i=1;i<=count;i++){
if(request.getParameter("textfield"+i)!=null){
val=request.getParameter("textfield"+i);
System.out.println(val);
}
}
%>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at this code:Why fetch the values twice?

Regarding nulls, are the fields in a form? Are the values actually part of the POST?
 
suganya vijaykumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%
String val;
for(int i=1;i<=2;i++){

val=request.getParameter("textfield"+i);
System.out.println(val);
}
%>
As said, i tried this too... tell me, is there any possible ways to get text fields values in jsp page which dynamically created... then i have to pass this values to servlet for storing into database
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where are the UBB code tags that I asked you to use? And what are the answers to the questions that I asked?
[ September 18, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!