I got that to work by changing the url to the full path:

   function validate()
   {

       var idField=document.getElementById("taskid");
       var url = "http://smith-xp:8080/rapsheet/validate?id="; + escape(
idField.value);
       ....


However this now does not work in Firefox - only in IE.

Any ideas where Firefox would be picking up teh problem?

I pinpointed the problem to occur at: req.open("GET", url, true);
No alerts after this line are reached.

Thanks,

Akshay


On 7/6/06, Akshay Ahooja <[EMAIL PROTECTED]> wrote:

Hi,

I am using Struts Bridge in J2, with AJAX components.

For regular links, using <html:link works out fine, however for Ajax, I
have a validate function:

    function validate()
    {

        var idField= document.getElementById("taskid");
        var url = "validate?id=" + escape(idField.value);
        if (window.XMLHttpRequest) {
            req = new XMLHttpRequest();
        }
        else {
            req = new ActiveXObject("Microsoft.XMLHTTP");
        }


        req.open("GET", url, true);
        req.onreadystatechange=callback;
        req.send(null);
    }

This validate function has a url that it uses. It works fine as a WebApp
but gives a javascript "Object Expected" error when ran in J2.I assume
this is because of the URL itself. How do I call this URL within this
function? (Is GET ok or does it need to be POST? - I do not wish to use POST
as it will limit my application, and plus this does not affect the server
side application state.)

My URI in web.xml is:

     <servlet>
        <servlet-name>validate</servlet-name>
        <servlet-class>com.svvc.rap.ValidateServlet</servlet-class>
        <url-pattern>*.do</url-pattern>
    </servlet>
    <servlet-mapping>
        <servlet-name>validate</servlet-name>
        <url-pattern>/validate</url-pattern>
    </servlet-mapping>





Reply via email to