File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

managing select tags in struts-2...

 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 select tags one below the other in my UI.

In the first select ,I have objects called 'concepts' which are like c1,c2,c3...

and each concept has a set of attributes like a1,a2,a3... concept and attribute are two beans!

Ex: if c1 has attributes a1,a2,a3 and you say concept.getAttributeList() one would get all the attributes for that concept...

Initially the concept-select is enabled and attribute-select is disabled!

I am populating concepts using s:iterator...

So,when a user selects a concept,the concept-select is disabled and attribute-select should be enabled with the attributes of that concept populated in the select tag!

Now,when i select a concept,how to get and populate attribute values?

I need to communicate with action class,isn't it? (I feel Ajax is not recommended to send the selected value to action class and set then back )

what should be the right approach?? By the way,I am using (html select+s:iterator)

 
Arun Ak
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<s:select list="listofconcept"
listKey="xx"
listValue="yy"
name="conceptId"
onchange="onChange()"
key="gb.admin.document.manager.permission.documentrepositorylabel"
labelposition="top"
/>
<s:select list="attributeList"
listKey="attId"
listValue="attName"
name="attribute"
onchange="onChange()"
key="gb.admin.document.manager.documentgroup.label"
labelposition="top"
/>

<script>
function onChange(){
document.myform.submit();
}
</script>

on selecting the concept submit the form and get attribute of concept and create attribute select.

Regards,
Arun
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on selecting the concept submit the form and get attribute of concept and create attribute select.


I didn't get this... can you please elaborate ,if possible in coding terms?

yes I submit the form but I want clarity in flow.i don't want to adjust the functionality and do something there!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic