Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
132 views
in Technique[技术] by (71.8m points)

java - How to perform multiple actions with one form?

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

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

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...