• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in opening a popup window in struts 2

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am facing a problem opening a popup in struts 2. My steps are as follows :
1) Including the script in jsp.
<head><script type="text/javascript" src="../js/m2.js"></script> </head>

2) The code which expect to open a pop up

<s:iterator value="clientList" status="clientModel">
<tr>
<td><a href="<s:url value="m2Container.action"/>" onclick="openPopup()"><s:property value="clientName"/></td>
<td><s:property value="status"/></td>
<td><s:property value="phone"/></td>
<td><s:property value="email"/></td>
</tr>

</s:iterator>

3) the js function

function openPopup(URL) {
window.open(URL, "Client Container", "status = 1, height = 300, width = 300, resizable = 0" );
}

Please tell me where I am going wrong. I am not able to figure out.

My Idea of doing this is to first call the action class and perform some business logic and then open the popup as a result.
Please help me.
 
Ranch Hand
Posts: 213
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first problem I see is that your function is expecting a parameter and you are calling the function without a parameter.
 
Pradeep Chaubey
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Richard, I have modified the function like this
<td><a href="#" onclick="openPopup('<s:url value="m2Container.action"/>')"><s:property value="clientName"/></td>

But problem is the js file is not called.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So far I don't see anything Struts-related; moving to HTML/JavaScript. Is your JSP rendering what you expect it to?

Oh, and please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button.
 
Richard Golebiowski
Ranch Hand
Posts: 213
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It could be that it cannot find the js file.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please re-post the HTML as it is sent to the browser, without Struts markup. The Struts server-side markup is meaningless when diagnosing JavaScript issues. Be sure to use code tags and to properly format/indent the code.
 
Pradeep Chaubey
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear members,

Thanks a lot for your valuable time to look into my problem. I was making mistake to include
java script file in the jsp file. Earlier I was including in this fashion.



But when I change it to below form, I got popup window open.


Thanks everyone to your help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic