Link to home
Start Free TrialLog in
Avatar of letsbedecent
letsbedecent

asked on

struts html:button issue

Hello,

   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"

thanks
Avatar of fargo
fargo

>>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.
ASKER CERTIFIED SOLUTION
Avatar of radarsh
radarsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Siva Prasanna Kumar
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!

________
radarsh
I will show the point if the author responds.

:-)

Ok radarsh won't that make any difference explain?????
Avatar of letsbedecent

ASKER

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)