おんやぁ?
Strutsの定義
<action path="/InitFaces"
type="hoge.InitAction"
name="SampleBean"
validate="false"
scope="request">
<forward name="success" path="/hoge"/>
</action>
/hogeはtilesの定義。
<definition name="hogelayout" path="/common/layout.faces">
<put name="title" value=""/>
</definition>
<definition name="/hoge" extends="hogelayout">
<put name="title" value="JSFサンプル画面"/>
<put name="body" value="/hoge.jsp"/>
</definition>
<%@ page contentType="text/html; charset=Windows-31J" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib prefix="s" uri="http://struts.apache.org/tags-faces" %><link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
<f:view>
<s:html locale="true">
<head>
<title>JSF sample</title>
</head>
<body><s:errors/>
<s:form action="/SampleAction">
<h:inputText id="userInput"
value="#{SampleBean.input}"/><h:commandButton id="increment"
actionListener="#{SampleBean.event}"
value="Increment"/>
<h:commandButton id="decrement"
actionListener="#{SampleBean.event}"
value="Decrement"/>
</s:form>
</body>
</s:html>
</f:view>
これで/InitFaces.doに対して遷移してコンパイルされた画面。
<link rel="stylesheet" href="/JTBUtils/style.css" type="text/css"/>
<html lang="ja">
<head>
<title>JSF sample</title>
</head><body>
<span id="_id1"></span>
<form id="_id2" name="SampleBean" action="/hoge.do" method="post">
<input type="hidden" name="_id2" value="_id2" />
<input id="_id2:userInput" type="text" name="_id2:userInput" />
<input id="_id2:increment" type="submit" name="_id2:increment" value="Increment" />
<input id="_id2:increment" type="submit" name="_id2:increment" value="Increment" />
<input type="hidden" name="_id2" value="_id2" />
</form>
</body>
</html>
はれ?
action="/hoge.do"
まぁサンプルでもここはそのページへのアクセス方法が書かれているからいいのかしら・・・。
んが、アドレス欄に"〜*.faces"と入力して表示した画面から>次画面へはpostできるのだが、"〜*.do"(forwardで*.facesに飛ばしている)だと次画面にいこうとすると404だ。
・・・というかサンプルでもできないっぽいのだが???
むむむむむむ?