You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Shah, Shrihas (OFT)" <Sh...@oft.state.ny.us> on 2003/04/23 14:39:04 UTC

cannot make bean:write or logic:notEmpty tag work.

Hi :

I cannot access the form attributes using either bean:write or
logic:notEmpty tag.

My JSP has following code.

<bean:write name="indexForm" property="username" filter="true"/>
(without name attribute it does not work also, if I specify scope it
generates same error that bean named indexForm not found)

it says that indexForm is not found.

If I try the logic tag as below I get same results

<logic:notEmpty name="indexForm" property="username"> (without name
attribute it does not work also)
</logic:notEmpty>

If I put html:text tag then it works fine.

Such as <html:text property="username"> It does populate it with the
proper value.

My entry in struts-config.xml file is like this.
	<form-beans>
		<form-bean name="indexForm"
type="us.ny.state.oft.whitepages.IndexForm">
		</form-bean>
	</form-beans>

	<!-- Action Mappings -->
	<action-mappings>
		<action name="indexForm" path="/index" scope="session"
type="us.ny.state.oft.whitepages.IndexAction">
			<forward name="list" path="./list.jsp?id=-1">
			</forward>
		</action>
	</action-mappings>

My IndexForm.java has following code.

Public String getUsername()
{
	return username;
}
public void setUsername(String s)
{
	username = s;
}


 Do I need to put my form like session.setAttribute("indexForm",this); I
believe it should already be in session scope as indexForm gets created
before the page gets displayed.

Any help? Thanks in Advace.

Shrihas Shah
 Albany, NY 12223


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: cannot make bean:write or logic:notEmpty tag work.

Posted by Arnaud HERITIER <ah...@sopragroup.com>.
Didn't you forget the html:form tag ????

> -----Message d'origine-----
> De : Shah, Shrihas (OFT) [mailto:Shrihas.Shah@oft.state.ny.us]
> Envoye : mercredi 23 avril 2003 14:39
> A : struts-user@jakarta.apache.org
> Objet : cannot make bean:write or logic:notEmpty tag work.
> 
> 
> Hi :
> 
> I cannot access the form attributes using either bean:write or
> logic:notEmpty tag.
> 
> My JSP has following code.
> 
> <bean:write name="indexForm" property="username" filter="true"/>
> (without name attribute it does not work also, if I specify scope it
> generates same error that bean named indexForm not found)
> 
> it says that indexForm is not found.
> 
> If I try the logic tag as below I get same results
> 
> <logic:notEmpty name="indexForm" property="username"> (without name
> attribute it does not work also)
> </logic:notEmpty>
> 
> If I put html:text tag then it works fine.
> 
> Such as <html:text property="username"> It does populate it with the
> proper value.
> 
> My entry in struts-config.xml file is like this.
> 	<form-beans>
> 		<form-bean name="indexForm"
> type="us.ny.state.oft.whitepages.IndexForm">
> 		</form-bean>
> 	</form-beans>
> 
> 	<!-- Action Mappings -->
> 	<action-mappings>
> 		<action name="indexForm" path="/index" scope="session"
> type="us.ny.state.oft.whitepages.IndexAction">
> 			<forward name="list" path="./list.jsp?id=-1">
> 			</forward>
> 		</action>
> 	</action-mappings>
> 
> My IndexForm.java has following code.
> 
> Public String getUsername()
> {
> 	return username;
> }
> public void setUsername(String s)
> {
> 	username = s;
> }
> 
> 
>  Do I need to put my form like 
> session.setAttribute("indexForm",this); I
> believe it should already be in session scope as indexForm 
> gets created
> before the page gets displayed.
> 
> Any help? Thanks in Advace.
> 
> Shrihas Shah
>  Albany, NY 12223
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>