Announcement Announcement Module
No announcement yet.
Popup question Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Popup question

    Spring newbie here. I have a really simple jsp page. I have done a lot of searching through the forums on popups as well as looking into the books. Should be pretty straight forward (I think). Here is what I want:

    From a jsp a button that transfers control back to the application an opens up a popup window with the data it has gathered (based on the information in the main jsp page)

    Thoughts? I am using Spring Framework 1.0.
    Last edited by Aztecs1; Aug 28th, 2008, 03:27 PM.

  • #2
    Be more specific on your question. Do you not konw where to start or you have particular problem with spring?


    • #3
      OK, let me try again. I have a set of jsp pages that are handled by controller classes. *htm files are processed by the respective controllers and a new page is served back to the user. Works great. I have one page that needs to be displayed in a popup not in a new page. So how do I handle this? I assume some javascript is involved? I have looked for an example but I have not found one. Again I am using Spring 1.0 and for reasons I wont go into I do not wish to go to 2.0.

      1st jsp has a text box and a few buttons. One of the buttons needs to go back to the application and put together text based the text box on the 1st page. And this information needs to be displayed in a popup window.


      • #4
        If you need a button to display a popup windows, then yes, you just use JavaScript. Not related to spring here. Google tells me there is a sample here:

        So if you need the content of the popup shows the same page where you originally started with, then simply put the URL in your first parameter of javascript function call. Add a extra parameter if you need to distinguish the two urls.


        • #5
          Still having some problems. Here is what I have:

          function popUpWindow() {
"popupwindow.htm","popupwindow","menub ar=no,width=460,height=360,toolbar=no");

          I have two buttons for the form on the initial page:

          Button 1 (response should go back to this page):

          <input type="submit" name="_target0" value="submit">

          Button 2 (response should come back in popup window):

          <input type="submit" onclick="javascriptopUpWindow()" name="_target1" value="Display Info In Pop Up">

          In my app-servlet.xml:

          <bean id="firstPageController"

          <bean id="popUpController"

          <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
          <property name="urlMap">
          <entry key="/firstpage.htm">
          <ref bean="firstPageController" />
          <entry key="/popupwindow.htm">
          <ref bean="popUpController" />

          Now if I click Button 1 everything works fine and the response is sent back to the page. But if I click Button 2 it does not work as I want it to. It seems to still want to send back the response to the originating page and not the popup page. What am I missing?


          • #6
            On your second button, you don't want type to be "submit". Try "button" instead.


            • #7
              Originally posted by thebugslayer View Post
              On your second button, you don't want type to be "submit". Try "button" instead.
              That stopped the redirect back to the original page, but it did not send the form information to my Popup Controller. The original page has one text box and two buttons. Both button will access the text box and do different things with that info. First button will return back to the original page, second button will return back information into the popup window.


              • #8
                Hum... i see what you trying to do now.

                Well, I don't think you can have single form submit and return output to two different windows. They would have to be two distinct form submission. Like when you open the popup window, it then submit your form to your controller.

                What you can try is using Javascript code in your popUpWindow() javascript method to retrieve the firstpage form data(something like form[0], and build a query string for the popupWindow url. And then your popUpController can simply read the request parameters.