html-jsp

If i want to get dynamic value in html textbox or in jsp,then how can I get the value,how the value will be transfered from servlet page to the html textbox.Thanx in advance.....Kindly help me...........

View Answers

March 5, 2012 at 4:58 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:
html-jsp - getparameter() - JSP-Servlet
html-jsp - getparameter()  Hi! friedns, This is my front end and I want to retrieve username and password in two different jsp pages. I used getParameter() with two form action as shown below. But I am not getting
html-jsp
html-jsp  If i want to get dynamic value in html textbox or in jsp,then how can I get the value,how the value will be transfered from servlet page to the html textbox.Thanx in advance.....Kindly help me
Advertisements
Html+jsp+database is enough to do the small operation
Html+jsp+database is enough to do the small operation  Hai , If u want to do simple insetion and data retrival operation throw jsp ?.you need not to bother about whole code.just u consentration on html,ajax,jsp,any db.here i
html - JSP-Servlet
explain in detain and send me code. login application in jsp...; } Login Application in JSP...; ------------------------------------------ Visit for more information. http://www.roseindia.net/jsp/ Thanks Amardeep
javascript-html - JSP-Servlet
javascript-html  i want to dynamically create textfield with option button as another/remove when user presses in jsp page which will be in table.for example table contains one row with 2 columns,one textfield,second dropdown
javascript-html - JSP-Servlet
javascript-html  i want to dynamically create textfield with option button as another/remove when user presses in jsp page which will be in table.for example table contains one row with 2 columns,one textfield,second dropdown
HTML - JSP-Servlet
HTML   To process a value in jsp project I have to set the text box as non editable. what is the attribute and value to be submitted... code. Visit for more information. http://www.roseindia.net/jsp
how to add the calendar to the dynamic rows in html or jsp page - JSP-Servlet
how to add the calendar to the dynamic rows in html or jsp page   Hi Sir, i have 3 columns in my jsp page date of payment,amount recieved,no and i have 2 button in my jsp page ADD and delete button. when i click on add
Link from html to jsp - Development process
html link button , control should go to jsp page wat i mentioned in view... Friend, To give link from html page to jsp, you have to run the jsp page.After that specify the full path of jsp in html page with href tag. Use
Data fetching from JSP or HTML - JSP-Servlet
Data fetching from JSP or HTML  Hi Deepak, Can u pls help me as i have a problem with jsp/html frameset. my question is how can i fetch the data from frameset which is in html format.pls help me. Thanks
i use HTML in jsp - JSP-Servlet
i use HTML in jsp  i want to make a list box of select state and corresponding to the selected state all the names of cities will be displayed...://www.roseinda.net/jsp
how to insert data in database using html+jsp
how to insert data in database using html+jsp  anyone know what is wrong with my code? print("<% /* Create string... method="post" action="http://localhost:8080/examples/jsp/insert.jsp"> <
call a wep page using html - JSP-Interview Questions
call a wep page using html  Dear, Please I want to call a jsp page using a HTML Button called View. When the user click on it, a new JSP web page will opened. Can you help me please. Thanks in advance  Hi Friend
eSpell
, JavaProperties, C, C++, XML, HTML, JSP, and PHP. With support for Aspell
RequestDispatcher in java
resource to another web resource (such as a Servlet, HTML, JSP) on the server..., or a JSP page, or an HTML file in the response. The servlet 1 receives..., HTM and JSP). Servlet 1 gets the request from client and generates a response
Setting and Getting Data in jsp through the Session
Setting and Getting Data in jsp through the Session          In this example you will learn how to make Form with the help of html in jsp. By this example
retrive values - JSP-Servlet
retrive values  how to get multiple values from html to jsp
jar file with html
jar file with html  I have a jar file. On double click it shows an applet page. Please tell me how to connect that applet into html or jsp page
Source code of a website in HL and JSP.
Source code of a website in HL and JSP.  I want the source code of a website of 10 pages with database connectivity. Source code should be in HTML and JSP. Thanks
simple - JDBC
simple  can we have update,delete,save button in one html or jsp form performing respective operation if yes, give me code respectively.  Hi Friend, Please visit the following link: http://www.roseindia.net/jsp
javascript date picker - Date Calendar
javascript date picker  how to insert a date picker user control in a html/jsp using javascript??? please help, it's urgent.  Hi Friend.../javascript-calendar.shtml http://www.roseindia.net/jsp/emp-event.shtml Thanks
javascript Code - JSP-Servlet
javascript Code  how to count controls in form and find no of contriols in html or jsp page.for example one table is there with 10 rows,each row consists of 3 fields as 2 text box and one drop down box
ecilpse
ecilpse  just now i have entered into IT development field facing many difficulties being a fresher just tel me how to work with eclipse an connection establishment in jdo and html jsp etc.... getting many confusion while writing
question
to an html page after checking the database for different users.for eg:your user name or password is incorrect.reply me with code, without using bean.using servlet,html,jsp and simple java script.i don't know ajax
Tomcat
the project in tomcat where we can store the html and Jsp ad Java, XML files... way or not.send me the one simple application code in java,servlets,html,jsp... apps-my project(beside this one jsp file) Inside the my project WEB-INF
multipications table
multipications table  i need to do a Form (decide if this should be html or jsp file). Form contains an HTML form with two fields:a text input..... Table (decide if this is HTML or JSP) Table shows the multipications table up
Hi... - Java Beginners
you have used like html,JSP,Servlet,Struts,JSF etc.. and explain the problem
drag n drop - JSP-Servlet
drag n drop  I want to implement drag n drop functionality for simple HTML/JSP without using applet,flash or any heavy components.using browse button user can select one file at a time.but user needs to select multiple files
JSP - JSP-Servlet
JSP  how to get the input in a jsp page which was entered by the user in another jsp page?? 'request.getParameter' that is used for html to jsp... the problem : 1.Create a JSP page "test.jsp" and submit the form
html - IDE Questions
html  how to run html page in eclipse  You can't direct run a html/jsp page in eclipse. if it is pure static page then you can through the design tab. other wise type the addres of your page in eclipse browser
Tictactoe game-2 players- using jax webservices & jsp
and tell who is winner. Please help,atleast with the html/jsp coding and equivalent
jps
the programmers to embed Java code into html (.jsp) page. For more information...what is the jsp  what is the jsp   ava Server Pages is a technology from Sun that enables the Java programmers to generate HTML, XML
Java - JSP-Servlet
tomcat). under our root project we have to keep all .html & .jsp files along...., All html & jsp file have to store directly under root folder(main folder) of our... I asked the question that how to load JSP in my website, Actually I am working
CSS Designer
authoring while editing CSS, HTML and JSP files.ADS_TO_REPLACE_1 Key features... while editing CSS, HTML and JSP files The CSS Styles view allows you to view... controls Allows to create and delete style sheets and style rules directly in HTML
What is JSP?
from Sun that enables the Java programmers to generate HTML, XML or other types of documents to server the web client. The JSP technology allows the programmers to embed Java code into html (.jsp) page. Java Server Pages are first
3 tier architecture in java - JSP-Servlet
is created with html, jsp, servlets and oracle using weblogic server. Html used for login page, jsp used for validating the username,password and connecting... here that what are the 3 tiers. I tier is html ( it can also be jsp?) II tier
creating a jar file - JSP-Servlet
creating a jar file  Can you give me detail answer 1. i am having a servlet.class file in classes folder 2. web.xml file my questions are 1. where to place the html or jsp files 2. how to create a jar file and how can
html - JDBC
html  How to insert a new column into HTML (or jsp) table dynamically? i have to print a table of html depending on number of subjects (where... jsp but i am not able to print them on the table because table columns
How to retrieve array values from html form to jsp?
How to retrieve array values from html form to jsp?  Hi! I am... it into jsp. Means i just want to retrieve values from html form containing array... sample code for how to retrive array values from html to jsp.   hi friend
JSF verbatim Tag
of this tag. This tag can be used to nest plain html within the JSF component tree. Any Html and jsp tags in the view tag can be nested within verbatim tag. The reason... components. But html and JSP tags are not JSF components. So we nest the non JSF 
source code - JSP-Servlet
, and Cost. Customers can only view the bill details. Deliverables HTML/ JSP
J2EE - JSP-Servlet
but servlet are not. Jsp is more convenient to write (and to modify!) regular HTML than to have a zillion println statements that generate the HTML. jsp life...J2EE  What is diffrent between JSP and Servlet ?   Hi
JointLogic Web Designer
CSS, HTML and JSP files. HTML Designer key features WYSIWYG authoring... Tools Platform (WTP) to allow CSS authoring while editing CSS, HTML and JSP... of two components - HTML Designer and CSS Designer. HTML Designer provides
PlainText Result Example
raw content on a HTML or JSP file. To use the PlainText Result you need... location is the location of the HTML or JSP file. And charSet is type...="location">/jsp/helloPage.jsp</param> <param name="
servlet - Servlet Interview Questions
the following attribute on your html(jsp or servlet generated ) page to refresh... HTML documentsI should note, however, that the Refresh header doesn't appear
Easy Eclipse Plugin
; Amateras HTML and XML editor: Edit HTML, JSP, XML and CSS files J2EE... HTML Tidy: Format and validate HTML, XHTML and XML documents within your favorite editor  eZingBuilder: Edit HTML web page visually 
Create Web Page with jsp
server. JSP simply application that work with Java inside HTML pages. Now we... first application JSP. The HTML file we used in the previous exercise. After modify file extension from ".html" to ".jsp". Then the application load the new
The getQueryString() method of JSP
The getQueryString() method of JSP In this Section, we will learn about using...'. The query string contains the attribute & the value of the html or JSP form, which sends with the POST /GET  method  to Servlet or JSP
jsp-jdbc - JDBC
jsp-jdbc  Hi! html- jsp-jdbc program from the html form where... jsp frequently. I am getting error through request.getParameter(). can you please... should I pass request.getParameter or fname, lname, add,phones (from html input