如何用一张表单执行多项操作?
我有一个包含用户 ID 的表单。它位于具有 3 个框架的页面上。用户提交 ID 后,如何在框架中打开两个不同的 .jsp?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的
更新以澄清一点:
form
标签没有target
属性:用户提交表单。服务器处理表单数据并发送响应,即欢迎页面。浏览器在同一框架中显示此响应页面。
带有
target="_parent"
的form
标记:用户提交表单。服务器处理表单数据并发送响应。这里的区别在于,浏览器用服务器响应替换了整个框架集。这使您有机会更新其他框架。但在这种情况下,您必须更改服务器响应。如果它仍然是欢迎页面,那么浏览器将仅显示该页面,而不显示其他框架。
服务器响应应该是与原始框架集类似的框架集。但是您可以将这三个框架 URL 替换为不同的 URL:
原始框架集:
作为对用户登录的响应,您发送一个新框架集
In your
<form/>
Tag use the attributetarget="_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 withouttarget
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 withtarget="_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:
As a response to the user login you send a new frameset