HttpServletRequest and Framesets

Discussions

Web tier: servlets, JSP, Web frameworks: HttpServletRequest and Framesets

  1. HttpServletRequest and Framesets (4 messages)

    We have a generic dynamically generated framset.
    This has one parent or template jsp (the frameset) and two other jsps dynamically pulled in at run time.

    The problem is we put a JavaBean in the request object for the parent jsp. This is fine, this bean can be used here.
    However, the other two jsps which are part of the frameset cannot see this JavaBean in the request object.
    This is expected as these (in total) are three seperate requests to the App Server. Does anyone have any clean ways of dealing with this problem? I would like to avoid using the session as we want this as lightweight as possible.

    Thanks in advance

    Jack

    Threaded Messages (4)

  2. HttpServletRequest and Framesets[ Go to top ]

    Well, it's kind of klugy, but you could place 1 pixel by 1 pixel applet in the background of the web page. The applet could contain the JavaBean that you mentioned.

    Since it is possible to access the methods and attributes of an applet from JavaScript / VBScript, you could have each frameset pull in the value from the applet during an onLoad() event, perhaps.

    Tyler
  3. HttpServletRequest and Framesets[ Go to top ]

    no u cant do that. the only option is to use session. hope this helps. bye.
  4. HttpServletRequest and Framesets[ Go to top ]

    Why wouldn't it work?

    I don't recommend doing it, but I think it is technically feasible. I wrote a course 3 years ago that did applet -> applet communication and applet -> VBScript communication. So, I know that is definitely possible.

    The hard part would be to get the JavaBean into the applet (but this could be done by the applet downloading the object from the server).

    The only other portion that would have to be done is each frameset having VBScript to access the fields of the applet, grabbing what was needed.

    This is definitely not ideal and slow, but I don't see why it wouldn't work.
  5. HttpServletRequest and Framesets[ Go to top ]

    Hi,

    The funcionality of having a new request per frame is intentional and we advised. A frame is by its nature a new request.

    Here is cleanest solution that we could come up with:

    Create a utility class with the following method:

    public static String SetForwardedRequestAttributes(HttpServletRequest request, String URL)

    that pulls all of the attributes out of a request, puts them in a hashtable, and then puts that hashtable into the session under a unique key. It then appends that unique key to the URL passed in as a CGI param and returns it.

    There is a corresponding method called
    public static Hashtable GetForwardedRequestAttributes(HttpServletRequest request)

    that looks at the appended parameter, looks up the value in the session and then returns it.

    In the top level jsp, you call SetForwardedRequestAttributes() for each contained frame URL. In the contained frames, you call GetForwardedRequestAttributes().

    This is what we do. The only down side is that the hash entries in the session tend to proliferate unless you clean them up on each request, which can be done easily enough.

    I have a class like this that I would be glad to send if you mail me at arthur dot ash at epropose dot com. (I wish this list allowed attachments!)

    hope this helps

    PS: My class does not do the clean up that I mentioned but could.