Iam trying to do the following example:

I have file called main.jsp with the code:

<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/
>
    <title><%=Constants.COMMON_TITLE_BASE%>
    </title>
    <link href="scripts/style.css" rel="stylesheet" type="text/css"/>
    <link href="scripts/menu.css" rel="stylesheet" type="text/css"/>
    <script language="javascript" src="scripts/jquery-1.3.2.min.js"></
script>
    <script language="javascript" src="scripts/jquery.dimensions.js"></
script>
<!--    <script language="javascript" src="scripts/ajax/
prototype-1.6.0.3.js"></script>-->
    <script language="javascript" src="scripts/ajax/
main.prototype.ajax.js"></script>
        <script language="javascript" src="scripts/ajax/prototype.js"></
script>



</head>
<body>

                <fmt:bundle basename="common" >

<jsp:include page="/menu.jsp"/>
<p>
    <header>DNI: <%=request.getRemoteUser()%> > Home</header>
</p>
<p> <fmt:message key="home.simple"/>  <%=request.getRemoteUser()%>!
</p>

<p>
This is the ajax example

<form id="form">
First name
<input type="text" id="firstName" name="firstName" MAXLENGTH=20 />
Second name
<input type="text" id="secondName" name="secondName" MAXLENGTH=20 />

<input type="submit" value="Submit" onclick="ajaxFunction();" />
</form>

</p>

<p>&nbsp;</p>

<p> <fmt:message key="home.message"/>  </p>

                   </fmt:bundle>

</body>
</html>

In the file "main.prototype.ajax.js"

i have the code:

/
***************************************************************************/

function getUrl(){
         url = window.location.protocol + "//" + window.location.host+ "/
I_COLLEGE/ajax.do?ActionID=600";
        return url;
}

/
***********************************************************************/

function getPostBody(){
        return ("firstName=aa&secondName=bb");
}

/
************************************************************************/
function getOptions(){

        return {method:'get',
        onComplete:doComplete,
        onSuccess:successFunc,
        onFailure:failureFunc,
        parameters:getPostBody(),
        postBody:getPostBody()};

}

/
*************************************************************************/
function ajaxFunction(){

        new Ajax.Request(getUrl(),getOptions());
}

/**************************************************************/

function doComplete(){

        alert('sss');

}

/*********************************/
function successFunc(response){

     if (200 == response.status){
        alert("Call is success");
    }
    var container = $('notice');
    var content = response.responseText;
    container.update(content);
}
/**********************************/
function failureFunc(response){

     alert("Call is failed" );

}
/********************/

and when i do click in the button , checking i know that the info goes
to the servlet but then with firebug and firefox i dont get the
response.

With firebug i get:
"
GET ajax.do?ActionID=600&firstName=aa&secondName=bb
http://localhost:8080/I_COLLEGE/ajax.do?ActionID=600&firstName=aa&secondName=bb

Timeout

localhost:8080"

so i know that there is a timeout but then i see:
"Firebug's log limit has been reached. 0 entries not shown.
Preferences
uncaught exception: [Exception... "'[JavaScript Error: "Prototype is
not defined" {file: "http://localhost:8080/I_COLLEGE/scripts/ajax/
prototype.js" line: 1351}]' when calling method:
[nsIDOMEventListener::handleEvent]" nsresult: "0x80570021
(NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "native
frame :: <unknown filename> :: <TOP_LEVEL> :: line 0" data: yes]
"
I try to find what happened but i cant find the solution.
Any ideas or a clear example of prototype with servlets?.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to