form input not propagating to action pojo
solarin Sep 21, 2009 11:22 PMHello.
I could really use some assistance at this point as I feel I am hitting a brick wall.
I am using Seam 2.1.2 on JBoss 4.3 EAP with JDK 1.5.0_19 to compile. When I hit the purchase button in the example below, the page re-displays but I receive nothing in the logs at all and the desired effect surely does not happen (whether I enter an invalid value or a valid one). It appears that the input is lost and the confirm action is never called.
managerda.xhtml
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:a="http://richfaces.org/a4j"
template="../layout/template_railed.xhtml">
<ui:param name="headTitle" value="#{ msg['rda.headTitle'] }"/>
<ui:param name="bodyTitle" value="#{ msg['rda.bodyTitle'] }"/>
<ui:define name="body">
<h:messages styleClass="error-message"/>
...
<h:form id="rdaPurchaseForm">
<table cellpadding="0" width="100%">
<tr>
<td class="text-darkgrey">
Enter number of 5-hour blocks to purchase: 
<h:inputText id="blocks"
value="#{ rdaAction.blocks }"
maxlength="2" size="4"/>
 
<h:commandButton action="#{ rdaAction.prePurchConfirm }"
value="Purchase" id="purchase"
image="/img/btn_purchase.gif"
alt="purchase"/>
<br />
<span class="text-darkgrey">$#{ user.rdaBlockPurchasePrice }
per block will be added to your bill.</span>
</td>
</tr>
</table>
</h:form>
...
</ui:define>
</ui:composition>
RdaAction.java
@Name( "rdaAction" )
@Scope( ScopeType.CONVERSATION )
public class RdaAction
{
@Logger
private static Log log;
@Out( required = false )
protected RdaSummary rdaSummary;
/** The number of blocks the user wants to purchase. */
@In( required = false )
@Out( required = false, scope = ScopeType.CONVERSATION )
protected String purchaseBlocks;
/** The blocks the user entered. */
private String blocks;
@In
private FacesMessages facesMessages;
@In
private UserProfile user;
@In
private FacesContext facesContext;
...
public String getBlocks( )
{
return blocks;
}
public void setBlocks( String blocks )
{
this.blocks = blocks;
}
@Begin( join = true )
public String prePurchConfirm( )
{
log.info( "entry for blocks is: " + StringUtils.stripToEmpty( blocks ) );
if( StringUtils.isEmpty( blocks ) ||
"0".equals( blocks.trim( ) ) )
{
facesMessages.add(
"You must enter the number of blocks to purchase." );
log.info(
"Blocks to purchase for RDA are blank or zero." );
return null;
}
purchaseBlocks = blocks.trim( );
return "purchaserdaconfirm";
}
...
pages.xml
<page view-id="/rda/managerda.xhtml" action="#{ rdaAction.preManageRda }">
<navigation from-action="#{ rdaAction.prePurchConfirm }">
<rule if-outcome="purchaserdaconfirm">
<redirect view-id="/rda/purchaserdaconfirm.xhtml"/>
</rule>
</navigation>
</page>
I could really use some assistance at this point as I feel I am hitting a brick wall.
I am using Seam 2.1.2 on JBoss 4.3 EAP with JDK 1.5.0_19 to compile. When I hit the purchase button in the example below, the page re-displays but I receive nothing in the logs at all and the desired effect surely does not happen (whether I enter an invalid value or a valid one). It appears that the input is lost and the confirm action is never called.
managerda.xhtml
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:a="http://richfaces.org/a4j"
template="../layout/template_railed.xhtml">
<ui:param name="headTitle" value="#{ msg['rda.headTitle'] }"/>
<ui:param name="bodyTitle" value="#{ msg['rda.bodyTitle'] }"/>
<ui:define name="body">
<h:messages styleClass="error-message"/>
...
<h:form id="rdaPurchaseForm">
<table cellpadding="0" width="100%">
<tr>
<td class="text-darkgrey">
Enter number of 5-hour blocks to purchase: 
<h:inputText id="blocks"
value="#{ rdaAction.blocks }"
maxlength="2" size="4"/>
 
<h:commandButton action="#{ rdaAction.prePurchConfirm }"
value="Purchase" id="purchase"
image="/img/btn_purchase.gif"
alt="purchase"/>
<br />
<span class="text-darkgrey">$#{ user.rdaBlockPurchasePrice }
per block will be added to your bill.</span>
</td>
</tr>
</table>
</h:form>
...
</ui:define>
</ui:composition>
RdaAction.java
@Name( "rdaAction" )
@Scope( ScopeType.CONVERSATION )
public class RdaAction
{
@Logger
private static Log log;
@Out( required = false )
protected RdaSummary rdaSummary;
/** The number of blocks the user wants to purchase. */
@In( required = false )
@Out( required = false, scope = ScopeType.CONVERSATION )
protected String purchaseBlocks;
/** The blocks the user entered. */
private String blocks;
@In
private FacesMessages facesMessages;
@In
private UserProfile user;
@In
private FacesContext facesContext;
...
public String getBlocks( )
{
return blocks;
}
public void setBlocks( String blocks )
{
this.blocks = blocks;
}
@Begin( join = true )
public String prePurchConfirm( )
{
log.info( "entry for blocks is: " + StringUtils.stripToEmpty( blocks ) );
if( StringUtils.isEmpty( blocks ) ||
"0".equals( blocks.trim( ) ) )
{
facesMessages.add(
"You must enter the number of blocks to purchase." );
log.info(
"Blocks to purchase for RDA are blank or zero." );
return null;
}
purchaseBlocks = blocks.trim( );
return "purchaserdaconfirm";
}
...
pages.xml
<page view-id="/rda/managerda.xhtml" action="#{ rdaAction.preManageRda }">
<navigation from-action="#{ rdaAction.prePurchConfirm }">
<rule if-outcome="purchaserdaconfirm">
<redirect view-id="/rda/purchaserdaconfirm.xhtml"/>
</rule>
</navigation>
</page>