Link to home
Start Free TrialLog in
Avatar of letsbedecent
letsbedecent

asked on

struts bean tag with javascript.

Hi ,

 I am using html:button onclick="javascript:editCitizen('<bean:write name="issueVO" property="citizen.id"/>')" value="Edit Citizen"

 to pass the value of id variable in citizen object (which is a variable in issueVO).

 The compiler complains that it is expecting an "equal symbol" !!!

 Where does it require that ???

  And When i use

             <a href="javascript:editCitizen('<bean:write name="issueVO" property="citizen.id"/>')">Edit Citizen</a>

It works....

explanation please !!

javascript function is as follows :

function editCitizen(id)
      {
      
            var theForm = document.citizenForm;
            theForm.id.value = id;
            theForm.submit();
      
      }
Avatar of Mick Barry
Mick Barry
Flag of Australia image

try:

<a href="javascript:editCitizen('<bean:write name=\"issueVO\" property=\"citizen.id\"/>')">Edit Citizen</a>
Avatar of letsbedecent
letsbedecent

ASKER

you got it wrong..... the  
<a href="javascript:editCitizen('<bean:write name="issueVO" property="citizen.id"/>')">Edit Citizen</a>
WORKS FINE.

Its the button part thats not working !!
sorry, misread your q
Hi,

Can you post your entire <html:button .... /> ?

Regards
Dave
Hi,

As it is compiler problem, it means that your JavaScript is okay. The only problem is on your JSP.

Regards
Dave
<html:button onclick="javascript:editCitizen('<bean:write name="issueVO" property="citizen.id"/>')" value="Edit Citizen"\>
Hi,

<html:button onclick="javascript:editCitizen('<bean:write name="issueVO" property="citizen.id"/>')" value="Edit Citizen"\>

should be

<html:button onclick="javascript:editCitizen('<bean:write name="issueVO" property="citizen.id"/>')" value="Edit Citizen" />

is it a typo or not :) ?

Regards
Dave
Did you try:
<html:button onclick="javascript:editCitizen('<bean:write name=\"issueVO\" property=\"citizen.id\"/>')"  ..
Mmm...aozarov,

Just curious, what is the difference between
<bean:write name=\"issueVO\" property=\"citizen.id\"/>
and
<bean:write name="issueVO" property="citizen.id"/>

I just never use it before and I hope you don't mind to answer :).

Regards
Dave
> The compiler complains that it is expecting an "equal symbol" !!!

Can u post the complete error details
SOLUTION
Avatar of aozarov
aozarov

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
ASKER CERTIFIED SOLUTION
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
>>Just try aozarov's suggestion to use plain HTML.
That should work, but it wasn't my suggestion :-)
I suggested to escape the inners quotes.
Then...

>>"That should work, but it wasn't my suggestion :-)"
Please try my suggestion hahaha :). This forum is fun :).

Regards
Dave