You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by rc...@xmission.com on 2004/02/26 22:53:00 UTC

html:text works, bean:write fails

I have a situation where I have not found a solution in the archives (I'm
sure it is there, just don't know the right search), the documents (I have
half dozen Struts books, plus the tomcat docs), and Google has not been my
friend:

I have a simple struts application where if I put the following in the JSP
page, it works just fine (other than I don't want a text input field):

<html:text property='totalInventory' size='20'/>

but if I put the following:

<bean:write name='total' property='totalInventory'/>

it won't render the JSP page (just blank), unless I put ignore='true', in
which case the page renders, but I also don't get the output.

The taglibs are all referenced for both the struts-html and struts-bean
taglibs. I have tried putting different scope references in the bean tag. I
have looked at the generated java code and they both appear to show up
similarly.

I am running Tomcat 5.0.19 with a jk2 connector to Apache2 2.0.48, Sun sdk
1.4.2_03, running on a PIII 866 Mhz, 256MB. Struts 1.1 (downloaded today,
release binary).

I look in my logs and I can see the bean being properly set (and it does
properly display when using the html taglib). I am sure this is
outrageously simple, but I spent over a solid day (and night) fighting this
and am getting nowhere.

Any suggestions/questions welcome (yes, I already considered taking up truck
driving instead).

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


Re: html:text works, bean:write fails

Posted by Martin Cooper <ma...@apache.org>.
<rc...@xmission.com> wrote in message
news:1077832380.403e6abc938e9@webmail.xmission.com...
> I have a situation where I have not found a solution in the archives (I'm
> sure it is there, just don't know the right search), the documents (I have
> half dozen Struts books, plus the tomcat docs), and Google has not been my
> friend:
>
> I have a simple struts application where if I put the following in the JSP
> page, it works just fine (other than I don't want a text input field):
>
> <html:text property='totalInventory' size='20'/>

This means "Go find the form bean associated with the enclosing HTML form,
then look up the property named 'totalInventory' on that form bean, and
render the value".

>
> but if I put the following:
>
> <bean:write name='total' property='totalInventory'/>

This means "Go find the bean (form bean or otherwise) named 'total', then
look up the property named 'totalInventory' on that form bean, and render
the value".

The difference is in the bean that is being referenced. Unless your form
bean happens to be named 'total', these two statements are referencing
completely different beans. If there is no bean named 'total' in scope, then
you would see exactly what you are seeing.

--
Martin Cooper


>
> it won't render the JSP page (just blank), unless I put ignore='true', in
> which case the page renders, but I also don't get the output.
>
> The taglibs are all referenced for both the struts-html and struts-bean
> taglibs. I have tried putting different scope references in the bean tag.
I
> have looked at the generated java code and they both appear to show up
> similarly.
>
> I am running Tomcat 5.0.19 with a jk2 connector to Apache2 2.0.48, Sun sdk
> 1.4.2_03, running on a PIII 866 Mhz, 256MB. Struts 1.1 (downloaded today,
> release binary).
>
> I look in my logs and I can see the bean being properly set (and it does
> properly display when using the html taglib). I am sure this is
> outrageously simple, but I spent over a solid day (and night) fighting
this
> and am getting nowhere.
>
> Any suggestions/questions welcome (yes, I already considered taking up
truck
> driving instead).




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