?
Solved

Struts bean tag with javascript.

Posted on 2005-05-03
2
Medium Priority
?
8,040 Views
Last Modified: 2012-08-13
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();
     
     }
0
Comment
Question by:letsbedecent
2 Comments
 
LVL 23

Assisted Solution

by:Saqib Khan
Saqib Khan earned 1000 total points
ID: 13923799
> onclick="javascript:editCitizen('<bean:write name="issueVO" property="citizen.id"/>')" value="Edit Citizen"

Post the Complete Line, how do you have your button build.

and by the way when you use onclick event, using of javaScript keyword is not necessary. you can just do

<input type="button" onClick="editCitizen('<bean:write name="issueVO" property="citizen.id"/>');return false" value="Button">
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 1000 total points
ID: 13924672
How about something like
<c:set var="citizen">${issueVO["citizen.id"]}</c:set>

 html:button onclick="editCitizen('${citizen}')" value="Edit Citizen"

I never use html:button so I am not sure of the  ${} syntax in there.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question