Invoke Struts Action when a Popup Window
Hi,
I have a JSP page witha table on it. One of the columns has a HYPERLINK in each row. On clicking the HYPERLINK, a popup window should open and at the same time an action should be called, which takes an attribute passed from the hyperlink as parameter, to populate the popup window.
I have tried the code below, but it hasn't worked.
<html:form name="getUsersForm" action="getUsers.do" type="com.shardul.struts.form.GetUsersForm" method="post">
</html:form>
Also I am unable to figure out, how to pass a parameter to the getUsers Action.
Can anybody please help me.
Thanks in advance.
Shardul.
you can pass your action url directly to the pop up window right? For example if you want to call getUserAction Action class and its Action mapping is /getUserAction.do, you would say
<a href = "#" onclick = "window.open('http://localhost/yourApplication/getUserAction.do?param1=value1,'new' , '')">link</a>
so, this calls the action in a new pop up window and your param1 would be available with the request object in the execute method as request.getParameter("param1").
Hey,
Thanks for your reply.
It works. I made a small change,
Instead of
<a href = "#" onclick = "window.open('http://localhost/yourApplication/getUserAction.do?param1=value1,'new' , '')">link</a>
I changed it to
<a href = "#" onclick = "window.open('./getUserAction.do?param1=value1,'new' , '')">link</a>
Here, getUserAction is the path for the action.
Thanks again.
Shardul.