DWR: error in convert from java object to javascript.

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

DWR: error in convert from java object to javascript.

by czyjava :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Using DWR ajax, I can convert java object to javascript object, but I can't convert an object in javascript to a java object.


var setting = {id: item.Id, name: item.name, val:item.val}; //wrong, data is '[reference:c0-e2]'
var setting = {id:'1200', name: 'name', val:'ssss'};  //correct

AjaxUtil.saveSetting(setting, {callback:function(data){
    alert("data is saved through DWR");
}});


the error message is
 DEBUG [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:  c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6], c0-e1=Array:[reference:c0-e2], c0-e2=string:1000, c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd,
INFO [org.directwebremoting.impl.DefaultRemoter 51] - Exec: AjaxUtil.saveSetting()
 DEBUG [org.directwebremoting.impl.DefaultRemoter 43] - --Object found in session. id=0
 DEBUG [com.util.AjaxUtil 24] - save setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6]

I have defined in the dwr.xml
<convert converter="bean" javascript="Setting" match="com.model.Setting"/>

Do I miss some something ?

Thank.

Re: DWR: error in convert from java object to javascript.

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Send us your dwr.xml and the java method you are calling.

On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@...> wrote:
Using DWR ajax, I can convert java object to javascript object, but I can't convert an object in javascript to a java object. [code] var setting = {id: item.Id, name: item.name, val:item.val}; //wrong, data is '[reference:c0-e2]' var setting = {id:'1200', name: 'name', val:'ssss'}; //correct AjaxUtil.saveSetting(setting, {callback:function(data){ alert("data is saved through DWR"); }}); [/code] the error message is DEBUG [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment: c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6], c0-e1=Array:[reference:c0-e2], c0-e2=string:1000, c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO [org.directwebremoting.impl.DefaultRemoter 51] - Exec: AjaxUtil.saveSetting() DEBUG [org.directwebremoting.impl.DefaultRemoter 43] - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I have defined in the dwr.xml Do I miss some something ? Thank.

View this message in context: DWR: error in convert from java object to javascript.
Sent from the DWR - Users mailing list archive at Nabble.com.


Re: DWR: error in convert from java object to javascript.

by czyjava :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

DWR is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" "http://getahead.org/dwr/dwr20.dtd">

<dwr>
    <allow>
        <convert converter="bean" javascript="Setting" match="com.abs.model.Setting"/>
        <create creator="spring" javascript="AjaxUtil" scope="session">
           
        </create>
    </allow>
</dwr>

java method is
public Setting saveSetting(Setting setting){
        try {
            logger.debug("save setting:"+setting.getSettingId()+"--"+setting.getName()+"--"+setting.getVal());
            this.service.saveObj(setting);
        } catch (Exception ex) {
            logger.debug(ex.getMessage());          
        }
        return setting;
    }

Thanks.

David Marginian-3 wrote:
Send us your dwr.xml and the java method you are calling.

On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@gmail.com> wrote:

> Using DWR ajax, I can convert java object to javascript object, but I can't
> convert an object in javascript to a java object. [code] var setting = {id:
> item.Id, name: item.name, val:item.val}; //wrong, data is
> '[reference:c0-e2]' var setting = {id:'1200', name: 'name', val:'ssss'};
> //correct AjaxUtil.saveSetting(setting, {callback:function(data){
> alert("data is saved through DWR"); }}); [/code] the error message is DEBUG
> [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:
> c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6],
> c0-e1=Array:[reference:c0-e2], c0-e2=string:1000,
> c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO
> [org.directwebremoting.impl.DefaultRemoter 51] - Exec:
> AjaxUtil.saveSetting() DEBUG [org.directwebremoting.impl.DefaultRemoter 43]
> - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save
> setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I have
> defined in the dwr.xml Do I miss some something ? Thank.
> ------------------------------
> View this message in context: DWR: error in convert from java object to
> javascript.<http://www.nabble.com/DWR%3A-error-in-convert-from-java-object-to-javascript.-tp24330468p24330468.html>
> Sent from the DWR - Users mailing list archive<http://www.nabble.com/DWR---Users-f13934.html>at Nabble.com.
>

Re: DWR: error in convert from java object to javascript.

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What version of DWR are you using and have you tried removing the
javascript attribute on your converter?

<convert converter="bean" match="com.abs.model.Setting"/>



czyjava wrote:

> DWR is
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN"
> "http://getahead.org/dwr/dwr20.dtd">
>
> <dwr>
>     <allow>
>         <convert converter="bean" javascript="Setting"
> match="com.abs.model.Setting"/>
>         <create creator="spring" javascript="AjaxUtil" scope="session">
>            
>         </create>
>     </allow>
> </dwr>
>
> java method is
> public Setting saveSetting(Setting setting){
>         try {
>             logger.debug("save
> setting:"+setting.getSettingId()+"--"+setting.getName()+"--"+setting.getVal());
>             this.service.saveObj(setting);
>         } catch (Exception ex) {
>             logger.debug(ex.getMessage());          
>         }
>         return setting;
>     }
>
> Thanks.
>
>
> David Marginian-3 wrote:
>  
>> Send us your dwr.xml and the java method you are calling.
>>
>> On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@...> wrote:
>>
>>    
>>> Using DWR ajax, I can convert java object to javascript object, but I
>>> can't
>>> convert an object in javascript to a java object. [code] var setting =
>>> {id:
>>> item.Id, name: item.name, val:item.val}; //wrong, data is
>>> '[reference:c0-e2]' var setting = {id:'1200', name: 'name', val:'ssss'};
>>> //correct AjaxUtil.saveSetting(setting, {callback:function(data){
>>> alert("data is saved through DWR"); }}); [/code] the error message is
>>> DEBUG
>>> [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:
>>> c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6],
>>> c0-e1=Array:[reference:c0-e2], c0-e2=string:1000,
>>> c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO
>>> [org.directwebremoting.impl.DefaultRemoter 51] - Exec:
>>> AjaxUtil.saveSetting() DEBUG [org.directwebremoting.impl.DefaultRemoter
>>> 43]
>>> - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save
>>> setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I have
>>> defined in the dwr.xml Do I miss some something ? Thank.
>>> ------------------------------
>>> View this message in context: DWR: error in convert from java object to
>>> javascript.<http://www.nabble.com/DWR%3A-error-in-convert-from-java-object-to-javascript.-tp24330468p24330468.html>
>>> Sent from the DWR - Users mailing list
>>> archive<http://www.nabble.com/DWR---Users-f13934.html>at Nabble.com.
>>>
>>>      
>>    
>
>  


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


Re: DWR: error in convert from java object to javascript.

by czyjava :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

another weird thing is

var newSetting = {settingId: item.settingId};
doesn't work. I have to manually conver it to a string, like
var newSetting = {settingId: item.settingId+""};

I am using Dojo, it is related to Dojo ?

Thanks,

David Marginian-3 wrote:
Send us your dwr.xml and the java method you are calling.

On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@gmail.com> wrote:

> Using DWR ajax, I can convert java object to javascript object, but I can't
> convert an object in javascript to a java object. [code] var setting = {id:
> item.Id, name: item.name, val:item.val}; //wrong, data is
> '[reference:c0-e2]' var setting = {id:'1200', name: 'name', val:'ssss'};
> //correct AjaxUtil.saveSetting(setting, {callback:function(data){
> alert("data is saved through DWR"); }}); [/code] the error message is DEBUG
> [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:
> c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6],
> c0-e1=Array:[reference:c0-e2], c0-e2=string:1000,
> c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO
> [org.directwebremoting.impl.DefaultRemoter 51] - Exec:
> AjaxUtil.saveSetting() DEBUG [org.directwebremoting.impl.DefaultRemoter 43]
> - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save
> setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I have
> defined in the dwr.xml Do I miss some something ? Thank.
> ------------------------------
> View this message in context: DWR: error in convert from java object to
> javascript.<http://www.nabble.com/DWR%3A-error-in-convert-from-java-object-to-javascript.-tp24330468p24330468.html>
> Sent from the DWR - Users mailing list archive<http://www.nabble.com/DWR---Users-f13934.html>at Nabble.com.
>

Re: DWR: error in convert from java object to javascript.

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try calling the method from the DWR test page please.  You will need to
enable debug mode to do this.
http://directwebremoting.org/dwr/server/servlet/index.html

czyjava wrote:

> another weird thing is
>
> var newSetting = {settingId: item.settingId};
> doesn't work. I have to manually conver it to a string, like
> var newSetting = {settingId: item.settingId+""};
>
> I am using Dojo, it is related to Dojo ?
>
> Thanks,
>
>
> David Marginian-3 wrote:
>  
>> Send us your dwr.xml and the java method you are calling.
>>
>> On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@...> wrote:
>>
>>    
>>> Using DWR ajax, I can convert java object to javascript object, but I
>>> can't
>>> convert an object in javascript to a java object. [code] var setting =
>>> {id:
>>> item.Id, name: item.name, val:item.val}; //wrong, data is
>>> '[reference:c0-e2]' var setting = {id:'1200', name: 'name', val:'ssss'};
>>> //correct AjaxUtil.saveSetting(setting, {callback:function(data){
>>> alert("data is saved through DWR"); }}); [/code] the error message is
>>> DEBUG
>>> [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:
>>> c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6],
>>> c0-e1=Array:[reference:c0-e2], c0-e2=string:1000,
>>> c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO
>>> [org.directwebremoting.impl.DefaultRemoter 51] - Exec:
>>> AjaxUtil.saveSetting() DEBUG [org.directwebremoting.impl.DefaultRemoter
>>> 43]
>>> - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save
>>> setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I have
>>> defined in the dwr.xml Do I miss some something ? Thank.
>>> ------------------------------
>>> View this message in context: DWR: error in convert from java object to
>>> javascript.<http://www.nabble.com/DWR%3A-error-in-convert-from-java-object-to-javascript.-tp24330468p24330468.html>
>>> Sent from the DWR - Users mailing list
>>> archive<http://www.nabble.com/DWR---Users-f13934.html>at Nabble.com.
>>>
>>>      
>>    
>
>  


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


Re: DWR: error in convert from java object to javascript.

by czyjava :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

DWR 2.0.5. I tried it already, same error.

David Marginian-3 wrote:
What version of DWR are you using and have you tried removing the
javascript attribute on your converter?

<convert converter="bean" match="com.abs.model.Setting"/>



czyjava wrote:
> DWR is
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN"
> "http://getahead.org/dwr/dwr20.dtd">
>
> <dwr>
>     <allow>
>         <convert converter="bean" javascript="Setting"
> match="com.abs.model.Setting"/>
>         <create creator="spring" javascript="AjaxUtil" scope="session">
>            
>         </create>
>     </allow>
> </dwr>
>
> java method is
> public Setting saveSetting(Setting setting){
>         try {
>             logger.debug("save
> setting:"+setting.getSettingId()+"--"+setting.getName()+"--"+setting.getVal());
>             this.service.saveObj(setting);
>         } catch (Exception ex) {
>             logger.debug(ex.getMessage());          
>         }
>         return setting;
>     }
>
> Thanks.
>
>
> David Marginian-3 wrote:
>  
>> Send us your dwr.xml and the java method you are calling.
>>
>> On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@gmail.com> wrote:
>>
>>    
>>> Using DWR ajax, I can convert java object to javascript object, but I
>>> can't
>>> convert an object in javascript to a java object. [code] var setting =
>>> {id:
>>> item.Id, name: item.name, val:item.val}; //wrong, data is
>>> '[reference:c0-e2]' var setting = {id:'1200', name: 'name', val:'ssss'};
>>> //correct AjaxUtil.saveSetting(setting, {callback:function(data){
>>> alert("data is saved through DWR"); }}); [/code] the error message is
>>> DEBUG
>>> [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:
>>> c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6],
>>> c0-e1=Array:[reference:c0-e2], c0-e2=string:1000,
>>> c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO
>>> [org.directwebremoting.impl.DefaultRemoter 51] - Exec:
>>> AjaxUtil.saveSetting() DEBUG [org.directwebremoting.impl.DefaultRemoter
>>> 43]
>>> - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save
>>> setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I have
>>> defined in the dwr.xml Do I miss some something ? Thank.
>>> ------------------------------
>>> View this message in context: DWR: error in convert from java object to
>>> javascript.<http://www.nabble.com/DWR%3A-error-in-convert-from-java-object-to-javascript.-tp24330468p24330468.html>
>>> Sent from the DWR - Users mailing list
>>> archive<http://www.nabble.com/DWR---Users-f13934.html>at Nabble.com.
>>>
>>>      
>>    
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
For additional commands, e-mail: users-help@dwr.dev.java.net

Re: DWR: error in convert from java object to javascript.

by czyjava :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

because it is an object, I don't know how to test it in the test page.

David Marginian-3 wrote:
Try calling the method from the DWR test page please.  You will need to
enable debug mode to do this.
http://directwebremoting.org/dwr/server/servlet/index.html

czyjava wrote:
> another weird thing is
>
> var newSetting = {settingId: item.settingId};
> doesn't work. I have to manually conver it to a string, like
> var newSetting = {settingId: item.settingId+""};
>
> I am using Dojo, it is related to Dojo ?
>
> Thanks,
>
>
> David Marginian-3 wrote:
>  
>> Send us your dwr.xml and the java method you are calling.
>>
>> On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@gmail.com> wrote:
>>
>>    
>>> Using DWR ajax, I can convert java object to javascript object, but I
>>> can't
>>> convert an object in javascript to a java object. [code] var setting =
>>> {id:
>>> item.Id, name: item.name, val:item.val}; //wrong, data is
>>> '[reference:c0-e2]' var setting = {id:'1200', name: 'name', val:'ssss'};
>>> //correct AjaxUtil.saveSetting(setting, {callback:function(data){
>>> alert("data is saved through DWR"); }}); [/code] the error message is
>>> DEBUG
>>> [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:
>>> c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6],
>>> c0-e1=Array:[reference:c0-e2], c0-e2=string:1000,
>>> c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO
>>> [org.directwebremoting.impl.DefaultRemoter 51] - Exec:
>>> AjaxUtil.saveSetting() DEBUG [org.directwebremoting.impl.DefaultRemoter
>>> 43]
>>> - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save
>>> setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I have
>>> defined in the dwr.xml Do I miss some something ? Thank.
>>> ------------------------------
>>> View this message in context: DWR: error in convert from java object to
>>> javascript.<http://www.nabble.com/DWR%3A-error-in-convert-from-java-object-to-javascript.-tp24330468p24330468.html>
>>> Sent from the DWR - Users mailing list
>>> archive<http://www.nabble.com/DWR---Users-f13934.html>at Nabble.com.
>>>
>>>      
>>    
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
For additional commands, e-mail: users-help@dwr.dev.java.net

Re: DWR: error in convert from java object to javascript.

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pretty simple:

{prop1: "prop1val", etc., etc.}





czyjava wrote:

> because it is an object, I don't know how to test it in the test page.
>
>
> David Marginian-3 wrote:
>  
>> Try calling the method from the DWR test page please.  You will need to
>> enable debug mode to do this.
>> http://directwebremoting.org/dwr/server/servlet/index.html
>>
>> czyjava wrote:
>>    
>>> another weird thing is
>>>
>>> var newSetting = {settingId: item.settingId};
>>> doesn't work. I have to manually conver it to a string, like
>>> var newSetting = {settingId: item.settingId+""};
>>>
>>> I am using Dojo, it is related to Dojo ?
>>>
>>> Thanks,
>>>
>>>
>>> David Marginian-3 wrote:
>>>  
>>>      
>>>> Send us your dwr.xml and the java method you are calling.
>>>>
>>>> On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@...> wrote:
>>>>
>>>>    
>>>>        
>>>>> Using DWR ajax, I can convert java object to javascript object, but I
>>>>> can't
>>>>> convert an object in javascript to a java object. [code] var setting =
>>>>> {id:
>>>>> item.Id, name: item.name, val:item.val}; //wrong, data is
>>>>> '[reference:c0-e2]' var setting = {id:'1200', name: 'name',
>>>>> val:'ssss'};
>>>>> //correct AjaxUtil.saveSetting(setting, {callback:function(data){
>>>>> alert("data is saved through DWR"); }}); [/code] the error message is
>>>>> DEBUG
>>>>> [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:
>>>>> c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6],
>>>>> c0-e1=Array:[reference:c0-e2], c0-e2=string:1000,
>>>>> c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO
>>>>> [org.directwebremoting.impl.DefaultRemoter 51] - Exec:
>>>>> AjaxUtil.saveSetting() DEBUG [org.directwebremoting.impl.DefaultRemoter
>>>>> 43]
>>>>> - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save
>>>>> setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I have
>>>>> defined in the dwr.xml Do I miss some something ? Thank.
>>>>> ------------------------------
>>>>> View this message in context: DWR: error in convert from java object to
>>>>> javascript.<http://www.nabble.com/DWR%3A-error-in-convert-from-java-object-to-javascript.-tp24330468p24330468.html>
>>>>> Sent from the DWR - Users mailing list
>>>>> archive<http://www.nabble.com/DWR---Users-f13934.html>at Nabble.com.
>>>>>
>>>>>      
>>>>>          
>>>>    
>>>>        
>>>  
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>
>>    
>
>  


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


Re: DWR: error in convert from java object to javascript.

by czyjava :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

it works as expected, because it is a String.

But "var newSetting = {settingId: item.settingId}" in javascript, it will not work.

David Marginian-3 wrote:
Pretty simple:

{prop1: "prop1val", etc., etc.}





czyjava wrote:
> because it is an object, I don't know how to test it in the test page.
>
>
> David Marginian-3 wrote:
>  
>> Try calling the method from the DWR test page please.  You will need to
>> enable debug mode to do this.
>> http://directwebremoting.org/dwr/server/servlet/index.html
>>
>> czyjava wrote:
>>    
>>> another weird thing is
>>>
>>> var newSetting = {settingId: item.settingId};
>>> doesn't work. I have to manually conver it to a string, like
>>> var newSetting = {settingId: item.settingId+""};
>>>
>>> I am using Dojo, it is related to Dojo ?
>>>
>>> Thanks,
>>>
>>>
>>> David Marginian-3 wrote:
>>>  
>>>      
>>>> Send us your dwr.xml and the java method you are calling.
>>>>
>>>> On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@gmail.com> wrote:
>>>>
>>>>    
>>>>        
>>>>> Using DWR ajax, I can convert java object to javascript object, but I
>>>>> can't
>>>>> convert an object in javascript to a java object. [code] var setting =
>>>>> {id:
>>>>> item.Id, name: item.name, val:item.val}; //wrong, data is
>>>>> '[reference:c0-e2]' var setting = {id:'1200', name: 'name',
>>>>> val:'ssss'};
>>>>> //correct AjaxUtil.saveSetting(setting, {callback:function(data){
>>>>> alert("data is saved through DWR"); }}); [/code] the error message is
>>>>> DEBUG
>>>>> [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:
>>>>> c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6],
>>>>> c0-e1=Array:[reference:c0-e2], c0-e2=string:1000,
>>>>> c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO
>>>>> [org.directwebremoting.impl.DefaultRemoter 51] - Exec:
>>>>> AjaxUtil.saveSetting() DEBUG [org.directwebremoting.impl.DefaultRemoter
>>>>> 43]
>>>>> - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save
>>>>> setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I have
>>>>> defined in the dwr.xml Do I miss some something ? Thank.
>>>>> ------------------------------
>>>>> View this message in context: DWR: error in convert from java object to
>>>>> javascript.<http://www.nabble.com/DWR%3A-error-in-convert-from-java-object-to-javascript.-tp24330468p24330468.html>
>>>>> Sent from the DWR - Users mailing list
>>>>> archive<http://www.nabble.com/DWR---Users-f13934.html>at Nabble.com.
>>>>>
>>>>>      
>>>>>          
>>>>    
>>>>        
>>>  
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
>> For additional commands, e-mail: users-help@dwr.dev.java.net
>>
>>
>>
>>    
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
For additional commands, e-mail: users-help@dwr.dev.java.net

Re: DWR: error in convert from java object to javascript.

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Regardless, the JavaScript object created is passed to the server as a
string and DWR parses and serializes that string into your Java object
(whether it is a string on the test page or a JavaScript object).

I am not sure exactly what is going on in your JavaScript but if you
build a JavaScript object that looks exactly like what you passed in on
the test page:
var newSetting = {prop1: "prop1val", etc., etc.};

everything will work, I can assure you.

I recommend using Firebug and inspecting the JavaScript object you are
passing to your remote method.  Something is not right with the way you
are building the JavaScript object.


czyjava wrote:

> it works as expected, because it is a String.
>
> But "var newSetting = {settingId: item.settingId}" in javascript, it will
> not work.
>
>
> David Marginian-3 wrote:
>  
>> Pretty simple:
>>
>> {prop1: "prop1val", etc., etc.}
>>
>>
>>
>>
>>
>> czyjava wrote:
>>    
>>> because it is an object, I don't know how to test it in the test page.
>>>
>>>
>>> David Marginian-3 wrote:
>>>  
>>>      
>>>> Try calling the method from the DWR test page please.  You will need to
>>>> enable debug mode to do this.
>>>> http://directwebremoting.org/dwr/server/servlet/index.html
>>>>
>>>> czyjava wrote:
>>>>    
>>>>        
>>>>> another weird thing is
>>>>>
>>>>> var newSetting = {settingId: item.settingId};
>>>>> doesn't work. I have to manually conver it to a string, like
>>>>> var newSetting = {settingId: item.settingId+""};
>>>>>
>>>>> I am using Dojo, it is related to Dojo ?
>>>>>
>>>>> Thanks,
>>>>>
>>>>>
>>>>> David Marginian-3 wrote:
>>>>>  
>>>>>      
>>>>>          
>>>>>> Send us your dwr.xml and the java method you are calling.
>>>>>>
>>>>>> On Fri, Jul 3, 2009 at 9:25 PM, czyjava <czy11421@...> wrote:
>>>>>>
>>>>>>    
>>>>>>        
>>>>>>            
>>>>>>> Using DWR ajax, I can convert java object to javascript object, but I
>>>>>>> can't
>>>>>>> convert an object in javascript to a java object. [code] var setting
>>>>>>> =
>>>>>>> {id:
>>>>>>> item.Id, name: item.name, val:item.val}; //wrong, data is
>>>>>>> '[reference:c0-e2]' var setting = {id:'1200', name: 'name',
>>>>>>> val:'ssss'};
>>>>>>> //correct AjaxUtil.saveSetting(setting, {callback:function(data){
>>>>>>> alert("data is saved through DWR"); }}); [/code] the error message is
>>>>>>> DEBUG
>>>>>>> [org.directwebremoting.dwrp.BaseCallMarshaller 43] - Environment:
>>>>>>> c0-e6=string:12ssd, c0-e5=Array:[reference:c0-e6],
>>>>>>> c0-e1=Array:[reference:c0-e2], c0-e2=string:1000,
>>>>>>> c0-e3=Array:[reference:c0-e4], c0-e4=string:ddd, INFO
>>>>>>> [org.directwebremoting.impl.DefaultRemoter 51] - Exec:
>>>>>>> AjaxUtil.saveSetting() DEBUG
>>>>>>> [org.directwebremoting.impl.DefaultRemoter
>>>>>>> 43]
>>>>>>> - --Object found in session. id=0 DEBUG [com.util.AjaxUtil 24] - save
>>>>>>> setting:[reference:c0-e2]--[reference:c0-e4]--[reference:c0-e6] I
>>>>>>> have
>>>>>>> defined in the dwr.xml Do I miss some something ? Thank.
>>>>>>> ------------------------------
>>>>>>> View this message in context: DWR: error in convert from java object
>>>>>>> to
>>>>>>> javascript.<http://www.nabble.com/DWR%3A-error-in-convert-from-java-object-to-javascript.-tp24330468p24330468.html>
>>>>>>> Sent from the DWR - Users mailing list
>>>>>>> archive<http://www.nabble.com/DWR---Users-f13934.html>at Nabble.com.
>>>>>>>
>>>>>>>      
>>>>>>>          
>>>>>>>              
>>>>>>    
>>>>>>        
>>>>>>            
>>>>>  
>>>>>      
>>>>>          
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>> For additional commands, e-mail: users-help@...
>>>>
>>>>
>>>>
>>>>    
>>>>        
>>>  
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>
>>    
>
>  


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