You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by fea jabi <zy...@hotmail.com> on 2006/01/23 16:09:19 UTC

struts and JSTL

would like to display the value of property amount as $10,00,000. tried 
using the below.

But getting an error/ it doesn't get displayed.

Is this the way to do this. Or is there an easier way to do the same?


<td>
      <bean:define id="amt"><html:text name="Form1" property="amount" 
styleClass="invisibleInput" readonly="true" tabindex="-1"/></bean:define>
      <% System.out.println(amt);%>
      <fmt:formatNumber value="${amt}" type="currency"/>
</td>


Thanks.

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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


Re: struts and JSTL

Posted by Laurie Harper <la...@holoweb.net>.
Since you're using a DynaValidatorForm you need to specify the property 
slightly differently:

     <fmt:formatNumber value="${Form1.map.amount}" type="currency"/>

L.

fea jabi wrote:
> Thank you for your response. I have set the value in the formbean.
> 
> hence, tried this instead
> <td>
>     <fmt:formatNumber value="${Form1.amount}" type="currency"/>
> </td>
> 
> But only half of JSP is getting displayed. Not sure why? any idea why 
> this happening?
> 
> 
> When tried to debug I see an EL exception being thrown
> 
> "Unable to find a value for \"amount\" in object of class 
> \"org.apache.struts.validator.DynaValidatorForm\" using operator \".\""
> 
> The form-bean does have the form-property amount. Not sure why it can't 
> find it.
> 
> Thanks.
> 
> 
> 
>> From: Ed Griebel <ed...@gmail.com>
>> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>> To: Struts Users Mailing List <us...@struts.apache.org>
>> Subject: Re: struts and JSTL
>> Date: Mon, 23 Jan 2006 13:17:07 -0500
>>
>> The problem is that you're putting the 'amount' field into a hidden
>> field and then trying to use that hidden field as a value, but your
>> amt bean will actually contain the value of the form field: "<input
>> type='hidden' value='123.00'/>"
>>
>> Try this instead. First, in your action save this amount value to the
>> request scope:
>>    request.setAttribute("amount", yourAmountVar);
>>
>> Then put in your JSP, assuming a JSP 2.0 container:
>> <td>
>>     <fmt:formatNumber value="${amount}" type="currency"/>
>> </td>
>>
>> -ed
>>
>> On 1/23/06, fea jabi <zy...@hotmail.com> wrote:
>> > would like to display the value of property amount as $10,00,000. tried
>> > using the below.
>> >
>> > But getting an error/ it doesn't get displayed.
>> >
>> > Is this the way to do this. Or is there an easier way to do the same?
>> >
>> >
>> > <td>
>> >       <bean:define id="amt"><html:text name="Form1" property="amount"
>> > styleClass="invisibleInput" readonly="true" 
>> tabindex="-1"/></bean:define>
>> >       <% System.out.println(amt);%>
>> >       <fmt:formatNumber value="${amt}" type="currency"/>
>> > </td>
>> >
>> >
>> > Thanks.
>> >
>> > _________________________________________________________________
>> > Is your PC infected? Get a FREE online computer virus scan from 
>> McAfee(r)
>> > Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>>
>>
>> -- 
>>     "The greatest tyrannies are always perpetrated in the name of the
>> noblest causes." Thomas Paine
>>     "Those who would give up essential Liberty, to purchase a little
>> temporary Safety, deserve neither Liberty nor Safety" - Benjamin
>> Franklin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> 
> _________________________________________________________________
> Don’t just search. Find. Check out the new MSN Search! 
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/



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


Re: struts and JSTL

Posted by Rahul Akolkar <ra...@gmail.com>.
On 1/23/06, fea jabi <zy...@hotmail.com> wrote:
> Thank you for your response. I have set the value in the formbean.
>
> hence, tried this instead
> <td>
>     <fmt:formatNumber value="${Form1.amount}" type="currency"/>
> </td>
>
<snip/>

... value="${Form1.map.amount}" ...

-Rahul


> But only half of JSP is getting displayed. Not sure why? any idea why this
> happening?
>
>
> When tried to debug I see an EL exception being thrown
>
> "Unable to find a value for \"amount\" in object of class
> \"org.apache.struts.validator.DynaValidatorForm\" using operator \".\""
>
> The form-bean does have the form-property amount. Not sure why it can't find
> it.
>
> Thanks.
>
>
<snap/>

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


Re: struts and JSTL

Posted by fea jabi <zy...@hotmail.com>.
Thank you for your response. I have set the value in the formbean.

hence, tried this instead
<td>
     <fmt:formatNumber value="${Form1.amount}" type="currency"/>
</td>

But only half of JSP is getting displayed. Not sure why? any idea why this 
happening?


When tried to debug I see an EL exception being thrown

"Unable to find a value for \"amount\" in object of class 
\"org.apache.struts.validator.DynaValidatorForm\" using operator \".\""

The form-bean does have the form-property amount. Not sure why it can't find 
it.

Thanks.



>From: Ed Griebel <ed...@gmail.com>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: Struts Users Mailing List <us...@struts.apache.org>
>Subject: Re: struts and JSTL
>Date: Mon, 23 Jan 2006 13:17:07 -0500
>
>The problem is that you're putting the 'amount' field into a hidden
>field and then trying to use that hidden field as a value, but your
>amt bean will actually contain the value of the form field: "<input
>type='hidden' value='123.00'/>"
>
>Try this instead. First, in your action save this amount value to the
>request scope:
>    request.setAttribute("amount", yourAmountVar);
>
>Then put in your JSP, assuming a JSP 2.0 container:
><td>
>     <fmt:formatNumber value="${amount}" type="currency"/>
></td>
>
>-ed
>
>On 1/23/06, fea jabi <zy...@hotmail.com> wrote:
> > would like to display the value of property amount as $10,00,000. tried
> > using the below.
> >
> > But getting an error/ it doesn't get displayed.
> >
> > Is this the way to do this. Or is there an easier way to do the same?
> >
> >
> > <td>
> >       <bean:define id="amt"><html:text name="Form1" property="amount"
> > styleClass="invisibleInput" readonly="true" 
>tabindex="-1"/></bean:define>
> >       <% System.out.println(amt);%>
> >       <fmt:formatNumber value="${amt}" type="currency"/>
> > </td>
> >
> >
> > Thanks.
> >
> > _________________________________________________________________
> > Is your PC infected? Get a FREE online computer virus scan from 
>McAfee(r)
> > Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>--
>     "The greatest tyrannies are always perpetrated in the name of the
>noblest causes." Thomas Paine
>     "Those who would give up essential Liberty, to purchase a little
>temporary Safety, deserve neither Liberty nor Safety" - Benjamin
>Franklin
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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


Re: struts and JSTL

Posted by Ed Griebel <ed...@gmail.com>.
The problem is that you're putting the 'amount' field into a hidden
field and then trying to use that hidden field as a value, but your
amt bean will actually contain the value of the form field: "<input
type='hidden' value='123.00'/>"

Try this instead. First, in your action save this amount value to the
request scope:
   request.setAttribute("amount", yourAmountVar);

Then put in your JSP, assuming a JSP 2.0 container:
<td>
    <fmt:formatNumber value="${amount}" type="currency"/>
</td>

-ed

On 1/23/06, fea jabi <zy...@hotmail.com> wrote:
> would like to display the value of property amount as $10,00,000. tried
> using the below.
>
> But getting an error/ it doesn't get displayed.
>
> Is this the way to do this. Or is there an easier way to do the same?
>
>
> <td>
>       <bean:define id="amt"><html:text name="Form1" property="amount"
> styleClass="invisibleInput" readonly="true" tabindex="-1"/></bean:define>
>       <% System.out.println(amt);%>
>       <fmt:formatNumber value="${amt}" type="currency"/>
> </td>
>
>
> Thanks.
>
> _________________________________________________________________
> Is your PC infected? Get a FREE online computer virus scan from McAfee(r)
> Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


--
    "The greatest tyrannies are always perpetrated in the name of the
noblest causes." Thomas Paine
    "Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety" - Benjamin
Franklin

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