You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jolly <jo...@mislbd.com> on 2004/04/03 08:57:43 UTC

integer validation problem

Hi please help me.  My form-bean declaration is like this
<form-bean name="payScaleForm"
type="com.mislbd.iris.util.CustomDynaActioForm">
      <form-property name="payScaleDTO"
type="com.mislbd.iris.hr.core.compensation.PayScaleDTO" />

and PayScaleDTO has incrementDTO as its attribute.
I define my jsp as:
<layout:text  key="payScale.basicPay" property="payScaleDTO.basicPay"
styleClass="LABEL" isRequired="true"/>
           <layout:text  key="payScale.Increment.firstCategoryAmount"
property="payScaleDTO.increment.firstCategoryAmount" styleClass="LABEL"
isRequired="true"/>

basicPay and firstCategoryAmount are defined as integer or double. But
this fields are not validated if i enter text and saved zero to
database. I cant use copyproperties of beanutils because of the ha a
relationship. I dont want to write another actionForm class that
represent my DTO. How can I solve my problem. please help me. I am in
great trouble.
JOlly 
--
jolly


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


Re: integer validation problem

Posted by jolly <jo...@mislbd.com>.
Dear Richard
 Thanks for your reply. But I dont want to declare this type of
variable as String. I want to use the DTO as form bean 
property. For this it is not validated by validator. so I 
have to make my DTO dirtty that is I have to declare another
attribute for all variables that are not String. And I
pass that String attribute to the jsp and then I set the 
validated value to my integer or double variable. This 
type of solution cant satisfy me. I dont want to write
another bean form class. So I have to comprise myself 
with that solution.
thanks again for your help
-jolly 

On Sat, 03 Apr 2004 12:16:35 -0800, Richard Yee wrote
> Jolly,
> If you had checked the archives, you would have found your answer 
> immediately since this topic has come up several times in the past 
> two weeks. Anyway, declare your firstCategoryAmount and incrementDTO 
> attributes as Strings instead of int and double.
> 
> -Richard
> 
> At 10:57 PM 4/2/2004, you wrote:
> 
> >Hi please help me.  My form-bean declaration is like this
> ><form-bean name="payScaleForm"
> >type="com.mislbd.iris.util.CustomDynaActioForm">
> >       <form-property name="payScaleDTO"
> >type="com.mislbd.iris.hr.core.compensation.PayScaleDTO" />
> >
> >and PayScaleDTO has incrementDTO as its attribute.
> >I define my jsp as:
> ><layout:text  key="payScale.basicPay" property="payScaleDTO.basicPay"
> >styleClass="LABEL" isRequired="true"/>
> >            <layout:text  key="payScale.Increment.firstCategoryAmount"
> >property="payScaleDTO.increment.firstCategoryAmount" styleClass="LABEL"
> >isRequired="true"/>
> >
> >basicPay and firstCategoryAmount are defined as integer or double. But
> >this fields are not validated if i enter text and saved zero to
> >database. I cant use copyproperties of beanutils because of the ha a
> >relationship. I dont want to write another actionForm class that
> >represent my DTO. How can I solve my problem. please help me. I am in
> >great trouble.
> >JOlly
> >--
> >jolly
> >
> >
> >---------------------------------------------------------------------
> >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


--
jolly


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


Re: integer validation problem

Posted by Richard Yee <ry...@cruzio.com>.
Jolly,
If you had checked the archives, you would have found your answer 
immediately since this topic has come up several times in the past two 
weeks. Anyway, declare your firstCategoryAmount and incrementDTO attributes 
as Strings instead of int and double.

-Richard

At 10:57 PM 4/2/2004, you wrote:

>Hi please help me.  My form-bean declaration is like this
><form-bean name="payScaleForm"
>type="com.mislbd.iris.util.CustomDynaActioForm">
>       <form-property name="payScaleDTO"
>type="com.mislbd.iris.hr.core.compensation.PayScaleDTO" />
>
>and PayScaleDTO has incrementDTO as its attribute.
>I define my jsp as:
><layout:text  key="payScale.basicPay" property="payScaleDTO.basicPay"
>styleClass="LABEL" isRequired="true"/>
>            <layout:text  key="payScale.Increment.firstCategoryAmount"
>property="payScaleDTO.increment.firstCategoryAmount" styleClass="LABEL"
>isRequired="true"/>
>
>basicPay and firstCategoryAmount are defined as integer or double. But
>this fields are not validated if i enter text and saved zero to
>database. I cant use copyproperties of beanutils because of the ha a
>relationship. I dont want to write another actionForm class that
>represent my DTO. How can I solve my problem. please help me. I am in
>great trouble.
>JOlly
>--
>jolly
>
>
>---------------------------------------------------------------------
>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: 'anonymous' role

Posted by Bill Siggelkow <bi...@bellsouth.net>.
You are essentialy correct, Mohan.  CMA is not come into play unless the 
user attempts access to a protected resource.  One thing you could do 
was assume that if 'getUserPrincipal()' returns null then the user has 
not logged in and is therefore in the 'anonymous' role.

If you want more flexibility and still want to use the "isUserInRole" 
method you might want to look into Security Filter 
(http://securityfilter.sourceforge.net).
MOHAN RADHAKRISHNAN wrote:
> Hi
>        In our current CMA implementation for role check , we have an
> 'anonymous' role. Now this role is supposed to work without logging into the
> application. Do you have any idea how to implement this ?
> 
>         As far as I know there is no CMA without logging in and so I have to
> block the call in the filter and duplicate lot of code and divert the hit.
> 
> Any ideas ?
> 
> Mohan


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


Re: 'anonymous' role

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
On 04/03/2004 01:56 PM MOHAN RADHAKRISHNAN wrote:
> Hi
>        In our current CMA implementation for role check , we have an
> 'anonymous' role. Now this role is supposed to work without logging into the
> application. Do you have any idea how to implement this ?
> 
>         As far as I know there is no CMA without logging in and so I have to
> block the call in the filter and duplicate lot of code and divert the hit.
> 
> Any ideas ?

I think this is a feature that is lacking in tomcat - or rather in the 
servlet spec.

In a J2EE EJB container environment, I believe non-logged-in users have 
the role 'anonymous' (or is it just the principal?)

Obviously this doesn't help you but it demonstrates that the EJB 
specification authors envisaged this as a problem needing a solution, so 
perhaps in the future, the servlet container will also allow this.

In the meantime, you could write wrappers for HttpServletRequest so that 
you can override the isUserInRole method, and apply them via a filter.

Adam

-- 
struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian


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


'anonymous' role

Posted by MOHAN RADHAKRISHNAN <mr...@cellexchange.com>.
Hi
       In our current CMA implementation for role check , we have an
'anonymous' role. Now this role is supposed to work without logging into the
application. Do you have any idea how to implement this ?

        As far as I know there is no CMA without logging in and so I have to
block the call in the filter and duplicate lot of code and divert the hit.

Any ideas ?

Mohan


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