Struts Tiles 属性を JavaScript 関数に挿入しようとしています。JS 関数はロード時に呼び出され、特定の JSP ページがその関数に追加のコードを追加できるようにする必要があります。
テンプレートは次のようになります。
<html>
<head>
<script>
function onLoad(){
...
<tiles:insert attribute="html.head.onLoad" ignore="true" />
...
}
</script>
</head>
</html>
このテンプレートを実装する JSP サイトは次のようになります。
<html>
<head>
<script>
<tiles:put type="string" name="html.head.onLoad">
document.getElementById("report").style.height = (getWindowHeight() - 200) + "px";
</tiles:put>
...
</script>
</head>
</html>
残念ながら、この属性は JS 関数ではなく、HTML ヘッドの外側のどこかに挿入されます。
目標を達成する方法を知っていますか?