Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
Ajax - cant transfer the data to client page

Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
New one
New one

Joined: 06 Oct 2006
Posts: 1

PostPosted: Fri Oct 06, 2006 8:26 am    Post subject: Ajax - cant transfer the data to client page Reply with quote

Hi, i have actually use an example from the tutorial to implement Ajax into my jsp project. The example i get from http://www.commoncoder.com/tutorials/ajax-drop-down-box.asp.

I want the program to works in this way where user selects a data in the list box and the final results will be display in the textbox.

The example from the tutorial is almost the same from my project except that the values retrieve from the jsp page will be display in the textbox instead of the div.

This are the codes:
In the javascript:

var xmlHttp
function showResults(str)


alert("read this first" +xmlHttp);
if (xmlHttp==null)
alert ("Your browser does not support the XMLHttpRequest object.")

var url="getProject.jsp"
alert("URL = " + url);
alert("read this" +xmlHttp);

function stateChanged()
alert("read this2");
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")


function GetXmlHttpObject()
alert("read this3");
 var objXMLHttp=null
  try {
    objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP"); //later IE
  } catch (e) {
  try {
    objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); //earlier IE
  } catch (e) {
  objXMLHttp = null;

In the client page, where the select list box named selSite and textbox name txtProject. This is the client page where user selects an item in the listbox and display the result in the textbox. Please do ignore the vector and if statement as i'm retrieveing the data from the database to be display in the list box.

<input type="text" name="txtProject" id="txtProject"  size="20">    </td>
   Vector storageSite = new Vector();
   newSiteObj siteObj = new newSiteObj();
   storageSite = siteObj.retrieveSite();
   System.out.println("In here");
<select name="selSite" WIDTH="230" STYLE="width: 230px" id="selSite" onChange="return showResults(this.value)">
for(int i=0; i<storageSite.size(); i++)
newSiteBean siteBean = (newSiteBean) storageSite.elementAt(i);
out.println("<option name = idSite,  value='"+ siteBean.getsite()+ "'>" +siteBean.getsite()+ "</option>");

Lastly this is the jsp page where the retrieving of data is done. I have check the running of the code and the retrieving of data is successfully done and i store the data in the variable str_project. Now i wan to return the value of this variable back so it can be display on the client page but not successfully. Can any one help me with this. Thanks

<%@ page language = "java"  import="java.lang.*,
com.IMS.bean.InvDetailsBean" %>

//System.out.println('In jsp Page");
   String str_project;
   String search = request.getParameter("q");
   System.out.println("Search = " +search);
   newSiteObj siteObj = new newSiteObj();
   System.out.println("In here");
   str_project = siteObj.getproject();
   System.out.println("STRProject " +str_project);

Thanks ..
Toyota Van specifications
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 XML & Copyright Notice 

Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X

Link to our site:


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos

Normal Bookmark

Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax

Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?

it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert