Refresh code



Share on Google+Share on Google+

Refresh code
3 Answer(s)      9 years ago
Posted in : Java Server Faces Questions
View Answers

October 24, 2008 at 3:30 PM

Hi friend,

<%@ page language="java" import = "java.util.*;"%>
List userList;
int nouser;
int i=1;
List cityList;
int nocity;
int j=1;
nouser = userList.size();

<title>dynamic bombobox in servlet</title>
<table border="1" width="300px" bgcolor="bluelight" cellspacing="0" cellpadding="0">
<td width="100%">
<form method="GET" action="/examples/jsp/ComboboxList">
<font color="red"><h3 align="center">Dynamic Combobox List</font></h3>
<table border="1" width="300px" cellspacing="0" cellpadding="0">
<td width="50%"><b>User Name:</b></td>
<td width="50%"><select name="userid" value="">
<option value="0">---Select Name---</option>
Iterator userit= userList.iterator();
<option value="<%=i%>"><></option>
<td width="50%"><b>City:</b></td>
<td width="50%">
<select name="city" value="">
<option value="0">----Select city----</option>
Iterator cityit= cityList.iterator();
<option value="<%=j%>"><></option>






October 24, 2008 at 3:31 PM

servlets code

package javacode;

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

public class ComboboxList extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException{
PrintWriter pw = response.getWriter();
Connection con = null;
String url = "jdbc:mysql://";;;;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String password="amar123";
con = DriverManager.getConnection(url+db,userName,password);
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from Combolist");
List ulist = new ArrayList();
List clist = new ArrayList();
request.setAttribute("userid", rs.getString(2));
request.setAttribute("city", rs.getString(3));
pw.println("userid" + " "+"city"+"<br>");
pw.println(rs.getString(2) + " " + rs.getString(3) +"<br>");

request.setAttribute("useridList", ulist);
request.setAttribute("cityList", clist);
catch (Exception e){
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/jsp/Combobox.jsp");
dispatcher.forward(request, response);


October 24, 2008 at 3:34 PM

Read for more information.



Related Tutorials/Questions & Answers:
Refresh code - Java Server Faces Questions
Refresh code  Hi All, In Drop Down Box i have 5 items if i select one item it is displaying item number beside that box.after...----   servlets code package javacode; import
UIBarButtonItem Refresh
, refresh button using code in iPhone application?? If yes then how?   ... the refresh button... i'm providing you the example of Navigation Refresh UIBarbuttonItem...] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh
Refresh JFrame
Refresh JFrame  How to refersh a JFrame and its componets
refresh jsp page - Ajax
refresh jsp page  Code for refresh a web page in jsp.  Hi friend, function refreshpage() { window.location.reload
Part refresh without a page refresh
Part refresh without a page refresh  hello, How do I submit a form or a part of a form without a page refresh?   hii, Ajax can do this. You can do partial update and upon a successful AJAX interaction over the whole
Table refresh with ajax - Ajax
Table refresh with ajax  I am using jsp/html in my code. Is it compulsory that i have to use a servlet to implement table refresh using ajax? Or jsp also would work? Rajatha
Servlet refresh page
refresh code into HTML page. Read more at refresh page In this example we will show you how you can refresh your page from setting the refresh attribute from a servlet. response.setHeader
prevent browser refresh
prevent browser refresh   prevent browser from refresh in Javascript
refresh checkbox jframe
refresh checkbox jframe  How to refresh checkbox button in JFrame
Captcha Refresh - Jquery
Captcha Refresh - Jquery  I'm looking for an example to refresh the Captcha image in Jquery ..every time the page get refresh. Thanks.   $("#refresh").click(function() { $("#captcha").attr("src","captcha.php?r
Refresh the form - Struts
Refresh the form  Hi How Can i control the page that doesn't go to refresh when i am doing 1 or more action from same page and forward those action again to same page. how can i control the doesn't go to refresh in that page
servelt refresh page
servelt refresh page   write a program in servlet that display the cricket score.the page should automatically refresh on every 5 seconds.the score... should fall down.the page should not refresh after 5 overs is completed
refresh rate in ajax
refresh rate in ajax  my data is in table which is generated dynamically. i want to refresh that perticular table after some time using ajax and with jsp
how to refresh my GUI page
how to refresh my GUI page  how to refresh a GUI in java
Client side refresh
Client side refresh  What is client side refresh?   ... by all browsers. <META HTTP-EQUIV="Refresh" CONTENT="5; URL=/servlet/MyServlet/"> This will refresh the page in the browser automatically and loads
Windows 7 refresh DNS
Windows 7 refresh DNS  Windows 7 refresh DNS How to refresh DNS... to refresh the DNS. go to the command prompt (dos prompt) and then issue the following command: ipconfig /flushdns Above command will refresh the DNS data
jsp dropdown refresh - JSP-Servlet
jsp dropdown refresh  Sir Thank u for your jsp code... but the probleam during data extraction when i select first drop down its refresh then 2nd drop down it also refresh. so i cannot get the selected data. Please kindly give
Table refresh with ajax - Ajax
Table refresh with ajax  Hi, I want to update my table which has... or if the database is updated, i want my table to be updated automatically. For this i think i need to use ajax where a particular area in the page can
refresh - JSP-Servlet
. Is there any other way to refresh that particular place instead of refreshing whole page
page refresh - JSP-Servlet
up window has to close and jsp page has to refresh. how can i solve
Hoe to refresh a table row dynamically
Hoe to refresh a table row dynamically  Want to refresh a table data when a particular link is clicked. How can i do using ajax ?   Hello... will able to refresh a particular table row? Please clarify this. Thanks
How to refresh Client only once by sending setHeader ("refresh" ,??? )
How to refresh Client only once by sending setHeader ("refresh" ,??? ) ... to be refreshed ?? I just want to refresh my client page only once....! Not periodically... / REFRESH ....! I want to reload Client side only once when some event occur and flag
Frame refresh problem - Swing AWT
Frame refresh problem  Whenever I close a child frame and reload it using the button on parent frame controls on the child frame load twice..., Try the following code: import java.awt.*; import javax.swing.*; import
Maven Dependency play-auto-refresh >> 0.0.1
You should include the dependency code given in this page to add Maven Dependency of com.jamesward >> play-auto-refresh version0.0.1 in your project
Maven Dependency play-auto-refresh >> 0.0.3
You should include the dependency code given in this page to add Maven Dependency of com.jamesward >> play-auto-refresh version0.0.3 in your project
Maven Dependency play-auto-refresh >> 0.0.4
You should include the dependency code given in this page to add Maven Dependency of com.jamesward >> play-auto-refresh version0.0.4 in your project
Click on Page Refresh - JSP-Servlet
facing a problem whenever i click on page refresh or f5 button, the value on form... is click". If u have more problem then give error page code. Thanks....... use the following code in your jsp page but aftr adding this you
Client Auto Refresh in Servlets
seconds, page will get refresh. Output will be: Download Source Code...Client Auto Refresh in Servlets       This section illustrates you how client gets auto refresh. We are providing
cache refresh after 24 hours
cache refresh after 24 hours  I have developed an application which uses websphere application server 6.1 which needs to query the database(oracle) after every 24 hours periodically.But it is not getting executed properly because
Version of com.jamesward>play-auto-refresh dependency
List of Version of com.jamesward>play-auto-refresh dependency
Refresh a Web Page Using In Servlet
.style1 { font-weight: bold; } Refresh a Web Page Using... example we develop an application to Refresh a web Page using Servlet. We...;) and refresh this web page and print the current Date and Time after 10 sec


Advertisement null