Question: Refresh code



Share on Google+Share on Google+

Refresh code
3 Answer(s)      8 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
refresh checkbox jframe
refresh checkbox jframe  How to refresh checkbox button in JFrame
prevent browser refresh
prevent browser refresh   prevent browser from refresh in Javascript
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
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 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
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
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
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
Refresh Button returns null point exception when clicked
Refresh Button returns null point exception when clicked  Dear all Please assist with the following: How to rectify a piece of code for the refresh button in java. When clicking the button it returns an error "null point
title and keywords don't refresh in webpage - JSP-Servlet
title and keywords don't refresh in webpage  Hi, I changed the title and keywords on my main jsp page that is the entry point into my web... but it still doesn't work. Here is my new code for title and keywords. Linen
Page is not getting loaded when I refresh the webpage???
Page is not getting loaded when I refresh the webpage???  **I am loading an image section(image,demo link,Zoom) in a webpage by using javascript... when I refresh the page.* Note: Header section is getting loaded always Could
How to refresh a jTable On adding or deleting record ....
How to refresh a jTable On adding or deleting record ....   Hii Sir, I am developing a project in which a jtable is getting populated... me the code ........ Thank you Sir....   Here is a java swing code
Java Spring Hibernate Struts Training i have an ques. of advanced java commandlink tag in primefaces needs onclick effect how can i run ASP.Net Server from netbeans IDE? java code for cursor java vertual machine launcher error; cannot access jarfiles JSF Tutorial render in input typetext java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener After authentication and connection establishment, Upload a zipfile by chunks in java JSF CONNECTION WITH MICROSOFT ACCESS Download Current Web Page As PDF java servlet dropdown list in jsf panelGrid header do the following how to make drop down list in JSF & fetch data Item from database help me please doubt regarding JSF Creating Dynamic Tree How to upload zip file from android to server programmatically????? jsf application war file not running in my jboss 6.0 on linux 5.5 Business analysis servlet servlet exception in thread main while running servlet How to get browser time zone? JAVA Socket Programming excel report fro jsp mysql Redirect to same jsp page on successful login jsf f:parm value dynamical settings jsf f:parm value dynamical settings RMI Program in netbeans pagination in jsf pagination jsf pagination How create csv format in jsf ? need JSP Code. Arrays, loops and string handling unique value renderer JSF 1.2 online tutorial JSF code JSP jps Multicast under UDP(client server application) How to rectify "Bad version number in .class file" exception in Eclipse about avl tree and hashing project on avl tree and hashing How to navigate from one jsf to another in eclipse how to focus on the new window opened from JSF ? Editing UI components using managed bean


Advertisement null