• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2 - Select - Ajax

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a div which should update it self when the selected field is changed


 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vamshi Jampala wrote:


Its better generally if you explain your problem a little more clearly than using emoticons which don't fit the situation.

I neeeed categoryIdentifier value passed in to the action as category


I can't understand what you mean by this. Right now all that I can see is that you are generating multiple select boxes which have 4 elements each and have a different name. Now do you want to update the value of the div to the selected element in the select box?? There are multiple select boxes so whose value do you want to set to the div?? I can't see your s:iterator tag ending, where does it end?? If it ends after the div tag, then you'll have multiple divs with the same id, so you can't operate on them using javascript. And what about the s:url tag that you've used. Do you want to update its value to?? The s:url and s:param tag will be evaluated on the server side, so changing the value of the select box won't change the value of the s:param tag. Also you can use the var attribute to simplify your select tag. Right now it looks like
but you can use the var attribute of the s:iterator tag as
 
Vamshi Jampala
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be i am doing it the wrong way, all i need is

Based on the selection of a drop down the number of iterations are decided. How can I achive that ? Any Thoughts ?
Filename: category.bmp
File size: 468 Kbytes
 
Vamshi Jampala
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankit Garg wrote:

Vamshi Jampala wrote:


Its better generally if you explain your problem a little more clearly than using emoticons which don't fit the situation.

I neeeed categoryIdentifier value passed in to the action as category


I can't understand what you mean by this. Right now all that I can see is that you are generating multiple select boxes which have 4 elements each and have a different name. Now do you want to update the value of the div to the selected element in the select box?? There are multiple select boxes so whose value do you want to set to the div?? I can't see your s:iterator tag ending, where does it end?? If it ends after the div tag, then you'll have multiple divs with the same id, so you can't operate on them using javascript. And what about the s:url tag that you've used. Do you want to update its value to?? The s:url and s:param tag will be evaluated on the server side, so changing the value of the select box won't change the value of the s:param tag. Also you can use the var attribute to simplify your select tag. Right now it looks like
but you can use the var attribute of the s:iterator tag as



1)Yes,
2) the iterator tag is ending after div
3) The answer as in how can i tranfer the value of category , Use formId="form" so all the form values will be available for the action class.
4)No, i dont want to update the url

Will make sure that i use var instead of the whole path.

I think I am doing it in a complicated way, do you know any easy way of doing this ?

Thanks for your time and interest.
 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have no idea what you are trying to say. Your screenshot shows three rows with three combo boxes in each row and a button. But your code doesn't reflect that.

Based on the selection of a drop down the number of iterations are decided. How can I achive that ? Any Thoughts ?


The s:iterator tag is executed when the JSP is rendered. So you can't change the number of iterations in the browser with it. If you want to dynamically add/remove rows in your page based on the selection of the drop down, then use javascript.

3) The answer as in how can i tranfer the value of category , Use formId="form" so all the form values will be available for the action class.


I can't understand what this line means. Can you specify a little more clearly what you are trying to do with your code...
 
reply
    Bookmark Topic Watch Topic
  • New Topic