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

Have Programming Question? Ask it here!

Refresh code
3 Answer(s)      5 years and 10 months 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
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
How to prevent the page refresh while submitting the form??
How to prevent the page refresh while submitting the form??  Hi. Requirement: There are two drop down boxes.Dropdown2 should load corresponding to the select of Dropdown1. Im hitting a db for this every time.Hence the page loads
jsp drop down without refresh - JSP-Servlet
refresh and what change's is made in jsp of javascript to make proper data
How To Page Refresh Using JavaScript In JSP
How To Page Refresh Using JavaScript In JSP       In this section, we develop...: Output when Successfully Submit the User Login refresh the parent
how to refresh google map using ajax by fetching lat long from database
how to refresh google map using ajax by fetching lat long from database  i have a jsp page where we select the object and by submitting the form... long from db. Now, i need to refresh the map using ajax.Pls help me how to do
code  code for android sample program
code    how to write this in java
Code  code for connecting c lang to database
code for this is
code for this is  a b c d c b a a b c c b a a b b a a a code
code  please provide code for custom using currdate tag we need to get current date?please give me code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
the correct code for a program.The output of the program is listed below...: {Block 5} ADDRESS-3: {San Juan} POST CODE:{6745} ENTER CODE (XX TO stop) CODE:{FF1} QUANTITY:{2} CODE:{TR4} QUANTITY:{1} CODE:XX INVOICE FOR YOUR ORDER Harry
code to create the RMI client on the local machine: import java.rmi.*; public... : "+e); } } } However, when the preceding code is executed it results... the correct code
code  i have four textboxes.whenever i click on up,down,left or down arrows then the cursor move to another textbox based on the key pressed.i want code for this in javascript
line of code to print the amount he should be paid as allowance
code  write a program to encrypt and decrypt the cipher text "adfgvx"   Hi Friend, Try the following code: import*; import javax.crypto.*; import javax.crypto.spec.*; import
Pls send code
Pls send code   I am Mohini Charankar suppose Name="Mohini" Edit Button Click on that I change my Name with "Mohini/" Save it and page refresh After... an error pls send code
code - Development process
than it should refresh that page and give a warning message like "you are unable... after that,so if possible provide th code in java,post the code  Hi Friend, Try the following jsp code: function
JSP Meta refresh
JSP Meta refresh   ... have used "Refresh" value in order to specify a delay in seconds... is the code of metaRefresh.jsp <html> <META HTTP-EQUIV
Jsp Code:Refreshing Page - Java Beginners
Jsp Code:Refreshing Page  Dear Frnds, I have a problem where i need to refresh a page based on the button click. once a page is updated, it should refresh the data in another page. structure is given bellow... Empid EmpName