You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bill Siggelkow <bi...@bellsouth.net> on 2004/10/24 20:59:12 UTC
struts-faces: ActionForm not populated
Okay -- I know doing something stupid -- anyway, I am implementing a
simple example using Struts-faces -- I have a login page where a user
enters username and password; which goes through my LogonAction; then
forwards to a faces page for display of entered data. The problem I am
having is that my Action is being called, but the ActionForm (a
dynaActioNForm) is not being populated.
Here's my logon JSP:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ 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" %>
<f:view>
<s:loadMessages var="messages"/>
<s:html locale="true">
<head>
<title>Struts Cookbook - Integrating Struts and JSF</title>
</head>
<body>
<p />
<s:form id="logon" action="/Logon"
focus="username" styleClass="form">
<h:outputLabel for="username" styleClass="label" value="Username:"/>
<h:inputText id="username" required="true" size="10"/> <p />
<h:outputLabel for="password" styleClass="label" value="Password:"/>
<h:inputSecret id="password" required="true" size="10"/> <p />
<h:commandButton id="submit" type="SUBMIT" value="Logon" />
</s:form>
</body>
</s:html>
</f:view>
My struts-config.xml is straightforward normal stuff -- I am using
Struts 1.2.4 and the nightly build of Struts faces (also JSF 1.1) ...
any ideas would be most appreciated.
-Bill Siggelkow
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts-faces: ActionForm not populated
Posted by Bill Siggelkow <bi...@bellsouth.net>.
Ahhh ... Bach!
Worked like a charm, Craig ... thanks!
Craig McClanahan wrote:
> The struts-faces library assumes that you are using value binding
> expressions on your input fields to bind the components to their
> values in the form bean, so it bypasses the usual population. As
> you'd see if you glance at the login screen in the example :-), the
> differences in your JSP are pretty simple:
>
> <h:inputText id="username" required="true" size="10"
> value="#{logonForm.username}"/>
>
> and
>
> <h:inputSecret id="password" required="true" sze="10"
> value="#{logonForm.password}"/>
>
> where "logonForm" is the registered name of your form bean.
>
> Craig
>
> On Sun, 24 Oct 2004 14:59:12 -0400, Bill Siggelkow
> <bi...@bellsouth.net> wrote:
>
>>Okay -- I know doing something stupid -- anyway, I am implementing a
>>simple example using Struts-faces -- I have a login page where a user
>>enters username and password; which goes through my LogonAction; then
>>forwards to a faces page for display of entered data. The problem I am
>>having is that my Action is being called, but the ActionForm (a
>>dynaActioNForm) is not being populated.
>>
>>Here's my logon JSP:
>>
>><%@ page contentType="text/html;charset=UTF-8" language="java" %>
>><%@ 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" %>
>>
>><f:view>
>><s:loadMessages var="messages"/>
>><s:html locale="true">
>><head>
>> <title>Struts Cookbook - Integrating Struts and JSF</title>
>></head>
>><body>
>> <p />
>> <s:form id="logon" action="/Logon"
>> focus="username" styleClass="form">
>> <h:outputLabel for="username" styleClass="label" value="Username:"/>
>> <h:inputText id="username" required="true" size="10"/> <p />
>> <h:outputLabel for="password" styleClass="label" value="Password:"/>
>> <h:inputSecret id="password" required="true" size="10"/> <p />
>> <h:commandButton id="submit" type="SUBMIT" value="Logon" />
>> </s:form>
>></body>
>></s:html>
>></f:view>
>>
>>My struts-config.xml is straightforward normal stuff -- I am using
>>Struts 1.2.4 and the nightly build of Struts faces (also JSF 1.1) ...
>>any ideas would be most appreciated.
>>
>>-Bill Siggelkow
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts-faces: ActionForm not populated
Posted by Craig McClanahan <cr...@gmail.com>.
The struts-faces library assumes that you are using value binding
expressions on your input fields to bind the components to their
values in the form bean, so it bypasses the usual population. As
you'd see if you glance at the login screen in the example :-), the
differences in your JSP are pretty simple:
<h:inputText id="username" required="true" size="10"
value="#{logonForm.username}"/>
and
<h:inputSecret id="password" required="true" sze="10"
value="#{logonForm.password}"/>
where "logonForm" is the registered name of your form bean.
Craig
On Sun, 24 Oct 2004 14:59:12 -0400, Bill Siggelkow
<bi...@bellsouth.net> wrote:
> Okay -- I know doing something stupid -- anyway, I am implementing a
> simple example using Struts-faces -- I have a login page where a user
> enters username and password; which goes through my LogonAction; then
> forwards to a faces page for display of entered data. The problem I am
> having is that my Action is being called, but the ActionForm (a
> dynaActioNForm) is not being populated.
>
> Here's my logon JSP:
>
> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> <%@ 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" %>
>
> <f:view>
> <s:loadMessages var="messages"/>
> <s:html locale="true">
> <head>
> <title>Struts Cookbook - Integrating Struts and JSF</title>
> </head>
> <body>
> <p />
> <s:form id="logon" action="/Logon"
> focus="username" styleClass="form">
> <h:outputLabel for="username" styleClass="label" value="Username:"/>
> <h:inputText id="username" required="true" size="10"/> <p />
> <h:outputLabel for="password" styleClass="label" value="Password:"/>
> <h:inputSecret id="password" required="true" size="10"/> <p />
> <h:commandButton id="submit" type="SUBMIT" value="Logon" />
> </s:form>
> </body>
> </s:html>
> </f:view>
>
> My struts-config.xml is straightforward normal stuff -- I am using
> Struts 1.2.4 and the nightly build of Struts faces (also JSF 1.1) ...
> any ideas would be most appreciated.
>
> -Bill Siggelkow
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org