this is struts 1.3.9 not 2.x, it can be done over json plugin for struts 2.x,
or can it?

jmitchell wrote:
> 
> Take a look at this page:
>  http://cwiki.apache.org/S2PLUGINS/json-plugin.html
> 
> (Specifically "Root Object")
> 
> It should match your result type name
> 
> 
> 
> On Jan 22, 2008 4:09 PM, auz <[EMAIL PROTECTED]> wrote:
>>
>> i have a problem with struts action form execute and json. im using ext
>> js as
>> mu ajax lib on client side and i need to retrive some departmentID and
>> name
>> depenting on a combo box, the problem is i dont know how to put JSonObect
>> so
>> that ext can see it here's my code any help is apritiated
>>
>> on jsp page - this is ext js script
>>
>> var departmentStore = new Ext.data.Store({
>>  reader: new Ext.data.JsonReader({
>>  totalProperty: 'total',
>>  root:'list'
>>  }, [{name: 'name'}])
>> })
>>
>> var departmentCombo = new Ext.form.ComboBox({
>>  store:departmentStore,
>>  displayField:'name',
>>  valueField: 'name',
>>  hiddenName : 'city',
>>  typeAhead: true,
>>  mode: 'local',
>>  triggerAction: 'all',
>>  width:150,
>>  emptyText:'select a city',
>>  applyTo:'department',
>>  selectOnFocus:true
>>  });
>>
>> studyProgramCombo.on('select', function () {
>>  departmentCombo.reset();
>>  departmentCombo.store.proxy= new
>> Ext.data.HttpProxy({disableCaching:false,url: selfURI +
>> 'JSONGetDepartment?studyProgram.json={"studyProgram":{"studyProgramID":'
>> +
>> studyProgramCombo.getValue() + '}}'});
>>  searchCityCombo.store.load();
>> });
>>
>> //the rest of the jsp code is irelevant NOTE selfURI variable is set to
>> http://SERVERADDRESS/PROJECTNAME/
>>
>> Struts Action execute code
>>
>> JSONArray list = new JSONArray();
>> JSONObject obj = new JSONObject();
>> while(result.next()) {
>>     obj.put("uid", result.getInt("departmentID"));
>>     obj.put("name", result.getString("name"));
>>     list.put(obj);
>> }
>> JSONObject rslt = new JSONObject();
>> rslt.put ("total", list.length());
>> rslt.put("list", list);
>> request.setAttribute("", rslt.toString()); //this name is unknown, i dont
>> know what to put here
>> return null;
>>
>>
>> what did i do wrong/ didnt do? tnx a lot
>> --
>> View this message in context:
>> http://www.nabble.com/-S1--json-and-Action-execute%28%29-tp15028395p15028395.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> 
> -- 
> James Mitchell
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S1--json-and-Action-execute%28%29-tp15028395p15028765.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to