Closed GoogleCodeExporter closed 9 years ago
I've fixed some problems associated with this sample.
- I've updated the sample on the home page to include the 'elementId' attribute
on
the secondSelect (required to submit the firstSelect's value) and i've added the
'name' attribute to the first select (required to submit the name/value request
parameter for the first select).
-I've also updated the source and downloads (new version 1.0.3.1) to fix an
issue in
which the SelectTag was not rendering the elementId attribute properly although
I'm
not sure if that's what you were running into.
I'm can't find any issues with the json string filling the select boxes. are
you sure
you're retuning a proper json object string. I'm using the json result
available in
the struts2-json-plugin. My action config for the select box src actions looks
something like:
{{{
<action name="firstSelect" class="com.apposit.blank.control.SelectAction">
<result type="json" name="success">
<param name="root">firstSelectList</param>
</result>
<result type="httpheader" name="error">
<param name="error">500</param>
<param name="errorMessage">${message}</param>
</result>
</action>
<action name="secondSelect" class="com.apposit.blank.control.SelectAction" >
<result type="json" name="success">
<param name="root">secondSelectList</param>
</result>
<result type="httpheader" name="error">
<param name="error">500</param>
<param name="errorMessage">${message}</param>
</result>
</action>
}}}
For my tester sample, 'firstSelectList' and 'secondSelectList' are simple
List<Integer> fields of the SelectAction. The SelectAction action also declares
a
'firstSelect' with setter to receive the updated value of the first select field
(used to determine new list value for second select box).
The jsp page code looks like this:
<div>
First Select:<sj:select id="firstSelect" name="firstSelect"
onChangeTopics="firstSelectChanged" src="firstSelect.action"/>
</div>
<div>
Second Select:<sj:select id="secondSelect" reloadTopics="firstSelectChanged"
src="secondSelect.action" elementIds="firstSelect"/>
</div>
If you're still having problems perhaps you could send me some sample code or I
could
send you a simple sample I'm using...
Original comment by obinna@gmail.com
on 4 Aug 2009 at 10:30
Original comment by obinna@gmail.com
on 11 Aug 2009 at 7:53
where I can see some examples about how the action class firstSelect and
secondSelect
looks?
Original comment by mileid...@gmail.com
on 11 Aug 2009 at 11:50
[deleted comment]
Found the solution, here is the code:
public class SelectAction {
private Map<String, String> map = new HashMap<String, String>();
private String firstSelect;
public Map<String, String> getMap() {
return map;
}
public void setMap(Map<String, String> value){
map = value;
}
public void setFirstSelect(String firstSelect) {
this.firstSelect = firstSelect;
}
public String getFirstSelect(){
for (int i = 0; i < 10; i++) {
map.put(String.valueOf(i), String.valueOf(i));
}
return Action.SUCCESS;
}
public String getSecondSelect(){
for (int i = 0; i < 10; i++) {
map.put(String.valueOf(i), firstSelect + " - " + String.valueOf(i));
}
return Action.SUCCESS;
}
}
Original comment by mileid...@gmail.com
on 11 Aug 2009 at 3:12
Hi,
I have problems to adapt this sample to my code. Here is what I'd like to do :
http://groups.google.com/group/jquery-en/browse_thread/thread/1560b8227e55521e#
My struts.xml file doesn't accept this syntax :
<action name="firstSelect" class="com.apposit.blank.control.SelectAction">
<result type="json" name="success">
<param name="root">firstSelectList</param>
</result>
<result type="httpheader" name="error">
<param name="error">500</param>
<param name="errorMessage">${message}</param>
</result>
</action>
An idea on how to proceed ?
Original comment by sii.nben...@gmail.com
on 24 Sep 2009 at 9:03
Hi,
I have got somthing similar requirement. On a jsp i have search criteria and
one struts2 jquery grid to display search results.
1. On page load the grid fires call to one action automatically to load the
default result.
2. My query is when i click on search button the grid should get populated
according as per the search criteria.
would appreciate if some one can help in this, i heard some thing of
relaodTopics...
Original comment by mratyunj...@gmail.com
on 27 Oct 2010 at 2:09
Original issue reported on code.google.com by
andrew.b...@gmail.com
on 2 Aug 2009 at 3:30