aspose file tools*
The moose likes Struts and the fly likes Struts2 - Select - Ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 - Select - Ajax" Watch "Struts2 - Select - Ajax" New topic
Author

Struts2 - Select - Ajax

Vamshi Jampala
Ranch Hand

Joined: Feb 23, 2008
Posts: 40
I have a div which should update it self when the selected field is changed


Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

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


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Vamshi Jampala
Ranch Hand

Joined: Feb 23, 2008
Posts: 40
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 ?


[Download category.bmp] Download

Vamshi Jampala
Ranch Hand

Joined: Feb 23, 2008
Posts: 40
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

Joined: Aug 03, 2008
Posts: 9303
    
  17

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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 - Select - Ajax