• 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

problem with nested:image tag

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Anirban Das
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic