我需要将bean中的值传递给HTML页面的JavaScript部分
<script language="javascript" for="obj" event="ControlInitialized>
obj.URL = #{myBean.ObjectURL};
</script>
其中#{myBean.ObjectURL}是:
http://localhost:8080/project/descript.xsd
答案 0 :(得分:4)
始终,始终查看生成的输出。
obj.URL = http://localhost:8080/project/descript.xsd;
注意什么遗失?
obj.URL = "http://localhost:8080/project/descript.xsd";
答案 1 :(得分:2)
必须是一个字符串:
<script language="javascript" ">
objURL = "#{myBean.ObjectURL}";
</script>
答案 2 :(得分:1)
试试这个:
<script language="javascript" > //Remove the extra quote
obj.URL = "#{myBean.ObjectURL}"; // Put it in quotes
</script>