473,624 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calling a servlet from ajax in portlets

1 New Member
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 servlet name is Ajax.

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javaScript">
  2.   var PATH = "<%= request.getContextPath() %>";
  3.   var Ajax_SERVLET = PATH + "/Ajax";
  4.   function showProduct(str)
  5.   {    
  6.   alert("Inside the function");
  7.   xmlHttp=GetXmlHttpObject();
  8.     if (xmlHttp==null)
  9.       {
  10.       alert ("Your browser does not support AJAX!");
  11.       return;
  12.       } 
  13.     var url=Ajax_SERVLET;
  14.     alert(url);
  15.     xmlHttp.onreadystatechange=stateChanged;
  16.     xmlHttp.open("GET",url,true);
  17.     xmlHttp.send(null);
  18. }
please help me as soon as possible..

regards,
archana
Jun 28 '07 #1
2 2595
KishoreM
12 New Member
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 servlet name is Ajax.

<script language="javas cript" type="text/javaScript">
var PATH = "<%= request.getCont extPath() %>";
var Ajax_SERVLET = PATH + "/Ajax";
function showProduct(str )
{
alert("Inside the function");
xmlHttp=GetXmlH ttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url=Ajax_SERVLE T;
alert(url);
xmlHttp.onready statechange=sta teChanged;
xmlHttp.open("G ET",url,true) ;
xmlHttp.send(nu ll);
}

please help me as soon as possible..

regards,
archana
Please specify what exatly problem you are facing ??
Jun 28 '07 #2
chirag1011
1 New Member
Hi Archana,
This is Chirag here. I am also trying to do the same thing but still not gettting solution. I tried to call the portlet and to some extent I a have succeeded but after that not able to display the output again on JSP. One of the link says that you cannot make a direct Ajax call to portlets as it renders the portal content also along with the target portlet.
Well you can contact me on my personal id chirag.rana@red iffmail.com
Regards,
Chirag
Sr. Software Engineer (Portal Practice)
IM: chirag.rana@yah oo.co.in
Jul 9 '07 #3

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

Similar topics

2
2464
by: Rose Girl | last post by:
Hi Need some help on javascript. I need to know how to call a servlet from a javascript function. web-inf (jboss) path for servlet is: com.purpleace.ripple.admin.contacts.servlet.AdminReport web xml <servet-mapping> is :
3
8519
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. is there a way i can call a servlet from javascript and process the results directly - and in this case get the percent done and then update the progress bar.
3
1311
by: Peter Imburg | last post by:
Does anyone know whether it is possible/advisable/stable to call aspnet_wp.exe from a process besides the inetinfo.exe or dllhost.exe? For example, is there a way of passing the form parameters in and getting the response output? Many thanks, Peter
3
10927
by: Shinya Koizumi | last post by:
I am trying to call a servlet i created. Basically this servlet will let user create a new account at the server. I have created the function "CreateAccount()" but http_request.readyState always return me 0 What is wrong with my code? function CreateAccount() { if( window.XMLHttpRequest )
1
2144
by: monudjn | last post by:
Hi I am implementing ajax in portal. Using ajax i am able to updating the content of portlets asynchronously. However i am facing a problem The Problem: While submitting the form i am getting javascript error " Object expected". These errors i am getting after implementing ajax. Also this error is shown only the first time i trying to submit. Next time this error won't come. This may be because the ajax update the content dynamically and if...
4
2963
by: Bilwin | last post by:
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.
1
2442
by: Pesho318i | last post by:
Hi all, My question may be too fundamental, but I couldn't find a solution so far. I have a Java servlet deployed in tomcat. Apart from that, I have JavaScript functions which should asynchronously pass information to the Java servlet, so that I can use the servlet functions. I know the basics of AJAX and I still can't figure this out. I'd be very grateful if you could give me a hint how to do it. Have a nice day, Pesho
6
4970
by: santhoskumara | last post by:
How to request to servlet from Ajax and also I got the DOM object in the servlet through Business Logic. Now how will i pass the DOM object from serlvet to Clientside. Where in the client Side i am using Ajax. kindly advice me.
1
8122
sid0404
by: sid0404 | last post by:
Hi I need to send data from my servlet to my html(which contains AJAX), so as per the motivation of the AJAX, this should be done without my webpage reloading / refresh. my code on the ajax side is something like this: var xmlHttp = false; function getXMLHttpRequest(val) {
0
8179
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8685
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8341
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8490
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7174
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4184
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1489
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.