Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-20-2008, 01:03 AM
Member
 
Join Date: May 2008
Posts: 14
hussainzim is on a distinguished road
how to send values from servlet..
hi..im using ajax to send some data according to the name selected from the combo box to the servlet..i hav managed to get the necessary values from the database to the servlet as a LIST but im clueless on how to send those values to jsp and print in the page...if i can hav a smaple code it would be very helpful..thank u in advance...

Hussain

Ajax Code..
--------------------------------------------------
var selectedAuthor = author.options[author.selectedIndex].value
alert(selectedAuthor);
var url = "/HRS2/AjaxServlet?author=" + escape(author.value);

if (window.XMLHttpRequest) {
req = new XMLHttpRequest( );
}
else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("Get",url,true);
req.onreadystatechange = callbackAuthor;
req.send(null);


}

function callbackAuthor() {

if (req.readyState==4) {

if (req.status == 200) {

authorCheck( );

}
else
{

}
}
}

function authorCheck( ) {
//i think the printing comes here...
}
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-19-2008, 06:51 AM
Member
 
Join Date: Jun 2008
Posts: 12
weiwei is on a distinguished road
新加的空白文章1
这是新加的空白文章1,可以在UBB可视化编辑器中,添加和修改文章内容。
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-06-2008, 08:28 AM
Member
 
Join Date: Jul 2008
Posts: 8
lukky is on a distinguished road
Hi friend,
u can use the response.getwriter,write(String value);in the servlet.
in the jsp page after response is coming,then u write the code at the ajax code.
var s=xmlHttp.responseText;
var tem=s.split("+");
document.getElementById("name").innerHTML=tem[0];
and to display the name in the page,u can write the code
<div id="name"></div>
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing boolean Values of another values in one class. a_iyer20 Advanced Java 4 04-15-2008 02:04 PM
how to send and receive data from servlet to applet Continuously ?? jega_ms Java Servlet 1 01-28-2008 11:49 AM
Using bean to send parameters from one Servlet to another Java Tip Java Tips 0 01-27-2008 09:17 PM
How to read attributes and values in a xml file using servlet pragathi_forum Advanced Java 1 12-18-2007 06:46 PM
Getting HTML form values in Servlet Java Tip Java Tips 0 11-17-2007 09:13 PM


All times are GMT +3. The time now is 09:03 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org