Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet reading data from a text box with the same name using servlets
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


seetaram
reading data from a text box with the same name using servlets
1 Answer(s)      4 years and 10 months ago
Posted in : JSP-Servlet


Hello sir,
i want to get the values from four textboxes having the same name
like
a=<input type=text name="t1"><br>
b=<input type=text name="t1">
c=<input type=text name="t1">

using servlet i want to print all the values from each text box?

is it possible.this question i faced in an interview.


kindly reply to my question this is my first question?

so that i can think that this site is providing help to people


my mail id is mca.seetaram@gmail.com

Advertisement
View Answers

March 6, 2010 at 11:47 AM


Hi Friend,

Try the following code:

1)form.jsp:

<html>
<form method="post" action="../ServletExample">
<table>
<tr><td>TextBox1</td><td><input type="text" name="t1"></td></tr>
<tr><td>TextBox2</td><td><input type="text" name="t1"></td></tr>
<tr><td>TextBox3</td><td><input type="text" name="t1"></td></tr>
<tr><td>TextBox4</td><td><input type="text" name="t1"></td></tr>
<tr><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</html>

2)ServletExample.java:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class ServletExample extends HttpServlet{
public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
String values[]=req.getParameterValues("t1");
for(int i=0;i<values.length;i++){
out.println(values[i]+"<br>");
}
}
}

Thanks


Related Tutorials/Questions & Answers:
reading data from a text box with the same name using servlets - JSP-Servlet
reading data from a text box with the same name using servlets  Hello sir, i want to get the values from four textboxes having the same name like a= b= c= using servlet i want to print all the values from each text
How to get data from DB in to Text box by using Jsp & Ajax
How to get data from DB in to Text box by using Jsp & Ajax   I want to get the data from database in to text box in a jsp page by using Ajax. If I... with a and from that i need to select the required value and i should store
Advertisements
how to display data from mysql table in text box using jsp??
how to display data from mysql table in text box using jsp??  <p>hi, i have a written a code to display data from a mysql table into txtboxes...="row">Reference GPC</th> 113: <td><input type="text" name
Retrieve data from xml using servlets
Retrieve data from xml using servlets  Hi plz send me the code for retrieving the data from xml File using Servlets.   Hi, Do you want... Thanks   Hi, Learn Get Data From the XML File. Thanks
Populate a combo box using data from a database
Populate a combo box using data from a database  Hi Guys, In need... to the client using ajax, and then populate the combo box, I must'nt reload... combo box which will then load the next combo box values, now i know how
retrieve the data to text fields from database on clicking the value of combo box
retrieve the data to text fields from database on clicking the value of combo box   retrieve the data to text fields from database on clicking... getting data into textarea from database table by clicking on the button
Retrieving data from data base using jsp combo box
Retrieving data from data base using jsp combo box  Hi guys please... of the server it has to display the process name from database into the process name... combo box is there and another filed is version of the server(like 1.0,2.0) like
Acees data from database using combo box - JSP-Servlet
Acees data from database using combo box  please let me how i access the data from database when i select combo box combo2 having values Arts, Commerce, Science. this combo box will appear when first combo box class_name having
Reading text from image file - Java Beginners
Reading text from image file  How Read text from image file
create login page using data from text file
create login page using data from text file  I want to create login page using data store in textfile(data submit from regiter page to textfile) using jsp and servlet. Thanks
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz
how to get selected name from combo box
of worker name within d combo box and display that id into a text box. plz answer...how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my
how to get selected name from combo box
of worker name within d combo box and display that id into a text box. plz answer...how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my
how to get selected name from combo box
of worker name within d combo box and display that id into a text box. plz answer...how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my
place data in text fields from database using jdbc
place data in text fields from database using jdbc  i want get the data from database and place the records in the respective textfields using jdbc and swing like eno,ename,loc from emp table
reading data using struts and jsp java
reading data using struts and jsp java  how can i read data entered... that after reading emp_id it can be read into struts action class for retrieving other employee related data
fetching data using servlets - SQL
for fetching data from a ORACLE10g database using SERVLETS.   Hi Friend...fetching data using servlets  I have successfully made connection with the oracle10g database that i am using and also able to put in data using JSP
reading data from excel file and plotting graph
reading data from excel file and plotting graph  I am doing a project... at the same time from one excel file using different columns..how can i do that? waiting... that reads an excel file using POI api and using the data of excel file
Application reading data from JDBC database
Application reading data from JDBC database  I would like to develop an online registration system that captures details of potential candidates..." should read data from from a JDBC database named PrimeGame with TABLE PRIMEGAMETABLE
how to create a text box using awt
how to create a text box using awt  give an example how creat multi buttons & text boxes
create text box by clicking button and submittong text in text box using submit
create text box by clicking button and submittong text in text box using... is created. and i want to do that when i enter the text input in text box and when i... box in SOP). i also want the text box should generate in front of NEW button
how i conditional access the data from database using combo box. - JSP-Servlet
how i conditional access the data from database using combo box.   i have combox box named class when i select its value 11 or 12, another combo box... access the data from database when i select class 11 0r 12. Here is JSP file
excel sheet reading and using that data - JSP-Servlet
excel sheet reading and using that data  i have to do a read a excel sheet file of a employee record and then i have to use a employee details to send mail to those employees how to do in jsp sir please help me sir.. Thanks
Error in reading Excel data using jsp
Error in reading Excel data using jsp  ERROR while executing bellow code:java.io.IOException: Invalid header signature; read 576460838270094160... is not a proper xls file. It's a text file with a .xls extension s.t. Excel can quietly
How to retrieve data from database by using combo box value in jsp? - JSP-Servlet
How to retrieve data from database by using combo box value in jsp?  .... Your code here.. CREATE TABLE "user" ( "name" character varying(100...---------------------------------- ---------------------------combobox.jsp------------------------------------ ------------ A:hover {text
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  For example... ,the related employee name will be displayed in text field... i already stored combo box values from database. pl
populating text box using jsp code
populating text box using jsp code  Sir, How to populate related values in a text box after selecting value from drop down list using JSP and mysql. I tried using Ajax from your example. But for some browser it does not support
Servlets errors in same page.
Servlets errors in same page.  How do I display errors list in the same page where a form field exists using servlets...........i.e. without using JSP? Please explain with a simple username password program
Reading xml file using dom parser in java with out using getelementby tag name
Reading xml file using dom parser in java with out using getelementby tag name  Hi, How to read the xml file using java with dom parser, but without using getelementbytag name, and also read the attribute values also. I had
Retrieving Data from Database to fill Combo Box
Retrieving Data from Database to fill Combo Box  Sir, I have a JSP Page with a combo box and a label. I have a database that has two fields id and an image. Now I want to fill the combo box with image and on selecting
Advertisements
 

 

 

DMCA.com