在mule 4中,是否有一种方法可以使用Load static resources connector在html页面中获取负载,以显示带有负载的html?

在mule 4中,是否有一种方法可以使用Load static resources connector在html页面中获取负载,以显示带有负载的html?,mule,anypoint-studio,mulesoft,Mule,Anypoint Studio,Mulesoft,我无法使用Load static resources连接器显示从有效负载到正在加载的html页面的字符串数组。这是可能的还是有更好的方式显示有效负载?我试图将有效负载放在表单标记中,数组中的每个字符串都是一个复选框 <flow name="Flow"> <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="

我无法使用Load static resources连接器显示从有效负载到正在加载的html页面的字符串数组。这是可能的还是有更好的方式显示有效负载?我试图将有效负载放在表单标记中,数组中的每个字符串都是一个复选框

<flow name="Flow">
    <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/*"/>
    <ee:transform doc:name="Transform Message" >
        <ee:message >
        </ee:message>
        <ee:variables >
            <ee:set-variable variableName="attributes" >
<![CDATA[%dw 2.0 output application/java ---
attributes]]></ee:set-variable>
        </ee:variables>
    </ee:transform>
    <flow-ref doc:name="Flow Reference" name="Flow1"/>
    <http:load-static-resource doc:name="Load static resource" resourceBasePath="src\main\resources\web\" attributes="#[vars.attributes]"/>
</flow>

HTML


数据检索
物体:
//循环数组中的每个字符串
评估(“(“+有效载荷+”)”);


加载静态资源操作,顾名思义,它适用于不会动态更改的静态资源,即数据

手术似乎就是你要找的。可以在文件中使用DataWeave表达式

例如:

流量:


HTML:


#[有效负载['name']]
#[有效负载['address']]

请添加流和HTML模板。解析模板是否允许通过脚本标记或js文件使用javascript?解析模板不知道文件的内容。它将仅用计算结果替换表达式标记。除此之外,它可以是任何东西。
<html>
<body>
<h1>data retrieval</h1>

<form action="#" method="POST">
    Objects:
    //loop each string in array 
    <input type="checkbox" name="objects" >
        <script>eval('(' + payload +')');</script>
    </input>
    <br/>
    <input type="button" name="Submit" value="Submit" id="submit"/>
</form>
</body>
</html>
<parse-template location="form.html" doc:name="Parse Template"/>
<html>
    <body>
        <table>
         <tr>
            <td>#[payload['name']]</td>
            <td>#[payload['address']]</td>
         </tr>
        </table>
    </body>
</html>