IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

[dwr] utilisation des methodes java


Sujet :

JavaScript

  1. #1
    Nouveau candidat au Club
    Profil pro
    Inscrit en
    Août 2009
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Août 2009
    Messages : 2
    Par défaut [dwr] utilisation des methodes java
    Bonjour,

    je travaille actuellement sur une appli java utilisant Spring et DWR.

    L'intégration de dwr est fonctionnelle car le debugger dwr m'affiche bien ma classe et les méthodes fonctionnent correctement.

    Cependant lorsque j'essaye d'utiliser ma classe dans le javascript en affectant à une variable le retour d'une méthode, j'obtiens comme résultat : undefined.

    J'ai pourtant inclus les fichiers indiquer par dwr.

    Voila un exemple d'appel d'une méthode qui fonctionne dans le debugger dwr mais pas dans mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    var ids=updater.getIds();
    updater étant l'objet me premettant d'utiliser mes methodes java.

    Merci pour votre aide.

  2. #2
    Expert éminent

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Par défaut
    Bonjour,
    Citation Envoyé par kraten Voir le message
    L'intégration de dwr est fonctionnelle car le debugger dwr m'affiche bien ma classe et les méthodes fonctionnent correctement.
    Que DWR sache interpréter le code qu'il a généré est une chose.
    Que ce code soit valide pour un (vrai) navigateur en est une autre

    Peux-tu nous montrer ce code généré (récupéré à partir du nav, pas de DWR) ?
    Il faudrait le code de la fonction updater.getIds(); ainsi que celui de la fonction à partir de laquelle elle est appelée, et enfin les parties HTML concernées ...

    A+

  3. #3
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Billets dans le blog
    20
    Par défaut
    Essaye comme ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    var ids=document.JavaApplet.updater.getIds();
    Pas de question technique par MP !
    Tout le monde peut participer à developpez.com, vous avez une idée, contactez-moi !
    Mes formations video2brain : La formation complète sur JavaScriptJavaScript et le DOM par la pratiquePHP 5 et MySQL : les fondamentaux
    Mon livre sur jQuery
    Module Firefox / Chrome d'intégration de JSFiddle et CodePen sur le forum

  4. #4
    Nouveau candidat au Club
    Profil pro
    Inscrit en
    Août 2009
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Août 2009
    Messages : 2
    Par défaut
    Tout 'abord, merci d'avoir répondu aussi vite

    la fonction getIds() ne fait que récuperé une liste d'objet :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     public static List<Integer> getIds() {
            return ids;
        }
    le code de la fonction ou elle est appellée :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
     
    function Maj() {
     
        var brandName=dwr.util.getValue("manufacturier");
        updater.setAttributes(brandName,updateSelect());
        //permet de mettre a jour les ids de "updater" 
     
    }
    function updateSelect(){
        var selectPattern =document.getElementById("pattern");
        for (var i=0; i < selectPattern.length-1; i++){
            selectPattern.options[i]=null;
            i--; 
        }
        var ids=updater.getIds();
        alert("getIds   "+ids);//c'est ici que j'ai le undefined
    ...
     
        }
    }
    la page HTML concernée :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
     
    <head>
    <title>Recherche</title>
    </head>
    <script type='text/javascript' src='/monAppli/dwr/interface/updater.js'></script>
    <script type='text/javascript' src='/monAppli/dwr/engine.js'></script>
    <script type='text/javascript' src='/monAppli/dwr/util.js'></script>
    <script type="text/javascript" src='js/update.js'></script>
     
     
     
    <body >
     
     
        <h2>Recherche </h2>
     
     
        <form name="logForm" method="post" action="search.html" >
     
            <table border="0">
     
                <tbody>
                    <tr>
                        <td> Manufacturier : </td>
                        <td><select name="manufacturier"  id="manufacturier" onchange="javascript:Maj()">
                                <option value="none">---</option>
                                <c:forEach var="brand" items="${brands}" >
                                    <option>${brand}</option>
                                </c:forEach>
                            </select></td>
                        <td> Pays :<select name="pays" >
     
                                <c:forEach var="pays" items="${countries}" >
                                    <option>${pays}</option>
                                </c:forEach>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>de
                            <input type="text" name="beginning" value="2008" size="4" maxlength="4"/>
                            a: <input type="text" name="end" value="2008" size="4" maxlength="4"/></td>
                    </tr>
                    <tr>
                        <td>Pattern :</td>
                        <td><select name="pattern" id="pattern" disabled="disabled">
                                 <option></option>
                            </select>
                        </td>
     
                    </tr>

    Concernant le code dwr voici celui de la page du debugger :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    <html>
    <head>
      <title>DWR Test</title>
      <!-- These paths use .. so that they still work behind a path mapping proxy. The fully qualified version is more cut and paste friendly. -->
      <script type='text/javascript' src='../interface/updater.js'></script>
      <script type='text/javascript' src='../engine.js'></script>
      <script type='text/javascript' src='../util.js'></script>
      <script type='text/javascript'>
      function objectEval(text)
      {
        // eval() breaks when we use it to get an object using the { a:42, b:'x' }
        // syntax because it thinks that { and } surround a block and not an object
        // So we wrap it in an array and extract the first element to get around
        // this.
        // This code is only needed for interpreting the parameter input fields,
        // so you can ignore this for normal use.
        // The regex = [start of line][whitespace]{[stuff]}[whitespace][end of line]
        text = text.replace(/\n/g, ' ');
        text = text.replace(/\r/g, ' ');
        if (text.match(/^\s*\{.*\}\s*$/))
        {
          text = '[' + text + '][0]';
        }
        return eval(text);
      }
      </script>
     
      <style>
        input.itext { font-size: smaller; background: #E4E4E4; border: 0; }
        input.ibutton { font-size: xx-small; border: 1px outset; margin: 0px; padding: 0px; }
        span.reply { background: #ffffdd; white-space: pre; }
        span.warning { font-size: smaller; color: red; }
      </style>
    </head>
    <body onload='dwr.util.useLoadingMessage()'>
    <h2>Methods For: updater (recherche.UpdateDwr)</h2>
    <p>To use this class in your javascript you will need the following script includes:</p>
    <pre>
      &lt;script type='text/javascript' src='<a href='/BFinterface/dwr/interface/updater.js'>/BFinterface/dwr/interface/updater.js</a>'&gt;&lt;/script&gt;
      &lt;script type='text/javascript' src='<a href='/BFinterface/dwr/engine.js'>/BFinterface/dwr/engine.js</a>'&gt;&lt;/script&gt;
     
    </pre>
    <p>In addition there is an optional utility script:</p>
    <pre>
      &lt;script type='text/javascript' src='<a href='/BFinterface/dwr/util.js'>/BFinterface/dwr/util.js</a>'&gt;&lt;/script&gt;
    </pre>
    <p>Replies from DWR are shown with a yellow background if they are simple or in an alert box otherwise.<br/>
    The inputs are evaluated as Javascript so strings must be quoted before execution.</p>
    <li>
      setAttributes(    <input class='itext' type='text' size='10' value='""' id='p00' title='Will be converted to: java.lang.String'/>, 
    AUTO  );
      <input class='ibutton' type='button' onclick='updater.setAttributes(objectEval($("p00").value), reply0);' value='Execute'  title='Calls updater.setAttributes(). View source for details.'/>
     
      <script type='text/javascript'>
        var reply0 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d0', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d0' class='reply'></span>
    </li>
    <li>
      getIds(AUTO  );
      <input class='ibutton' type='button' onclick='updater.getIds(reply1);' value='Execute'  title='Calls updater.getIds(). View source for details.'/>
      <script type='text/javascript'>
        var reply1 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d1', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d1' class='reply'></span>
    </li>
    <li>
     
      getNames(AUTO  );
      <input class='ibutton' type='button' onclick='updater.getNames(reply2);' value='Execute'  title='Calls updater.getNames(). View source for details.'/>
      <script type='text/javascript'>
        var reply2 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d2', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d2' class='reply'></span>
    </li>
    <li>
      setIds(    <input class='itext' type='text' size='10' value='[]' id='p30' title='Will be converted to: java.util.List'/>, 
    AUTO  );
      <input class='ibutton' type='button' onclick='updater.setIds(objectEval($("p30").value), reply3);' value='Execute'  title='Calls updater.setIds(). View source for details.'/>
      <script type='text/javascript'>
        var reply3 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d3', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
     
      <span id='d3' class='reply'></span>
    </li>
    <li>
      setNames(    <input class='itext' type='text' size='10' value='[]' id='p40' title='Will be converted to: java.util.List'/>, 
    AUTO  );
      <input class='ibutton' type='button' onclick='updater.setNames(objectEval($("p40").value), reply4);' value='Execute'  title='Calls updater.setNames(). View source for details.'/>
      <script type='text/javascript'>
        var reply4 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d4', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d4' class='reply'></span>
    </li>
    <li>
      getCurrentBrandName(AUTO  );
      <input class='ibutton' type='button' onclick='updater.getCurrentBrandName(reply5);' value='Execute'  title='Calls updater.getCurrentBrandName(). View source for details.'/>
     
      <script type='text/javascript'>
        var reply5 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d5', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d5' class='reply'></span>
    </li>
    <li>
      setCurrentBrandName(    <input class='itext' type='text' size='10' value='""' id='p60' title='Will be converted to: java.lang.String'/>, 
    AUTO  );
      <input class='ibutton' type='button' onclick='updater.setCurrentBrandName(objectEval($("p60").value), reply6);' value='Execute'  title='Calls updater.setCurrentBrandName(). View source for details.'/>
      <script type='text/javascript'>
        var reply6 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d6', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d6' class='reply'></span>
    </li>
     
    <li>
      hashCode(  );
      <input class='ibutton' type='button' onclick='updater.hashCode(reply7);' value='Execute'  title='Calls updater.hashCode(). View source for details.'/>
      <script type='text/javascript'>
        var reply7 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d7', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d7' class='reply'></span>
    <br/><span class='warning'>(Warning: hashCode() is excluded: Methods defined in java.lang.Object are not accessible. See <a href='#excludedMethod'>below</a>)</span>
    </li>
    <li>
      getClass(  );
      <input class='ibutton' type='button' onclick='updater.getClass(reply8);' value='Execute'  title='Calls updater.getClass(). View source for details.'/>
     
      <script type='text/javascript'>
        var reply8 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d8', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d8' class='reply'></span>
    <br/><span class='warning'>(Warning: No Converter for java.lang.Class. See <a href='#missingConverter'>below</a>)</span>
    <br/><span class='warning'>(Warning: getClass() is excluded: Methods defined in java.lang.Object are not accessible. See <a href='#excludedMethod'>below</a>)</span>
    </li>
    <li>
      equals(    <input class='itext' type='text' size='10' value='' id='p90' title='Will be converted to: java.lang.Object'/>  );
      <input class='ibutton' type='button' onclick='updater.equals(objectEval($("p90").value), reply9);' value='Execute'  title='Calls updater.equals(). View source for details.'/>
     
      <script type='text/javascript'>
        var reply9 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d9', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d9' class='reply'></span>
    <br/><span class='warning'>(Warning: No Converter for java.lang.Object. See <a href='#missingConverter'>below</a>)</span>
    <br/><span class='warning'>(Warning: equals() is excluded: Methods defined in java.lang.Object are not accessible. See <a href='#excludedMethod'>below</a>)</span>
    </li>
    <li>
      toString(  );
      <input class='ibutton' type='button' onclick='updater.toString(reply10);' value='Execute'  title='Calls updater.toString(). View source for details.'/>
     
      <script type='text/javascript'>
        var reply10 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d10', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d10' class='reply'></span>
    <br/><span class='warning'>(Warning: toString() is excluded: Methods defined in java.lang.Object are not accessible. See <a href='#excludedMethod'>below</a>)</span>
    </li>
    <li>
      wait(    <input class='itext' type='text' size='10' value='0' id='p110' title='Will be converted to: long'/>, 
        <input class='itext' type='text' size='10' value='0' id='p111' title='Will be converted to: int'/>  );
      <input class='ibutton' type='button' onclick='updater.wait(objectEval($("p110").value), objectEval($("p111").value), reply11);' value='Execute'  title='Calls updater.wait(). View source for details.'/>
     
      <script type='text/javascript'>
        var reply11 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d11', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d11' class='reply'></span>
    <br/><span class='warning'>(Warning: overloaded methods are not recommended. See <a href='#overloadedMethod'>below</a>)</span>
    <br/><span class='warning'>(Warning: wait() is excluded: Methods defined in java.lang.Object are not accessible. See <a href='#excludedMethod'>below</a>)</span>
    </li>
    <li>
      wait(    <input class='itext' type='text' size='10' value='0' id='p120' title='Will be converted to: long'/>  );
      <input class='ibutton' type='button' onclick='updater.wait(objectEval($("p120").value), reply12);' value='Execute'  title='Calls updater.wait(). View source for details.'/>
     
      <script type='text/javascript'>
        var reply12 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d12', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d12' class='reply'></span>
    <br/><span class='warning'>(Warning: overloaded methods are not recommended. See <a href='#overloadedMethod'>below</a>)</span>
    <br/><span class='warning'>(Warning: wait() is excluded: Methods defined in java.lang.Object are not accessible. See <a href='#excludedMethod'>below</a>)</span>
    </li>
    <li>
      wait(  );
      <input class='ibutton' type='button' onclick='updater.wait(reply13);' value='Execute'  title='Calls updater.wait(). View source for details.'/>
     
      <script type='text/javascript'>
        var reply13 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d13', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d13' class='reply'></span>
    <br/><span class='warning'>(Warning: overloaded methods are not recommended. See <a href='#overloadedMethod'>below</a>)</span>
    <br/><span class='warning'>(Warning: wait() is excluded: Methods defined in java.lang.Object are not accessible. See <a href='#excludedMethod'>below</a>)</span>
    </li>
    <li>
      notify(  );
      <input class='ibutton' type='button' onclick='updater.notify(reply14);' value='Execute'  title='Calls updater.notify(). View source for details.'/>
     
      <script type='text/javascript'>
        var reply14 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d14', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
      <span id='d14' class='reply'></span>
    <br/><span class='warning'>(Warning: notify() is excluded: Methods defined in java.lang.Object are not accessible. See <a href='#excludedMethod'>below</a>)</span>
    </li>
    <li>
      notifyAll(  );
      <input class='ibutton' type='button' onclick='updater.notifyAll(reply15);' value='Execute'  title='Calls updater.notifyAll(). View source for details.'/>
      <script type='text/javascript'>
        var reply15 = function(data)
        {
          if (data != null && typeof data == 'object') alert(dwr.util.toDescriptiveString(data, 2));
          else dwr.util.setValue('d15', dwr.util.toDescriptiveString(data, 1));
        }
      </script>
     
      <span id='d15' class='reply'></span>
    <br/><span class='warning'>(Warning: notifyAll() is excluded: Methods defined in java.lang.Object are not accessible. See <a href='#excludedMethod'>below</a>)</span>
    </li>
    </ul>
    <h2>Other Links</h2>
    <ul>
    <li>Back to <a href='/BFinterface/dwr/'>class index</a>.</li>
    </ul>
    <div>
     
    <h2>Fixing Issues</h2>
     
    <h3><a name="missingConverter">Warning: No Converter for XXX.</a></h3>
    <p>
      dwr.xml does not have an allow entry that enables conversion of this type to
      Javascript. The most common cause of this problem is that XXX is a java bean
      and bean marshalling has not been enabled. Bean marshalling is disabled by
      default for security reasons.
    </p>
    <p>
      To enable marshalling for a given bean add the following line to the allow
      section of your dwr.xml file:
    </p>
    <pre>
    &lt;convert converter="bean" match="XXX"/&gt;
     
    </pre>
    <p>
      It is also possible to enable marshalling for an entire package or hierachy
      of packages using the following:
    </p>
    <pre>
    &lt;convert converter="bean" match="package.name.*"/&gt;
    </pre>
     
    <h3><a name="overloadedMethod">Warning: overloaded methods are not recommended</a></h3>
    <p>
      Javascript does not support overloaded methods, so the javascript file
      generated from this class will contain two methods the second of which will
      replace the first. This is probably not what you wanted.
    </p>
    <p>
     
      It is best to avoid overloaded methods when using DWR.
    </p>
     
    <h3><a name="excludedMethod">Warning: methodName() is excluded:</a></h3>
    <p>
      The methods may be excluded explicitly with an &lt;exclude&gt; element in
      dwr.xml or excluded implicitly by not being mentioned in an &lt;include&gt;
      element. Or the method may be defined in <code>java.lang.Object</code> -
      methods defined here may not be exported.
     
    </p>
    <p>
      If methods are excluded using &lt;include&gt; or &lt;exclude&gt; then no
      JavaScript proxy will be generated. To allow testing of methods that should
      not be accessible, add an init-param to WEB-INF/web.xml with the name/value
      allowImpossibleTests=true.
    </p>
     
    </div>
    </body></html>
    ps : j'ai essaye avec
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    var ids=document.JavaApplet.updater.getIds();
    mais je n'ai meme plus la popup qui s'affiche. (firebugg me dit que document.JavaApplet n'est pas defini )

  5. #5
    Membre Expert
    Inscrit en
    Septembre 2002
    Messages
    2 307
    Détails du profil
    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 307
    Par défaut
    Normal c'est de l'ajax et non de l' applet!

    http://baptiste-meurant.developpez.c...ing-hibernate/

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2008
    Messages : 73
    Par défaut
    Bonjour,

    Je déterre ce topic car je me trouve dans la même situation.

    Trois jours que je planche là-dessus (je "débute" en JavaScript et en Dwr)...

    Soit le code JavaScript suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    function checkUsername() {
    	  username = dwr.util.getValue("empUserName"); // identique à getElementById('empUserName')  
     
    	  Dwr.checkUsername(username, function(data) {
    	  	dwr.util.setValue("empUserName", data); // va modifier la valeur renseignée dans le input type text empUserName si celle-ci est différente de celle renseignée au moment de l'appel de la fonction (sur évènement onchange)
    	  });   
    }
    La méthode checkUsernane côté Java (au travers de ma classe Dwr) me renvoit une string ; côté client, le champ empUserName est ainsi dynamiquement modifié.

    Je voudrais donc récupérer la valeur de retour de cette méthode.

    Si je fais un getElementById('empUserName') après l'appel à la fonction, il me retourne invariablement la valeur initialement renseignée même si celle a donc été modifiée par la fonction...

    Merci pour votre aide.

  7. #7
    Membre actif
    Inscrit en
    Août 2010
    Messages
    78
    Détails du profil
    Informations forums :
    Inscription : Août 2010
    Messages : 78
    Par défaut
    Bonjour ,


    J'ai integré dwr avec spring...Par exemple j'ai mon dwr.xml qui contient le code suivant :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    <create creator="springé javascript="Atest">
    <param name="beanName" value="Atest"/>
    </create>
     
     
    <convert converter="bean" match="monpackage.*"/>

    Quant j'ouvre l'url "/monProjet/Atest.js " , je trouve les different.es methodes de ma classe monpackage.Atest qui s'executent sans probleme mais
    quand je veux utiliser mon bean Atest dans mon fichier .js ...ils me disent " Atest is undefined :s :s


    Qui peuuut m'aider

Discussions similaires

  1. [POO] utilisation des packages Java en javascript
    Par developppez dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 27/05/2008, 11h08
  2. Utilisation des methodes d'autres classes
    Par Viscapon dans le forum Langage
    Réponses: 3
    Dernier message: 10/05/2008, 22h53
  3. rapport d'analyse de performence des methodes java
    Par etoiliste dans le forum Jasper
    Réponses: 1
    Dernier message: 20/03/2008, 09h46
  4. comment utiliser des objets java avec ireport
    Par Invité dans le forum iReport
    Réponses: 0
    Dernier message: 28/07/2007, 23h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo