Note that there are some explanatory texts on larger screens.

plurals
  1. POReading parameters enterd on the screen
    primarykey
    data
    text
    <p>I have a page that accepts parameters from the user. I read this parameter in my action using params.playerId. and then do the computations with it.</p> <p>I have changed my UI now and am using extJS for display purposes. Therefore I have an edit and an editData action. editData action has the code to run the sql and execute the appropriate js file and displays edit.jsp. However, in the editData action, when I use params.playerId, I get a null value. </p> <p>What can be a work round for this scenario? </p> <p>My code before integrating with extJS: list action is called and list.gsp is displayed with data.</p> <p>def list = { </p> <p>def session = sessionFactory.getCurrentSession() def result = session.createSQLQuery("select player_id from w.music where player_id=(params.playerId)").list();<br> def tuneInstanceList = new ArrayList()<br> def tune = new Tune()<br> result.each<br> { tune.playerId = it<br> tune.playerPrice = "100" tuneInstanceList.add(tune)<br> } [recoveryInstanceList: recoveryInstanceList]<br> }<br> Now, when I ntegrate with extJS, I get the value of params.playerId as null. Code is below.</p> <p>list.gsp:</p> <p>&lt;%@ page import="tune.Music"%> </p> <pre><code> &lt;script type="text/javascript"&gt; var ds = new Ext.data.Store({ autoLoad: true, proxy: new Ext.data.HttpProxy({ url: 'http://localhost:8080/tune/music/listData'}), reader: new Ext.data.JsonReader({ results: 'total', root:'items', id:'id' }, [ {name: 'playerId'}, {name: 'playerPrice'} ] ) }); var cm = new Ext.grid.ColumnModel([ {header: "Player Id", width: 70, sortable:true, dataIndex: 'playerId'}, {header: "Player Price", width: 90, dataIndex: 'playerPrice'} ]); //cm.defaultSortable = true; // create the grid var grid = new Ext.grid.GridPanel({ ds: ds, cm: cm, renderTo:'grid-example', width:1300, height:300 }); &lt;/script&gt; </code></pre> <p> </p> <pre><code>&lt;div class="body"&gt; &lt;!--&lt;g:javascript library="examples"/&gt;--&gt; &lt;!-- EXAMPLES --&gt; &lt;h1&gt;Ext Grid&lt;/h1&gt; &lt;div id="grid-example"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p> </p> <p>My controller action:</p> <pre><code>def list={ } def listData = { def session = sessionFactory.getCurrentSession() def result = session.createSQLQuery("select player_id from w.music where player_id= (params.playerId)").list(); def tuneInstanceList = new ArrayList() result.each { def tune = new Tune() tune.playerId = it tune.playerPrice = "100" tuneInstanceList.add(tune) } def listResult = [total: tunInstanceList.size(), items: tunInstanceList] render listResult as JSON; </code></pre> <p>}</p> <p>How can I retrieve the parameters that have been entered by the user??</p> <p>Thanks! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload