Results 1 to 8 of 8

Thread: Popup question

  1. #1
    Join Date
    Aug 2008
    Posts
    4

    Default 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 at 03:27 PM.

  2. #2
    Join Date
    Jan 2007
    Location
    Orlando, FL USA
    Posts
    84

    Default

    Be more specific on your question. Do you not konw where to start or you have particular problem with spring?
    http://www.jroller.com/thebugslayer - notes on java, scala and other development stuff.

  3. #3
    Join Date
    Aug 2008
    Posts
    4

    Default

    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. #4
    Join Date
    Jan 2007
    Location
    Orlando, FL USA
    Posts
    84

    Default

    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: http://www.pageresource.com/jscript/jwinopen.htm

    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 window.open function call. Add a extra parameter if you need to distinguish the two urls.
    http://www.jroller.com/thebugslayer - notes on java, scala and other development stuff.

  5. #5
    Join Date
    Aug 2008
    Posts
    4

    Default

    Still having some problems. Here is what I have:

    function popUpWindow() {
    window.open("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"
    class="FirstPageController">
    </bean>

    <bean id="popUpController"
    class="PopUpController">
    </bean>

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

    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. #6
    Join Date
    Jan 2007
    Location
    Orlando, FL USA
    Posts
    84

    Default

    On your second button, you don't want type to be "submit". Try "button" instead.
    http://www.jroller.com/thebugslayer - notes on java, scala and other development stuff.

  7. #7
    Join Date
    Aug 2008
    Posts
    4

    Default

    Quote 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. #8
    Join Date
    Jan 2007
    Location
    Orlando, FL USA
    Posts
    84

    Default

    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].input.name.value), and build a query string for the popupWindow url. And then your popUpController can simply read the request parameters.
    http://www.jroller.com/thebugslayer - notes on java, scala and other development stuff.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •