页面树结构

版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

...

代码块
languagexml
<div style="width:100%;height:100%;">
	<!-- 1、表单的响应区域 -->
    <iframe id="myFrame" width="100%" height="100%" allowTransparency name="myFrame">< /iframe>>
</div>

<!-- 2、表单部分,在表单中设置post请求提交的地址、参数、参数值等信息 -->
<form id="submitForm" method="post" action="http://localhost:18080/smartbi/vision/openresource.jsp" target="myFrame">
	<!-- 2.1、集成资源id3、请求参数部分 -->
    <input  id="resid" type="text" name="resid" value=I402881e5019608c408c4fb7801960e2ec9b42d3d>"I402881e5019608c408c4fb7801960e2ec9b42d3d">
	<!-- 23.2、设置集成资源的参数信息1、设置集成资源的参数信息 -->
    <!-- 方式1 -->
    <input  id="paramsInfo" type="text" name="paramsInfo" value='[{"name":"发货区域","value":"东北",displayValue:"东北"}]'>
    <!-- 方式2 -->
    <input type="text" name="param.发货区域" value="东北">
    <input type="text" name="paramDisplay.发货区域" value="东北">

    <!-- 23.3、openresource的其他参数2、openresource的其他参数 -->
	<input  id="refresh" value="true" type="text" name=refresh>"refresh">
</form>

<script language='javascript'>
   // 3、提交表单4、提交表单
    var submitForm = document.getElementById("submitForm");
    // 新窗口打开
    //submitForm.target ="_blank";
    // 提交表单
    submitForm.submit();
</script>


示例总共有四个部分组成,下面我们来逐步拆解

(1)设置提供表单的响应区域

在实际的集成场景中,比较常见的就是点击了某些类似资源树上的节点之后再在页面上展示集成资源的结果,这里我们需要使用<form>标签的target参数来指定显示的位置,可以修改target的参数值为不同的值来得到不同的响应效果,如:

  • target="_blank": 在新窗口或新选项卡中显示响应。

  • target="_self":在当前页面上响应(默认)
  • target="iframeName":在指定名字的ifarme标签中响应,如下name="myFrame"的ifarme标签中展示,则写为target="myFrame"
代码块
languagexml
<iframe id="myFrame" width="100%" height="100%" allowTransparency name="myFrame" />

(2)form表单部分

在<form>标签中需要设置的参数如下:

  • method="post":请求方式设置为post。
  • action="http://localhost:18080/smartbi/vision/openresource.jsp":提交post请求的地址
  • target="":见前一小节

这样设置完成之后当form表单提交的时候就可以用post请求的方式给openresource请求,并按照指定的方式展示响应资源。


代码块
languagexml
<form id="submitForm" method="post" action="http://localhost:18080/smartbi/vision/openresource.jsp" target="myFrame">

</form>