This discussion is archived
9 Replies Latest reply: Mar 7, 2011 10:09 PM by handat RSS

passing data between war file

826528 Newbie
Currently Being Moderated
Hello experts,

I have got this thread as my search result: How does one pass data between war files

Here i found this post:-
"If you set the cookie name to be the same for both web
applications, you should be able to pass the data in the HttpSession...".

My application is deployed in two war files. and i have assigned the task to if a user(who is successfully logged in) is going from one web application to another his session will not get expire and still i can get the values from that session which was created on 1st web application.
Please give me any hint.

Thanks
Shams

Edited by: shams.hq on Feb 22, 2011 1:01 PM
  • 1. Re: passing data between war file
    826528 Newbie
    Currently Being Moderated
    No Idea Guyss....???
  • 2. Re: passing data between war file
    EJP Guru
    Currently Being Moderated
    You found the hint yourself. But your container should support single signon, you shouldn't have to worry about cookies at all. I never have. Look at your container documentation.
  • 3. Re: passing data between war file
    826528 Newbie
    Currently Being Moderated
    Thanks for ur response.

    Sir, now my requirement has been changed.
    Now, i have to redirect from one web application to another with some data and i don't want to send data in Query String. Neither i can use crossContext facility on tomcat.

    I tried HttpClient, and other sendRedirect but in these cases i need to use a shared database.
    Is there any other way to do this??

    Please tell me if anyone.

    Thanks
    Shams
  • 4. Re: passing data between war file
    826528 Newbie
    Currently Being Moderated
    Please guys, any hint....
    May i use Http Header for this task??

    Thanks
    Shams
  • 5. Re: passing data between war file
    EJP Guru
    Currently Being Moderated
    You can do a server-side forward. Then only the server gets to see what's in the URL string.
  • 6. Re: passing data between war file
    826528 Newbie
    Currently Being Moderated
    May i send some data in server-side redirect??
    If yes, please guide me how??

    Thanks
    Shams
  • 7. Re: passing data between war file
    gimbal2 Guru
    Currently Being Moderated
    shams.hq wrote:
    May i send some data in server-side redirect??
    If yes, please guide me how??

    Thanks
    Shams
    Basic HTTP: Add parameters to the url. But that makes them visible to the user.

    If you're actually talking about a forward like is suggested in this thread, you can attach objects to the request object (request.setAttribute()). These objects can be retrieved back as long as it is within the same request.
  • 8. Re: passing data between war file
    826528 Newbie
    Currently Being Moderated
    Thanks to every one.

    I have done this simply by putting data in encrypted form in a form's hidden element on jsp page. And submit that page using javascript.
    And this is working good.

    I think through this i can also transfer data to web application deployed on different servers too.

    Thanks and regards
    Shams
  • 9. Re: passing data between war file
    handat Expert
    Currently Being Moderated
    shams.hq wrote:
    Thanks to every one.

    I have done this simply by putting data in encrypted form in a form's hidden element on jsp page. And submit that page using javascript.
    This is horrible! Why not do what others have suggested and forward on the server side rather than putting it on a client and requiring javascript as well.
    And this is working good.

    I think through this i can also transfer data to web application deployed on different servers too.
    That would be even worst. I hope you are not writing an online shopping application.
    Thanks and regards
    Shams
    Please use your web container's session capabilities, you don't even need an expensive Application server, even Tomcat can do this.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points