473,411 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

To pass value from a servlet to AJAX

13
Hi friends,

I would like to know how can i pass values to AJAX form from a servlet and how to display that value in a drop down box.
Plz help me on this since i am a newbie to this.

Thanks
Bilwin.
Mar 31 '07 #1
4 2942
acoder
16,027 Expert Mod 8TB
Read the AJAX tutorial links in the Offsite Links threads at the top of this forum.

What format is the servlet response in? Is it normal text or xml?
Apr 2 '07 #2
Bilwin
13
Hi,
The response is in form of XML.
I could parse the XML and able to retrieve the values from the xml response.
But the problem that i am facing is to display these values into a drop down menu .
Using the following code i could parse the response

for (var x=0;x<=xmlDoc.childNodes.length;x++){
var d =xmlDoc.getElementsByTagName("svcId")[x].childNodes[0].nodeValue;
var div=document.getElementById('Id'); // 'Id '- id for select menu.
div.innerHTML = div.innerHTML + d;
}


the id - 'Id' is id for a select menu.But none of the values are appending into it.
Is this the correct way to do this.?
Please help me...

Thanks!!
Apr 3 '07 #3
acoder
16,027 Expert Mod 8TB
Try, e.g.:
Expand|Select|Wrap|Line Numbers
  1. div.options[i] = new Option('new text','new value');
See this page.
Apr 4 '07 #4
Bilwin
13
Hi,

Thanks a lot!!

I have one more query.
Is it possible to call a webservice method through AJAX.?
If possible how can i do this?


Thanks!
Apr 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kaiwing18 | last post by:
Hi, I have a following jsp file called "showAsset.jsp" : <form action="showAsset.jsp" method="post"> <tr BGCOLOR=YELLOW> <td><input name="sort" type="submit" value="Asset_Number" > </td>...
3
by: ppcguy | last post by:
i've got a progress bar that tracks a process running on a server (java servlet). i know i can refresh the page and update the status...but this results in the page being redrawn everytime. ...
2
by: archanagp | last post by:
Hi, I am trying to develop a portlet which has a javascript function which uses ajax to call a servlet in the server. The portlet I am trying to develop is in websphere application developer. My...
1
by: santhoskumara | last post by:
After serialization has been done on XML file, i got a string "XMlstr" now how will transform the string to clientside where i am using Ajax to handle the response. Here i am paste the code of...
1
by: kirannallam | last post by:
I've wrote a servlet code from there I want to pass a value to jsp. How can I do it. can anyone suggest a code? Not using eniumuration
5
by: xirowei | last post by:
i'm newbie in java servlet, how to let public void doPost can access to public void doGet, stringLength variable? below is my code: import javax.servlet.*; import javax.servlet.http.*; import...
2
kaleeswaran
by: kaleeswaran | last post by:
hi! i need to pass the value from the servlet to javascritp.....how can i do that?.. give me some solution..... thank you, ...
5
by: JohnDriver | last post by:
Hi, I am having a form which has a text box and 3 radio buttons. I am using GET method in Ajax to pass the value. I can pass the value of the textbox fine but how to pass the value of radio...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.