1

I have a JSP page with four tabs and a background image. I want that when I click one of the tab, a JSP function should be invoked that will only update the clicked tab contents not the whole page and background image. A similar example can be the Multiview control in ASP.NET

4

2 回答 2

2

ASP.NET 无法与普通的 JSP 相提并论。JSP 更能与“经典 ASP”相媲美。如果您正在寻找 ASP.NET(-MVC) 的 Java 对应物,请查看 JSF。例如,PrimeFaces有一个<p:tabView>组件,我认为这正是您正在寻找的。

在纯 JSP 中,您需要引入一些 JavaScript 代码来执行 Ajax 请求并操作 HTML DOM 和一些 Servlet 以返回必要的数据。jQueryjQuery UI可能会对此有所帮助。

于 2012-02-18T16:22:35.663 回答
0

没有您的代码,我们无能为力..

尝试以下代码,将鼠标悬停在其他 div 上时,将 div 的内容图像更改为其他图像。通过一些修改,它可能会达到您的要求。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title><br />

</head>

<body>
<p>
  <script type="text/javascript" language="javascript">
function changeImage(img){
   document.getElementById('bigImage').src=img;

}
</script>

  <img src="../Pictures/lightcircle.png" alt="" width="284" height="156" id="bigImage" />
<p>&nbsp; </p>
<div>
  <p>
  <img src="../Pictures/lightcircle2.png" height=79 width=78 onmouseover="changeImage('../Pictures/lightcircle2.png')"/>

 </p>
 <p><img src="../Pictures/lightcircle.png" alt="" width="120" height="100" onmouseover="changeImage('../Pictures/lightcircle.png')"/></p>

 <p><img src="../Pictures/lightcircle2.png" alt="" width="78" height="79" onmouseover="changeImage('../Pictures/lightcircle2.png')"/></p>

 <p>&nbsp;</p>


  </br>
</div>
</body>
</html>

链接到问题

于 2012-02-27T10:08:06.933 回答