regarding out put display in html text field

regarding out put display in html text field

how to dispaly the output coming from servlet in a particular text field of html.

View Answers

March 31, 2012 at 1:27 PM

1)Servlet.java

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

    public class Servlet extends HttpServlet{
        protected void doPost(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException{

    ArrayList list=new ArrayList();
    try{
         Class.forName("com.mysql.jdbc.Driver");
               Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
               Statement st=con.createStatement();
               ResultSet rs=st.executeQuery("select * from employee");
               while(rs.next()){
                   list.add(rs.getString("name"));
                   list.add(rs.getString("address"));
                   list.add(rs.getString("contactNo"));
                   list.add(rs.getString("email"));
    }
    req.setAttribute("data", list);
            RequestDispatcher rd = req.getRequestDispatcher("/jsp/data.jsp");
            rd.forward(req, res);
    }
    catch(Exception e){
    }
        }
    }

2)data.jsp:

<%@page language="java" import="java.util.*" %>
<html>
<body> 
<table border="1" width="303">
<tr>
<td width="119"><b>Name</b></td>
<td width="168"><b>Address</b></td>
<td width="119"><b>Contact no</b></td>
<td width="168"><b>Email</b></td>
</tr>
<% Iterator itr;%>
<% List data=(List)request.getAttribute("data");
for(itr=data.iterator(); itr.hasNext(); ){
%>
<tr>
<td width="119"><input type="text" value=<%=itr.next()%>></td>
<td width="168"><input type="text" value=<%=itr.next()%>></td>
<td width="168"><input type="text" value=<%=itr.next()%>></td>
<td width="168"><input type="text" value=<%=itr.next()%>></td>
</tr>
<%}%>
</table>
</body>
</html>









Related Tutorials/Questions & Answers:
regarding out put display in html text field
regarding out put display in html text field  how to dispaly the output coming from servlet in a particular text field of html
Text Field in HTML
Text Field in HTML       The Text Field in HTML are one line areas, which enable the user... an example from Text Field in HTML.In this Tutorial, the code create a text
Advertisements
Fetched Record from database show into text field of html page
Fetched Record from database show into text field of html page  hi, i..., and also have html page with all above mentioned field i have submit 20 record from... in the text field of merchant name then suggest all merchant name in the form
Regarding frames in HTML
Regarding frames in HTML  I have created a html page including two frames in it,one frame consists "search bar" and the other frame consists login... regarding this...thanks
text field
text field  How to retrieve data from text field   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public
i want print the following out put
i want print the following out put  Hello sir i want the following out put can u provide the program in c# o/p; HELLOLLEH HELLLEH HELEH HEH H (adsbygoogle = window.adsbygoogle || []).push
centre text html
centre text html  centre text HTML - How to centre any field in HTML Page   <!DOCTYPE html> <html lang="de"> <head>...; html, body { height: 100%; margin: 0; padding
video display in html
video display in html  how to display video file in html
regarding date field validation - Ajax
regarding date field validation  i have developed user information page for a site, all the fields are valid except date field. i want the date in dd/mm/yyyy format.if i change the code in the above format then the form does
HTML text tag
HTML text tag   How to wrap text in HTML code without changing the text format
Formatting text in HTML
Formatting text in HTML  What are the tags in HTML to format text
converting field to text sql
converting field to text sql  I wanted to convert the field to TEXT in SQL.. is it possible?   SQL - Converting the field to TEXT works... the field to TEXT works (adsbygoogle = window.adsbygoogle || []).push
jsf text field not blank
jsf text field not blank  text field not clear in jsf onclick of reset button in my application initial value not deleted   Hello Friend, Post your code. (adsbygoogle = window.adsbygoogle || []).push
text formatting tag in HTML
text formatting tag in HTML  What are the various text formatting tag in HTML
Use of Text Field
Use of Text Field, Text box, Text Area, Checkbox,Dropdownlist and Radio Button in HTML      ... types of information. A form contains form elements checkbox, text field, radio
validate text field iPhone
validate text field iPhone  i got two different UITextfield in my iPhone application for user login. Just wondering how to validate
Show text field & check input using jQuery
will discuss about how to display 'text field' by a button click & check... how to display 'text field' by a button click & check input using...; it will display a text field and a question , if the answer is yes then ,we have
CALULATION IN TEXT FIELD
CALULATION IN TEXT FIELD  Suppose 3 text Field first amount ,second amount and third sum of these amount,this amount will appear when tab in next filed(i don't want use any type button) in java swing HOW? PLEASE HELP
html text linking
html text linking  How to link a text in HTM?   Link text for example... <a href="http://www.roseindia.net/">RoseIndia Tutorials</a>
Password Field in HTML
Password Field in HTML     ... displays asterisks or bullets instead of the characters. Password text field is same as text field. The only difference between them is that when a user entered
html parsing in java and display in swing
html parsing in java and display in swing  dear rose indians I am... HMTL pages in swing window forms to display html contents i am using... "); htmlPane = new JEditorPane(); htmlPane.setContentType("text/html"); htmlPane.setPage
swing text field problem
swing text field problem  I want to navigate the content of text field from one class to another and viceversa through button but when I am getting the text from first class I am getting null value.please help me..here
swing text field problem
swing text field problem  I want to navigate the content of text field from one class to another and viceversa through button but when I am getting the text from first class I am getting null value.please help me..here
HTML - Text Size
HTML - Text Size Description : The size is a attributes of font tag of html. It specifies the size of text. Syntax: <font size="4"> Bharat singh</font> Code : <!DOCTYPE html PUBLIC "-//W3C//DTD
Text field save as word file
Text field save as word file  Dear experts At run how to save set of text field contains text into single Word file. To save in our desktop computer. Solve my problem
How to put text file numbers to array and check the position of numbers?
How to put text file numbers to array and check the position of numbers?   I have numbers in text file data.txt 12 9 8 3 1
Digit Only text field
Digit Only text field  How should we accept digits only in a textbox? (using JSTL only, without Javascript
HTML Code for registration form
HTML. Here a programmer can display as many "Text Field" as he/she wants. The name in front of Text Field is called "Label". At the end of the registration..._TO_REPLACE_1 In this example we have shown 9 "Text Field". Size of the Text Box can
rich text field - JSP-Servlet
rich text field  Hi, this is jawahar. my question i need rich text field in my program . plz send me the code
clearing text field in spring form
clearing text field in spring form  hi, I have spring form in that i have security question dropdown field and security answer text field ,when i submitted form with errors the answers text field value should be clear, for this i
Text Area in HTML
Text Area in HTML       Text  Area in HTML is used to write unlimited number of text... is used to create a text area in HTML page.  ADS_TO_REPLACE_2  
ModuleNotFoundError: No module named 'html_to_text'
ModuleNotFoundError: No module named 'html_to_text'  Hi, My Python... 'html_to_text' How to remove the ModuleNotFoundError: No module named 'html_to_text' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'html-text'
ModuleNotFoundError: No module named 'html-text'  Hi, My Python... 'html-text' How to remove the ModuleNotFoundError: No module named 'html... have to install padas library. You can install html-text python with following
iPhone Text Field Border 
Text Field Boarder  In this tutorial will learn about the text field Boarder, we can set the boarder of text field by selecting the text field... for the text field. This project is View Based Application and here will take four text
Print out html markup with h:outputText
Print out html markup with h:outputText  How to print out html markup with h:outputText
How to display user entered information using HTML and JavaScript
How to display user entered information using HTML and JavaScript. We are going to describe How to display user entered information using HTML and JavaScript. First of all we have created HTML form with two text fields "
<html:text structs - Struts
  how can i display a value from database on jsp using struts form. the value should be populated on jsp load. can any body help me in this .... regards aftab
To display suggestions in a text box - Ajax
To display suggestions in a text box  Hi All, I have a requirement, to get the suggestions i mean when i enter the alphabet in a text box(For ex:'A'), the names that starts from 'A' have to display in the text box
text field validation - Java Beginners
text field validation  hi How to validate allow only decimal number in text box in jsp?  Hi Friend, Try the following code: function isDecimal(str){ if(isNaN(str) || str.indexOf(".")<0){ alert
Html tag inside out implicit object
a html tag inside a out object. out object is used to display the content on the browser. To make this program run use out object inside which define some html...Html tag inside out implicit object   
how to highlight the field in image,when i have entered into that corresponding field's textbox-any one help out
how to highlight the field in image,when i have entered into that corresponding field's textbox-any one help out  how to highlight the field in image,when i have entered into that corresponding field's textbox. Here webpage
Automatically display in text box - JSP-Servlet
Automatically display in text box  Dear Deepak Sir, When i enter some text in text box.That corresponding value in database,the value display in another text box using ajax. Thanks & Regards, VijayaBabu.M
ModuleNotFoundError: No module named 'django-html-field'
ModuleNotFoundError: No module named 'django-html-field'  Hi, My... named 'django-html-field' How to remove the ModuleNotFoundError: No module named 'django-html-field' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-html-field'
ModuleNotFoundError: No module named 'django-html-field'  Hi, My... named 'django-html-field' How to remove the ModuleNotFoundError: No module named 'django-html-field' error? Thanks   Hi, In your
changing an image based on checking checkbox using HTML & JavaScript, Please put div blocks
changing an image based on checking checkbox using HTML & JavaScript, Please put div blocks   Hello, PLease check the below code, and let me know the error. The answer should be like this - It has to display Desert.jpg once
JSP combo and text field related questio
JSP combo and text field related questio  in JSP,i had stored data from database in a textboxes usin combo..now i want to use these values of text... and name given to that text field..but its showing somethimng null pointer exception
ModuleNotFoundError: No module named 'adafruit-circuitpython-display-text'
ModuleNotFoundError: No module named 'adafruit-circuitpython-display-text' ...: ModuleNotFoundError: No module named 'adafruit-circuitpython-display-text' How to remove... to install padas library. You can install adafruit-circuitpython-display-text
ModuleNotFoundError: No module named 'django-storage-text-field'
ModuleNotFoundError: No module named 'django-storage-text-field'  Hi...: No module named 'django-storage-text-field' How to remove the ModuleNotFoundError: No module named 'django-storage-text-field' error? Thanks  
ModuleNotFoundError: No module named 'django-short-text-field'
ModuleNotFoundError: No module named 'django-short-text-field'  Hi...: No module named 'django-short-text-field' How to remove the ModuleNotFoundError: No module named 'django-short-text-field' error? Thanks   
ModuleNotFoundError: No module named 'django-storage-text-field'
ModuleNotFoundError: No module named 'django-storage-text-field'  Hi...: No module named 'django-storage-text-field' How to remove the ModuleNotFoundError: No module named 'django-storage-text-field' error? Thanks  

Ads