struts2 : How to bring up a pop up window
I am working on a Struts 2 application .I have a JSP page in which there is a normal html table. In one of the columns , I have a link called 'update' . When I click on the 'update' , a new popup window will open and the pop up will have many other details of the current row (which means it has to pass through some action and fetch data from database).
There is a Submi开发者_运维技巧t button in popup , which when clicked , must submit the edited data .
How do I create this popup in struts 2?
Should it be the same form as the parent window or a different one ?
It would be of great help , if you can give links to some tutorial . I am not able to find it in google search .
Its a problem related to javascript not struts2.I guess you must be using this syntax in the table definition for link update
.
<tr><a href="javascript:update('<s:proerty value="anyValueYouwantToSend"/>')">Update</a></tr>
where anyValueYouwantToSend
may be some identifier value you want to send to identify the particular row
Then in Javascript
function update(value){
var url="myAction?someVariable=value";
window.open(url,"_blank","directories=no, status=no,width=1400, height=870,top=0,left=0");
}
where myAction
will be the action in which you are going to do your database stuff.In the action mapping of this action you need to give result to a jsp which is going to be your pop-up window.And of course popup window will have a different form to submit, however the update you perform here will be reflected in the parent window only when you refresh it.If you want to reflect these changes without refreshing the parent window you need to write some parent child javascript, which i can help you to do if you want
精彩评论