struts html:button issue


   i have a <html:button property="action" .... /> , now if i change the name from "action" to "myaction" , it doesnt work,

  it says "object doesnt support property or method" (  i have an onclick method calling a javascript, that simply checks for a condition and submits the form)

any insight on why its not taking the name "myaction" and only "action"

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>now if i change the name from "action" to "myaction" , it doesnt work,
what doesn't work? the javascript function with onclick? please post ur javascript code then.
This is beause you defined default java bean in your page which has methods getAction() setAction(String).
Make Methods of your form getMyaction() and setMyaction(String) and it should work.
Or another solution is to supply another java bean to your button like:

<html:button name="anotherbean" property="action" .... />

But you should define your bean before using anotherbean.
borislavmarkov, your argument is true for any other html components such as text or
check box (input components) but not true for a button. The property can be *anything*
for a button. Even an empty one like property="" will work. But, the property itself
is mandatory.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
letsbedecent is there any property or variable named "action" in your Form Bean.???
>> letsbedecent is there any property or variable named "action" in your Form Bean.???

This is pointless as it won't make any difference!

Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
I will show the point if the author responds.


Ok radarsh won't that make any difference explain?????
letsbedecentAuthor Commented:
actually radarsh is correct i guess., because there is no such property called "action" anywhere in the form. If there was, there is no reason for this confusion.

But my question to radarsh would then be , why is "myAction" not working ??

But then i found the answer to this question, because there was actually another button with this property = "myAction". When i changed it to any other name property="abcd" or property="shivaspk" it worked fine.

So, i guess radarsh is correct. Property is just mandator, doesnt matter what u put there, in case of html:button only.

I would like to know where radarsh got this info concretely documented. Because i had to do trial-and-error to come to a conclusion. I could not find in any struts document that html:button can have even a blank property attribute !

Thanks all. (Sorry for the delay in responding !! was enjoying my weekend :p)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.