File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes problem with nested:image tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with nested:image tag" Watch "problem with nested:image tag" New topic
Author

problem with nested:image tag

Anirban Das
Ranch Hand

Joined: Nov 22, 2003
Posts: 63
Hi,
Iam using Struts 1.3.8. Basicaly Iam using a <nested:image> tag.


Iam trying to retrive the value of the attribute "value".

To do so Iam using

request.getParameter("oderByAsc")

Unforutnately I unable to retrive any value. Can someone please help me ?

Thanks for your help in advance.

Cheers
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Anirban Das
Ranch Hand

Joined: Nov 22, 2003
Posts: 63
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 ?


A small code example would be realy helpful.

Thank you once again.

Cheers
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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 ?

That's exactly what I'm suggesting. Example:

In your actionClass:

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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:

Anirban Das
Ranch Hand

Joined: Nov 22, 2003
Posts: 63
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with nested:image tag