You have to handle an <html:image> tag differently than you would an <html:submit> tag because of the fact that it's an image rather than a button.
My suggestion is to declare the property oderByAsc as type org.apache.struts.util.ImageButtonBean. You can then tell whether the button has been clicked by calling the bean's isSelected() method.
Merill, Thanks for your response. But Iam still a bit confused.
My requirement is to have multiple images with same property. However they should be sending different values at run time when the respective image is clicked.
Is it possible ? If so how I will retrive the values of the image that got submited.
Are you suggesting that I create multiple properties for each of those images and retrive it in my action class to perform required action ?
Originally posted by Anirban Das: My requirement is to have multiple images with same property. However they should be sending different values at run time when the respective image is clicked.
Is it possible ? If so how I will retrive the values of the image that got submited.
I'm not sure if it's possible or not. If it is, I don't know of a way to make it work that way.
Originally posted by Anirban Das: Are you suggesting that I create multiple properties for each of those images and retrive it in my action class to perform required action ?
Since my last post, I did think of a way to do it with a single property with a different value for each button. You could declare a hidden field for the property and use the onclick event for each button to execute javaScript to set the property to a particular value. Example:
Thank you Merill. Well actualy I implemented the second way most of the places. It works fine. I was wondering if there is a struts way of handling this issue and hence I posted that question. You showed me a way using the framework. I would try to implement the same.
Thanks once again.
machines help you to do more, but experience less. Experience this tiny ad:
a bit of art, as a gift, the permaculture playing cards