ストライプ レイアウトで問題が発生しています。ここでテストケースを示します。
メイン レイアウト (main.jsp):
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@include file="/WEB-INF/jsp/common/taglibs.jsp" %>
<s:layout-definition>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>{$title}</title>
</head>
<body>
<s:layout-component name="body"/>
</body>
</html>
</s:layout-definition>
メイン(sub_main.jsp)を拡張するサブレイアウト:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@include file="/WEB-INF/jsp/common/taglibs.jsp" %>
<s:layout-definition>
<s:layout-render name="/WEB-INF/jsp/common/main.jsp" title="${title}">
<s:layout-component name="body">
This is a test and this is from sub main
<div style="color: red; font-size: 5em;">
<s:layout-component name="subheader"/>
</div>
${body}
</s:layout-component>
</s:layout-render>
</s:layout-definition>
現在、次のコード (test.jsp) でサブメイン レイアウトを使用しています。
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@include file="/WEB-INF/jsp/common/taglibs.jsp" %>
<s:layout-render name="/WEB-INF/jsp/common/sub_main.jsp" title="Test Page">
<s:layout-component name="subheader">
This is from the sub header component
</s:layout-component>
<s:layout-component name="body">
This is from body
</s:layout-component>
</s:layout-render>
しかし、ブラウザでは次のように表示されます。
これはテストで、これはサブからです メインから
です これはボディからです
それ以外の:
これはテストで、これはサブ メインからです これは
サブ ヘッダー コンポーネントからです
これは本文からです
とりわけ、タイトルは次のように表示されます。
「$タイトル」。
私が間違っていることについての手がかりを誰かに教えてください。