Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 934
  • Last Modified:

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"

1 Solution
>>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.

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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)

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now