let the following code fragment contains a link to items.xhtml
that lists item names and enables the user to select an item in order to view its details:
<?xml ... ?>
<!DOCTYPE ... >
<html ... >
<h:head>
<title>Welcome</title>
</h:head>
<h:body>
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/faces/client/items.xhtml">Items</h:outputLink>
</h:body>
</html>
When the user clicks the link named Items
, then the request line states that the resource being requested is /javaee7-training/faces/client/items.xhtml
and the desired action that should be applied to it is GET
. That is fine.
The following code shows a fragment of items.xml
:
<?xml ... ?>
<!DOCTYPE ...>
<html ...>
<h:head>
<title>items</title>
</h:head>
<h:body>
<h:form prependId="false">
<h:selectOneRadio value="#{bean.itemId}"
layout="pageDirection">
<c:forEach items="#{bean.items}" var="itm">
<f:selectItem itemValue="#{itm.itemno}"
itemLabel="#{itm.itemname}" />
</c:forEach>
</h:selectOneRadio>
<h:commandButton value="Details" action="item" />
</h:form>
</h:body>
</html>
Now when the user clicks the button named Details
, then the request line states that the resource being requested is /javaee7-training/faces/client/items.xhtml
and the desired action that should be applied to it is POST
. I don´t expected this result, because when the user clicks the button named Details
, then the requested resource is /javaee7-training/faces/client/item.xhtml
and the desired action is GET
.
Could anyone explain me this result and why I am wrong?
Thank you in advance