Help for a confused Object Error

View: New views
4 Messages — Rating Filter:   Alert me  

Help for a confused Object Error

by Alex Chew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,all
 
I got a strange 'Object Error' problem in my application.
 
There is a method named getGrantServices in my Java class and I made it explosed to javascript with dwr.
DWR.xml file was checked again and again but found no errors, all items needed were there.
I saw the method with http://localhost/dwr/index.html,  and I tested the method there.All went right.
 
But there is an [Object error] when I try to make it refered in my JSP file!
I was totally confused,please help me for such a question.
 
Thanks in advance.
Yours
Alex

Re: Help for a confused Object Error

by David Marginian-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alex,
  We can help but we can't help unless you give us the code!  So send us
your html/javascript file please.

Alex Chew wrote:

> Hi,all
>  
> I got a strange 'Object Error' problem in my application.
>  
> There is a method named getGrantServices in my Java class and I made
> it explosed to javascript with dwr.
> DWR.xml file was checked again and again but found no errors, all
> items needed were there.
> I saw the method with http://localhost/dwr/index.html,  and I tested
> the method there.All went right.
>  
> But there is an [Object error] when I try to make it refered in my JSP
> file!
> I was totally confused,please help me for such a question.
>  
> Thanks in advance.
> Yours
> Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Help for a confused Object Error

by Alex Chew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your rapid response.
I checked once more time,but still failed to find out where the error stay.
 
Following pieces is all that I used in my application:
 
Java service signature:
package com.ucenter.kradar.service;
public String getGrantServices(String username,String password,HttpServletRequest request){....}
public String search(String username,String password,String serviceId,String keywords,int pageNo,int numberPerPage,HttpServletRequest request){...}
 
DWR config fragments:
<!DOCTYPE dwr PUBLIC
    "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
    "http://www.getahead.ltd.uk/dwr/dwr10.dtd">
<dwr>
    <create creator="new" javascript="KradarAjax">
     <param name="class" value="com.ucenter.kradar.service.KradarAjax"/>
        <include method="getGrantServices"/>
        <include method="search"/>             
    </create>      
  </allow>
  <signatures>
    <![CDATA[
       import java.util.Map;
       import java.util.List;
       import javax.servlet.http.HttpServletRequest;  
       import com.ucenter.kradar.service.KradarAjax;                                                          
       KradarAjax.getGrantServices(String username,String password,HttpServletRequest request);
       KradarAjax.search(String username,String password,String serviceId,String keywords,int pageNo,int numberPerPage,HttpServletRequest request);            
       ]]>
  </signatures>
</dwr>
 
HTML with javascript:
 
<html>
<head>
<link type="text/css" rel="stylesheet" href="http://222.211.209.170/style/client.css" />
<script type="text/javascript" src="http://222.211.209.170/script/KradarClient.js"></script>
<script type="text/javascript" src="http://222.211.209.170/dwr/interface/KradarAjax.js"></script>
<script type="text/javascript" src="http://222.211.209.170/dwr/engine.js"></script>
<script type="text/javascript" src="http://222.211.209.170/dwr/util.js"></script>
<script>
function createKradarSearch(){
 var username="Alex Chew";
 var password="password";
 var kradar = new KradarSearch(username,password);
 var queryDiv = "queryDiv";
 var resultDiv = "resultDiv";
 var numberPerPage = "20";
 createQueryDiv(kradar,queryDiv,resultDiv,numberPerPage);
}
</script>
</head>
<body onload="createKradarSearch()">
 <div style="border:1px solid #E3D686;width:100%;">
 <div style="font-size:12px;color:#ff6600;width:100%;background-color:#F2EAB7;border-bottom:1px solid #E3D686;">AJAX Samples</div>
 <div id="queryDiv" style="width:100%;">Here is the location of query panel. The result from ajax will fill it.</div>
 <div id="resultDiv" style="width:100%;">Query result will appear here</div>
 </div>
</body>
</html>

RE: Help for a confused Object Error

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just guessing here, but are you seeing the [object Error] in IE? (this is how JavaScript exceptions are printed in IE) Then you probably can get a better error message by printing the exception's message property instead.
 
If you haven't got a reference to the exception then you can have whoever printing it out include the interesting properties by adding this in an early script block of your html file:
 
    Error.prototype.toString = function() { return this.name + ": " + this.message; }
 
Also, do check the DWR server side log for errors.
And consider upgrading to DWR 2.x (your dwr.xml mentions 1.0).
 
Best regards
Mike Wilson


From: Alex Chew [mailto:chew.alex@...]
Sent: den 23 juni 2008 15:36
To: users@...
Subject: [dwr-user] Help for a confused Object Error

Hi,all
 
I got a strange 'Object Error' problem in my application.
 
There is a method named getGrantServices in my Java class and I made it explosed to javascript with dwr.
DWR.xml file was checked again and again but found no errors, all items needed were there.
I saw the method with http://localhost/dwr/index.html,  and I tested the method there.All went right.
 
But there is an [Object error] when I try to make it refered in my JSP file!
I was totally confused,please help me for such a question.
 
Thanks in advance.
Yours
Alex
LightInTheBox - Buy quality products at wholesale price