File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Calling Action class in pop up window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Calling Action class in pop up window" Watch "Calling Action class in pop up window" New topic
Author

Calling Action class in pop up window

Raghu Nathan
Ranch Hand

Joined: Jan 16, 2006
Posts: 44
Hi,
I have a requirement where when the user clicks a link, I have to open a pop up window. There will be a number of links and each one will pass a different id to the Action class of the child (pop up) page.
The catch is that I am not supposed to use query string - how can I achieve this?

Please let me know if you have a clue ... thanks


Thanks ... Raghu
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You can do this with:
  • Javascript by changing hidden form fields and the submitting the form from the onclick event of the hyperlink.
  • A front controller that reads the URL of the request and determines what action to take accordingly.


  • Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
    Raghu Nathan
    Ranch Hand

    Joined: Jan 16, 2006
    Posts: 44
    Thanks for the response ...
    I had tried doing that - I submitted the page with different hidden ctrl values and in the (parent) action class I tried to forward it to the child action. However, when I did this, the parent window showed the child window contents and vice-versa! (I hope you are able to follow what I mean)
    I know I screwed up - but where, I am not able figure out.

    Thanks again

    My code in jsp

    function setValues(topId,sideId,type)
    {
    alert(topId);
    alert(sideId);
    alert(type);
    if (type == 'TRKCOMP')
    {
    document.forms[0].stSasId.value = sideId;
    document.forms[0].stObjId.value = topId;
    }
    else
    {
    document.forms[0].stSasId.value = topId;
    document.forms[0].stObjId.value = sideId;
    }
    document.forms[0].viewHistory.value = 'Y';

    openWindow('/vtcts/studentCompetencyHistory.do');
    //document.forms[0].submit();}


    Code in parent action class

    else if (screenParams.get("viewHistory") != null) {
    String strSasId = (String) screenParams.get("stSasId");
    String strObjId = (String) screenParams.get("stObjId");
    log.info("strSasId" + strSasId);
    log.info("strObjId" + strObjId);

    sessionManager.setAttribute("strObjId", new SessionObject(strObjId));
    sessionManager.setAttribute("strSasId", new SessionObject(strSasId));
    return mapping.findForward("viewHistory");
    }
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60046
        
      65

    Please use UBB code tags when posting code to preserve its formatting. I will not read unformatted code. Please read this for more info.


    [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    Raghu Nathan
    Ranch Hand

    Joined: Jan 16, 2006
    Posts: 44
    Sorry about that folks - I was not aware. Here is the code in JSP and Action Class in the meantime.



    Code in parent action class


    ---------
     
     
    subject: Calling Action class in pop up window
     
    Similar Threads
    execute action when window.close()
    Struts action triggered by onUnload event
    jquery-struts2
    Struts action triggered by onUnload event
    modal pop up not closing