Re: D2W Custom component
Re: D2W Custom component
- Subject: Re: D2W Custom component
- From: John Bruce <email@hidden>
- Date: Thu, 21 Apr 2005 12:18:06 +1200
I set values in my D2W components this way:
public void takeValuesFromRequest(WORequest request, WOContext
context) throws NSValidation.ValidationException {
super.takeValuesFromRequest(request, context);
if (isEdit()) {
object().takeValueForKeyPath(value, propertyKey());
}
}
also in this case I'd separate out the encrytion method and call it
directly - so for example I would have in Siteuser.java
public void encryptAndSetPassword(final String password) {
this.setPassword(transformString(password, Cipher.ENCRYPT_MODE));
}
then modify the D2W component to include:
public void takeValuesFromRequest(WORequest request, WOContext
context) throws NSValidation.ValidationException {
super.takeValuesFromRequest(request, context);
if (isEdit()) {
Siteuser user = (Siteuser)object();
user.encryptAndSetPassword(value);
}
}
I'm not sure what specifically is causing your problem without seeing
more code but the above is the way I would've implemented it.
HTH
Cheers,
John
On 4/21/05, Erwin <email@hidden> wrote:
> I am trying to use (for the 1st time) D2W to test my EOModel
> I have a D2WEditPassword custom component that's doing its job (take
> the value in a pwd Txtfield)
>
> D2WEditpassword.java (extends WOComponent)
> .....
> public String value() {
> return (String) object.valueForKey(key);
> }
> public void setValue(String newValue) {
> object.takeValueForKey(newValue, key);
> }
> .....
>
> I would like this value to be encrypted via the setPassword() in my
> Siteuser class before being written to the DB
> (as it will be in my WOApp) but I just get the String value in my
> DB..... why ? how can I do it ? (hint in doc...)
> Thanks erwin
>
> Siteuser.java (extends EOGenericRecord)
> .....
> public void setPassword(String password){
> setCredential(transformString(password, Cipher.ENCRYPT_MODE));
> }
> ....
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden