Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a form that takes in a userID. It is located on a page with 3 frames. How would I open two different .jsp's in the frames after the user submits their ID?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
124 views
Welcome To Ask or Share your Answers For Others

1 Answer

In your <form/> Tag use the attribute target="_parent" to break up the current frame set. Then in your response you can send a new frameset so that all three frames are reloaded.

Update to clarify it a little bit:

form tag without target attribute: The user submits the form. The server processes the form data and sends a response, i.e. a welcome page. The browser shows this response page in the same frame.

form tag with target="_parent": The user submits the form. Ther server processes the form data and sends a response. The difference here is, that the browser replaces the whole frameset with the server respone. This gives you the chance to update the other frames.

But in this case you have to change the server response. If it is still the welcome page then the browser will show only that page and no other frames. The server response should be a frameset similar to the original frameset. But you can replace the three frame URLs with different URLs:

Original frameset:

<frameset>
  <frame src="login.jsp" name="frame1" />
  <frame src="contentA.jsp" name="frame2" />
  <frame src="contentB.jsp" name="frame3" />
</frameset>

As a response to the user login you send a new frameset

<frameset>
  <frame src="welcome.jsp" name="frame1" />
  <frame src="contentC.jsp" name="frame2" />
  <frame src="contentD.jsp" name="frame3" />
</frameset>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...