Discussion:
[Middlegen-user] RE: Middlegen generated Stuts Action
Aslak Hellesoy
2003-01-05 20:34:03 UTC
Permalink
-----Original Message-----
Sent: 5. januar 2003 22:09
To: Aslak_Hellesoy
Subject: Middlegen generated Stuts Action
Hello Aslak,
My apologies if this is not the correct way to
communicate with you, but, whenever I use Middlegen to
Please only contact me privately if you want to discuss delicate top secret
matters. For anything Middlegen related, please use
middlegen-***@lists.sf.net. I'm cc'ing this to the list in the hope that I
haven't disclosed delicate information ;-)
generate Struts form beans it also generate action
classes and that's OK. But, the action classes alway
fail to compile because they always generate code like
// Create a primary key to look up
java.lang.Integer calcid = new
java.lang.Integer(getParameter(request, "calcid) );
org.kumasi.net.dube.interfaces.CalculatorPK
calculator_PK = new
org.kumasi.net.dube.interfaces.CalculatorPK(new
java.lang.Integer(calcid) );
This only seems to occur when the Data type is
Integer, Double, Float, or BigDecimal. If the data
type is String, int, float, double then it works OK.
But my company's position is that we cannot use
primitives for primary key representation is
dataobject or valueobject, instead we must use
classes, hence the use of Integer rather than int.
This causes the build to fail on the first run, and I
have to go through all the Struts actions and make a
// Create a primary key to look up
java.lang.Integer calcid = new
java.lang.Integer(getParameter(request, "calcid) );
org.kumasi.net.dube.interfaces.CalculatorPK
calculator_PK = new
org.kumasi.net.dube.interfaces.CalculatorPK(calcid);
Can you fix this or tell me how I can avoid this and
still have primary key types of Classes.
The docs warn you about the Struts plugin:
http://boss.bekk.no/boss/middlegen/plugins/struts.html

I'm too busy to fix this any time soon, so I suggest you try to fix it
yourself. The files you want to fix at are edit-action.vm, view-action.vm
and delete-action.vm.

The problem is that constructors for different classes take different kinds
of parameters, and I haven't figured out a good way to make it generic
enough. So for some types you'll get compile errors.

Get the CVS version and do your changes there. If you manage to make
something to work, I'd appreciate that you prepare a patch and submit it on
the SF patches page.

Sorry I'm not able to be of more help on this one right now.

Aslak
Thanks,
Darryl
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
Loading...