or wrappers (like Double instead of double). That works fine with BeanUtils
as well...

Eelco

----- Original Message ----- 
From: "Kimberley Scott" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 19, 2003 3:54 PM
Subject: [Mav-user] FW: Newbie: Setters appear to not being called...




Argggghhh I'm just dense as three inch hard wood...

I had been converting an existing system over to maverick and copied the
existing beans into controller/models. Look at these setters/getters:

protected double term = 0d;
public void setTerm(String value) { this.term = stringToDouble(value); }
public void setTerm(double value) { this.term = value; }
public double getTerm() { return this.term; }

Switch to Strings only and everything works fine. Bloody obvious. :-0

<nationality mode="Australian">
Whaddareyer? An idyut, arnt yer?
</nationality>

Sorry to bug anybody...

Ms Kimberley Scott
Senior Software Engineer
DCG Media Ltd

-----Original Message-----
From: Kimberley Scott
Sent: 19 June 2003 13:09
To: '[EMAIL PROTECTED]'
Cc: Kimberley Scott
Subject: Newbie: Setters appear to not being called...


Hiya,

Just started using maverick. Luv it. Gotta slight problem and feeling I'm
going mad. I think I've got it wrong about how you extend controllers. I
have this app I'm building, and have a problem where the setters for form
variables are not being called. I just know I'm doing something wrong, but
can't see where, and I've re-read the manual supplied (thankyou guys) and
studied the 'pig' with no luck. I've got cut-down code below and would love
any help people can give me:

classes:
public class ControllerErrorable extends ThrowawayBean2
{
... hasErrors, getErrors etc...
}

public class Menu extends ControllerErrorable
{
...setters and getters for some menu stuff...
protected String perform()
throws Exception
{
super.perform();
...other stuff
}
}

public class Calculator extends Menu
{
...setters and getters for special calculations...
...and also:
public void setTerm(String value)
{
System.out.println("Hey! How come I'm not being called?");
this.term = stringToDouble(value);
}
protected String perform()
throws Exception
{
super.perform();
...other stuff
}
}

maverick.xml:
<command name="calculator">
<controller class="com.dcg.ctl.Calculator" />
<view name="success" path="tools/calculator.jsp">
<transform path="outerPageWrapper.jsp"/>
</view>
</command>

tools/calculator.jsp:
<form blah blah>
...other input...
<input
type="text"
name="term"
size="4"
maxlength="4"
value="<c:out value="${model.longTerm}"/>" />
...submit...
</form>

I must be doing something seriously wrong here, because when I call
'calculator.m', the tools/calculator.jsp runs ok. I fill in a value for the
input field 'term', and click submit. The 'Menu' class appears to have it's
setters and it's perform() called fine. What doesn't seem to be happening is
the call to setTerm(String value) within the Calculator controller.

I iterated over the Request and get this:

(iterating over the request parameters)
12:48:23,579 INFO  [STDOUT] [product] == [bnpl]
12:48:23,579 INFO  [STDOUT] [period] == [0]
12:48:23,579 INFO  [STDOUT] [amount] == [0]
12:48:23,579 INFO  [STDOUT] [action] == [obq]
12:48:23,579 INFO  [STDOUT] [deposit] == []
12:48:23,589 INFO  [STDOUT] [term] == [36] <<===
12:48:23,589 INFO  [STDOUT] [apr] == []

(then called getAction() and getTerm() deliberately within perform() within
the Calculator class)
12:48:23,579 INFO  [STDOUT] action==[obq]
12:48:23,579 INFO  [STDOUT] term==[0.0] <<==

So 'term' is being sent through. I'm stumped and feeling a tad dim. Can
anyone help?

Ms Kimberley Scott
Senior Software Engineer
DCG Media Ltd


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
[INVALID FOOTER]



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
[INVALID FOOTER]

Reply via email to