can i submit 2 jsp pages to the server at a single button click.

Discussion in 'Java' started by Devendra, Apr 24, 2006.

  1. Devendra

    Devendra Guest

    all java gurus,
    I am facing trouble with this issue.
    can someone please help me in this regard.

    scenario is like this:

    Application uses frames to load multiple JSPs.
    One of the frame(say frameA) contains a form(say formA) with <select>
    list and submit button.
    In other frame (say frameB) i have another form(say formB).

    When user clicks on 'submit' of page in frameA ; i need to check the
    selection he made and load the frameB accordingly.
    But before loading frame B with new content ; i want to store the
    information in formB that was modified before clicking the submit of
    formA.

    So i will need to get both formA as well as formB to get submitted on
    single submit.

    1. is it possible to achieve?
    2. if yes, how?

    i tried by using unload event for body of page in frameB.
    but the it first goes to the server -> brings new page for frame b->
    calls unload for old page->
    (tried to ) save the old page by call to submit()...
    but now i can't see the new page in frameB.
    perhaps because when server recieves the old page. it is not generating
    new page after it.
    server generates new page before saving old one.

    please help me?
    ---
    ~Devendr@...
    Devendra, Apr 24, 2006
    #1
    1. Advertising

  2. Devendra

    Guest

    Hi,

    this sounds like more a job for javascript that for jsp. With a
    javascript block you can do something like this;

    onSubmit() {
    form.on.page.A.submit();
    form.on.page.B.submit();
    }

    naturally their submissions will then go to the correct jsp pages which
    you can process - be warned though, if javascript is disabled on your
    client's browser a click will result in no action at all.
    , Apr 24, 2006
    #2
    1. Advertising

  3. Devendra

    Oliver Wong Guest

    <> wrote in message
    news:...
    > Hi,
    >
    > this sounds like more a job for javascript that for jsp. With a
    > javascript block you can do something like this;
    >
    > onSubmit() {
    > form.on.page.A.submit();
    > form.on.page.B.submit();
    > }
    >
    > naturally their submissions will then go to the correct jsp pages which
    > you can process - be warned though, if javascript is disabled on your
    > client's browser a click will result in no action at all.


    Assuming onSubmit() is an event in form A, won't this result in an
    infinite recursion? I guess you'd need a second secret, invisible submit
    button for form A to actually do the "talk to JSP backend" stuff.

    - Oliver
    Oliver Wong, Apr 25, 2006
    #3
  4. Devendra

    Guest

    Devendra wrote:
    .....
    > Application uses frames to load multiple JSPs.


    Frames are not recognised in HTML 4.01 (AFAIR)

    They are discourage for any number of reasons, see
    comp.infosystems.www.html for reasons why.

    > So i will need to get both formA as well as formB to get submitted on
    > single submit.


    As mentioned, you might look to JS to perform this,
    but check it with the experts* and they will probably
    advise against it, but you might also get suggestions
    that achieves it for JS enabled browsers, yet degrades
    gracefully for users with browsers with no JS.

    * comp.lang.javascript

    Andrew T.
    , Apr 26, 2006
    #4
  5. Devendra

    Oliver Wong Guest

    <> wrote in message
    news:...
    >
    > Frames are not recognised in HTML 4.01 (AFAIR)
    >
    > They are discourage for any number of reasons, see
    > comp.infosystems.www.html for reasons why.


    My USENET server carries the comp.infosystems.www hierarchy, but not
    comp.infosystems.www.html, it seems. Can you tell me what those reasons may
    be? I find the "navigation frame + main content frame" to be a pretty
    common, and as far as I can tell, relatively problem free design. I'm aware
    that some browsers (e.g. lynx) may have problem rendering frames, but they
    degrade relatively elegantly.

    - Oliver
    Oliver Wong, Apr 26, 2006
    #5
  6. Devendra

    Devendra Guest

    Thanks to all of you there ; for your valuable suggestions.
    i have chosen to use javascript.

    Andrew, i want to have look at those reasons for discouraing frames.
    but i guess there is some typo with the link.
    can you please re-send the link.

    Thanks & Regards,
    ~Devendr@...
    Devendra, Apr 27, 2006
    #6
  7. On Wed, 26 Apr 2006 13:43:51 +0000, Oliver Wong wrote:

    > <> wrote in message
    > news:...
    >>
    >> Frames are not recognised in HTML 4.01 (AFAIR)
    >>
    >> They are discourage for any number of reasons, see
    >> comp.infosystems.www.html for reasons why.

    >
    > My USENET server carries the comp.infosystems.www hierarchy, but not
    > comp.infosystems.www.html, it seems.


    That's because he misspelled comp.infosystems.www.authoring.html .

    > Can you tell me what those reasons may be? I find the "navigation frame
    > + main content frame" to be a pretty common, and as far as I can tell,
    > relatively problem free design. I'm aware that some browsers (e.g. lynx)
    > may have problem rendering frames, but they degrade relatively
    > elegantly.


    Because they're an extremely leaky abstraction of templates.

    - If you arrive at the content part of a frameset without the frameset
    (eg., from a search engine hit), you cannot navigate the site. Working
    around this requires scripting, which is less than optimal.
    - If you find a page within a frameset that you're interested in, and you
    bookmark it, when you load the bookmark odds are good you'll arrive
    back at the beginning of the frameset.
    - They break URLs. A single URL should point to a single resource, but a
    frameset's URL refers to a series of resources (one for every page you
    navigate to within the frameset, not "one for every frame").
    Owen Jacobson, Apr 27, 2006
    #7
  8. Devendra

    Oliver Wong Guest

    "Owen Jacobson" <> wrote in
    message
    news:p...
    > On Wed, 26 Apr 2006 13:43:51 +0000, Oliver Wong wrote:


    >> Can you tell me what those reasons

    [that frames are bad]
    >> may be? I find the "navigation frame
    >> + main content frame" to be a pretty common, and as far as I can tell,
    >> relatively problem free design. I'm aware that some browsers (e.g. lynx)
    >> may have problem rendering frames, but they degrade relatively
    >> elegantly.

    >
    > Because they're an extremely leaky abstraction of templates.
    >
    > - If you arrive at the content part of a frameset without the frameset
    > (eg., from a search engine hit), you cannot navigate the site. Working
    > around this requires scripting, which is less than optimal.


    Usually what is done is that each page in the "content frame" either has
    something you can click on to take you to the top level document (see the
    "frames" and "no frames" link in generated JavaDocs, for example), or each
    page in the content frame will contain navigational links as well (e.g. for
    sequential content, the navigational frame will act as a table of contents,
    with the links in the content frames will be "forward one page" or
    "backwards one page").

    > - If you find a page within a frameset that you're interested in, and you
    > bookmark it, when you load the bookmark odds are good you'll arrive
    > back at the beginning of the frameset.


    Depends on the browser implementation. I believe FireFox stores the
    state of each frame when bookmarked.

    > - They break URLs. A single URL should point to a single resource, but a
    > frameset's URL refers to a series of resources (one for every page you
    > navigate to within the frameset, not "one for every frame").


    This is the strongest argument against frames, in my opinion, and I
    concede there isn't much you can do about this if you use frames.

    - Oliver
    Oliver Wong, Apr 27, 2006
    #8
  9. Devendra

    Guest

    Owen Jacobson wrote:
    > On Wed, 26 Apr 2006 13:43:51 +0000, Oliver Wong wrote:
    >
    > > <> wrote in message

    ....
    > >> Frames are not recognised in HTML 4.01 (AFAIR)
    > >>
    > >> They are discourage for any number of reasons..

    ....
    > > Can you tell me what those reasons may be?

    ....
    > Because they're an extremely leaky abstraction of templates.

    (trim further reasons)

    Whew! Glad you provided such a good answer.
    I forgot all the problems with frames as soon as I stopped
    (mostly*) using them.

    * I still use them for some CD based projects that are
    impractical otherwise.

    Andrew T.
    , May 2, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page