Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

graham king

Ranch Hand
+ Follow
since Dec 30, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by graham king

Originally posted by Ulf Dittmer:
Welcome to JavaRanch.

Unlike web apps, applets do not really have a "deployment" process. You just put them in one of the publicly accessible directories, and they're available right away. Any jar files you have go into the same directory that the HTML file containing the applet is in, not into the WEB-INF/lib directory. To use them, you need to specify them in yout applet tag via " archive="some.jar" ".




Thanks ULF,
It's been awhile since I've worked with an Applet and you just saved me alot of pain.

This is a gem: http://www.javapowupload.com/
12 years ago

Originally posted by graham king:


found here: http://www.prototypejs.org/learn/introduction-to-ajax

Thanks man!



Works like a charm!!!



Originally posted by Bear Bibeault:
Depends on how you are doing your Ajax. If you are using a smart library such as Prototype or jQuery, you can embed a script tag into the returned response and it will be executed when the response is added to the DOM.

Otherwise, not so easy...



Bear, it looks like this is what you where talking about:



Updating your page dynamically with Ajax.Updater

Developers often want to make Ajax requests to receive HTML fragments that update parts of the document. With Ajax.Request with an onComplete callback this is fairly easy, but with Ajax.Updater it's even easier!

Suppose you have this code in your HTML document:

<h2>Our fantastic products</h2>
<div id="products">(fetching product list ...)</div>

The 'products' container is empty and you want to fill it with HTML returned from an Ajax response. No problem:

new Ajax.Updater('products', '/some_url', { method: 'get' });

That's all, no more work. The arguments are the same of Ajax.Request, except there is the receiver element in the first place. Prototype will automagically update the container with the response using the Element.update() method.

If your HTML comes with inline scripts, they will be stripped by default. You'll have to pass true as the evalScripts option in order to see your scripts being executed.



found here: http://www.prototypejs.org/learn/introduction-to-ajax

Thanks man!

Originally posted by Bear Bibeault:
For a quick learning curve and easy retro-fitting, I'd recommend jQuery over Prototype.



Thanks Bear.
I'd say lack of understanding towards the various libraries. As well I'm sort of a control freak when it comes to modifying and creating code. I like to get into the details of the code if it needs to be tweaked to get the results that are needed.

I wonder if I would be able to retro fit what I've done to harness the power of the prototype library?

I know I'm using the prototype library via a sourceforge project named "AJAX JSP Tag Library", but, again I'm not all that certain how to use it.

Originally posted by Bear Bibeault:

Yes. Don't.

In this day and age, not using a library for your Ajax is borderline insane. There are so many nuances that these libraries take care of for you (embedded JavaScript being just one of them), that trying to do "raw Ajax" should be a committable offense.

So why are you doing it the "hard way"?

Of course I'm doing it the hard way...

Any suggestions?

Originally posted by Bear Bibeault:
Depends on how you are doing your Ajax. If you are using a smart library such as Prototype or jQuery, you can embed a script tag into the returned response and it will be executed when the response is added to the DOM.

Otherwise, not so easy...

Hi All,

I've written a list display within a tag-lib that I am attempting to migrate to AJAX. The flow now consists of first displaying a search page and then dynamically inserting the list into the page after a search and allowing the browser to interpret it. This works fine, however, the list has an embedded tag which relies on another js call to determine if the record meets some criteria.

In the tag-lib I was able to get this js call to execute using the window dot on load method:


However, since the js is inserting the results it appears that the extra js call within the window dot on load never gets executed.

I can't put the call into the container page because the parameters for the js method are generated when the list is created.

Does anyone know of a way that I can force a js call when the AJAX returns the response?

Thanks a Million,
Graham

Originally posted by Vilmantas Baranauskas:
Yes, it is possible.

If your application is running inside tomcat, you may use tomcat compression.
http://tomcat.apache.org/tomcat-5.5-doc/config/http.html

If your application server is connected through apache, you may use apache's deflate_module to compress result.



Using our compression filter I'm able to send the data back compressed but since the browser isn't handling the call my js method is the data just gets plopped onto the page all scrambled.

It seems like there might need to be some sort of communication between the js method and the browser to descramble the data. Maybe like some kinda plugin that allows us to pass along the compressed data with a location for the browser to display it?

Originally posted by Bear Bibeault:
Different browsers will implement this differently. Why do you care? You're never going to get anything but a form implementation from document.forms (unless it's undefined which is easily tested for) so why the need for a check?



For some reason I'm not receiving a form in the different browsers. As stated before some are sending a collection (i.e., collection->form->input elems), ie an object and firefox a form.

I was able to get it to work by checking for a known field within the form.


It seems kinda weird.

Wait a sec.... I have two forms with the same name....

:slapsforehead:
[ May 29, 2008: Message edited by: graham king ]
Is it possible to determine if you have hold of an HTMLFormElement?

3 of 4 different browsers return different objects for one call:
FireFox: HTMLFormElement
IExplorer: object
Safari: HTMLCollection
Opera: HTMLCollection

This doesn't work for all browsers. Fails in FireFox and IE.


Any ideas?
Does anyone know if it is possible to compress the response to an XMLHttpRequest? Are there any examples out there?

Originally posted by Bear Bibeault:
Yup.



Thanks, I got a little nervous seeing the Firebug response in Firefox. But I guess that's the browser translation of the response.
I'm working on an ajax call which returns results that contains some sensitive user data. The application uses an ssl certificate during normal day to day operations.

I was curious if the browser will still use the certificate and encrypt the data if I were to make an ajax call via the https protocol? Do any of you know of a good way to test the flow and server response?

Thanks,
Graham
I just tried this call and get a VersionMismatch Error
12 years ago