我一直陷入困境。
我将尝试以简单的方式解释我的问题 -
这是我的jsp页面 -
这是我的jsp代码 -
<%@page import="org.w3c.dom.Document"%>
<%@page import="com.Search.Struts2.DataEnterActionClass"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="javax.servlet.http.HttpServletResponse"%>
<%-- <%@ page import="com.Search.Struts2.AccessCheckComponent"%> --%>
<jsp:include page="SessionCheckout.jsp"></jsp:include>
<html>
<head>
<%
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
response.setDateHeader("Expires", 0); // Proxies.
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
%>
<div id="nav" style="width:150px; float:left;">
<table>
<%
String StrParentObjectName = "";
StrParentObjectName = (String) DataEnterActionClass.getDocumentName(strObjectId) ;
String hidingRowL1 = HidingRows(strObjectId, ConnectedData, "L1");
String StrGlobal3dXML = (String) DataEnterActionClass.getFile(strObjectId);
%>
<tr>
<td width="25px"><b><a style="text-decoration: none;"
href="javascript:toggle_visibility('tbl1', '<%=strObjectId.toString()%>' , '<%=true%>', '<%= hidingRowL1 %>');">
<div id="<%=strObjectId + "plus" %>" name="lnk1">+</div> </a></b></td>
<td align="left" style="font-size: 120%;">
<a onclick="Here i will have to set value for param tag using javascript">
<%=StrParentObjectName%> </a>
</td>
</tr>
<%
if(ConnectedData.keySet().contains(strObjectId))
{
ArrayList childList = (ArrayList) ConnectedData.get(strObjectId);
Collections.sort(childList);
for(int i=0; i<childList.size(); i++)
{
String childObjectId = (String) childList.get(i);
String hidingRowL2 = HidingRows(childObjectId, MapAll5thLevelChild, "L2"); // 2
String prientedData = (String) DataEnterActionClass.getDocumentName(childObjectId) ;
String RowIdCreationL1 = strObjectId + childObjectId + "L1"; // 1
StrGlobal3dXML = (String) DataEnterActionClass.getFile(childObjectId) ;
%>
<tr id="<%= RowIdCreationL1 %>" >
<td><b><a style="text-decoration: none;"
href="javascript:toggle_visibility('tbl1', '<%=childObjectId.toString()%>' , '<%=true%>', '<%= hidingRowL2 %>');">
<div id="<%=childObjectId + "plus" %>" name="lnk1">+</div> </a></b></td>
<td align="left" height="10" style="font-size: 90%;">
<a onclick="Here i will have to set value for param tag using javascript">
<%=prientedData%> </a> <sup>1</sup> </td>
</tr>
<script>
window.onload = VisibleFalse('<%=RowIdCreationL1%>');
</script>
<%
}
}
%>
</table>
</div>
<div id="section" style = "width:800px; height:700px; float:left;" >
<object type='application/x-3dxmlplugin' id='3DXMLPluginId' style="width: 600px; height: 500px;">
<!-- <param name='DocumentFile' value='D:\IETM\CheckedInFiles\Model\Compart_Two\watch.3dxml'>
-->
<param name='DocumentFile' id="fileId" value= " This i want to change dynamically ">
</object>
</div>
</html>
这里我只使用了两个div = id =&#39; nav&#39; &安培;其他的id =&#39; section&#39;。
在图像中,如果我点击船超链接(左侧),则附带船的3dxml图像应显示在右侧。 为此,我在船超链接上调用javascript&amp;尝试更新param标签值(如硬编码)&amp;那个div&#39;部分&#39;太。我在java&#39; StrGlobal3dXML&#39;中获得了这个价值。字符串变量。
我试图用很多方式来实现,比如js,ajax,但不成功。
这对我来说非常重要。无论如何实现这一点或任何建议,提示都将非常有用。 请尝试使用javascript或除jQuery之外的任何其他方式提供解决方案。我甚至不知道jQuery的abc。
谢谢!
答案 0 :(得分:1)
最后我得到了答案。
在Ajax中,你可以像这样调用你的对象标签 -
<object type='application/x-3dxmlplugin' id='3DXMLPluginId' style="width: 800px; height: 700px; ">
<param name='DocumentFile' value="\\10.60.3.47/IETM_CheckedInFiles/Model/Deck_One/watch.3dxml">
</object>
现在在TreeView.jsp中 -
function Print3dXML()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","IETMAjaxCall_getFile.jsp?q=",true);
xmlhttp.send();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("section").innerHTML = xmlhttp.responseText;
}
}
}
我认为,这可能会完成您的要求。