Re: T5: Coercion of null to type java.math.BigDecimal (via null -- String, String -- java.math.BigDecimal) failed: java.lang.NullPointerException

2007-08-26 Thread Denny
I am sure my BigDecimal translator is no problem, I have fixed this problem
by modify the Tapestry ioc's source code. ok, here is my translator.


   1. package com.javaeye.dengyin2000.gtts.tapestry;
   2.
   3. import java.math.BigDecimal;
   4.
   5. import org.apache.tapestry.Translator;
   6. import org.apache.tapestry.ValidationException;
   7. import org.apache.tapestry.ioc.Messages;
   8. import org.apache.tapestry.ioc.internal.util.InternalUtils;
   9.
   10. public class BigDecimalTranslator implements
TranslatorBigDecimal {
   11.
   12. public
BigDecimal parseClient(String clientValue, Messages messages)
   13. throws ValidationException {
   14. if (InternalUtils.isBlank(clientValue))
   15. return null;
   16.
   17. try
   18. {
   19. return new BigDecimal(clientValue.trim());
   20. }
   21. catch (NumberFormatException ex)
   22. {
   23. throw new ValidationException(messages.format(
   number-format-exception, clientValue));
   24. }
   25. }
   26.
   27. public String toClient(BigDecimal value) {
   28. return value == null ?  : value.toString();
   29. }
   30.
   31. }

and in AppModule.java


   1. public static void contributeTranslatorDefaultSource(
   2. MappedConfigurationClass, Translator configuration)
   3. {
   4. configuration.add(BigDecimal.class, new
BigDecimalTranslator());
   5. }
   6.
   7. public static void contributeTranslatorSource(
   8. MappedConfigurationString, Translator configuration)
   9. {
   10. configuration.add(bigdecimal,  new
BigDecimalTranslator());
   11. }

It's a real bug in tapestry ioc 5.0.5.


   1.
   // String to BigDecimal is important, as String-Double-BigDecimal
would lose

   2. // precision.
   3.
   4. add(configuration, String.class, BigDecimal.class, new
CoercionString, BigDecimal()
   5. {
   6. public BigDecimal coerce(String input)
   7. {
   8. return new BigDecimal(input);
   9. }
   10.

So I modify code to :


   1.
   // String to BigDecimal is important, as String-Double-BigDecimal
would lose

   2. // precision.
   3.
   4. add(configuration, String.class, BigDecimal.class, new
CoercionString, BigDecimal()
   5. {
   6. public BigDecimal coerce(String input)
   7. {
   8. if (input == null || input.trim().length() == 0)
   9. return null;
   10. return new BigDecimal(input);
   11. }
   12. });


And the problem has gone.




On 8/27/07, Nick Westgate [EMAIL PROTECTED] wrote:

 Please show the code for your translator.

 Cheers,
 Nick.


 Denny wrote:
  I have contribute a BigDecimal translator, Yes, I know it's a T5 bug and
 it
  would be fix in version 5.0.6. I searched tapestry mailling list, but I
  haven't gotten the answer. Does anybody know how to fix it? do your guys
  don't meet this problem. Or I should modify the T5.0.5' source code?
 
  Thanks.
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Regards

Denny
Site: http://dengyin2000.javaeye.com


T5: Coercion of null to type java.math.BigDecimal (via null -- String, String -- java.math.BigDecimal) failed: java.lang.NullPointerException

2007-08-25 Thread Denny
I have met the T5's bug, https://issues.apache.org/jira/browse/TAPESTRY-1648

I have a domain class, which has a BigDecimal property. While I submit form,
it would happen the bug TAPESTRY-1648.

Caused by: org.apache.tapestry.ioc.internal.util.TapestryException: Failure
writing parameter value of component
basicinformation/AddOrEditDriver:carlong: Coercion of null to type
java.math.BigDecimal (via null -- String, String -- java.math.BigDecimal)
failed: java.lang.NullPointerException [at
classpath:com/javaeye/dengyin2000/gtts/pages/basicinformation/AddOrEditDriver.html,
line 50, column 115]
at
org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.writeParameter
(InternalComponentResourcesImpl.java:239)
at
org.apache.tapestry.corelib.base.AbstractTextField._$update_parameter_value(
AbstractTextField.java)
at org.apache.tapestry.corelib.base.AbstractTextField.processSubmission(
AbstractTextField.java:181)
at org.apache.tapestry.corelib.base.AbstractField.processSubmission(
AbstractField.java:200)
at org.apache.tapestry.corelib.base.AbstractField.access$100(
AbstractField.java:45)
at
org.apache.tapestry.corelib.base.AbstractField$ProcessSubmissionAction.execute
(AbstractField.java:114)
at
org.apache.tapestry.corelib.base.AbstractField$ProcessSubmissionAction.execute
(AbstractField.java:108)
at org.apache.tapestry.corelib.components.Form.onAction(Form.java:364)
... 45 more
Caused by: java.lang.RuntimeException: Coercion of null to type
java.math.BigDecimal (via null -- String, String -- java.math.BigDecimal)
failed: java.lang.NullPointerException
at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(
TypeCoercerImpl.java:154)
at $TypeCoercer_1149d2e0ddf.coerce($TypeCoercer_1149d2e0ddf.java)
at
org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.writeParameter
(InternalComponentResourcesImpl.java:233)
... 52 more
Caused by: java.lang.NullPointerException
at java.math.BigDecimal.init(BigDecimal.java:594)
at org.apache.tapestry.ioc.services.TapestryIOCModule$7.coerce(
TapestryIOCModule.java:219)
at org.apache.tapestry.ioc.services.TapestryIOCModule$7.coerce(
TapestryIOCModule.java:217)
at org.apache.tapestry.ioc.services.CoercionTuple$CoercionWrapper.coerce
(CoercionTuple.java:53)
at org.apache.tapestry.ioc.internal.services.CompoundCoercion.coerce(
CompoundCoercion.java:48)
at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(
TypeCoercerImpl.java:150)
... 54 more

I have contribute a BigDecimal translator, Yes, I know it's a T5 bug and it
would be fix in version 5.0.6. I searched tapestry mailling list, but I
haven't gotten the answer. Does anybody know how to fix it? do your guys
don't meet this problem. Or I should modify the T5.0.5' source code?

Thanks.

-- 
Regards

Denny
Site: http://dengyin2000.javaeye.com


Re: T5 developing with WTP and TOMCAT

2007-08-16 Thread Denny
Ok, now, I am using jettylauncher eclipse plugin to develop T5. I hope T5
can fix the problem about working with tomcat. There are many people using
tomcat for develop and product.

On 8/15/07, Denny deng [EMAIL PROTECTED] wrote:


 Hi,

 I develop with WTP and TOMCAT. If I set the tomcat don't auto-reload,
 tapestry5 can take the changes of html template, while it can't take the
 chages of page class. It make the hot code replace failed. However, If I
 enable tomcat auto-reload. tapestry can take both html template and page
 class changes. But, it will cause tomcat reload the context. It's very
 slow,
 and after some times, it will cause tomcat out of memory. I know using
 Jetty
 servlet container will be fine. But I like developing with eclipse WTP.

 So I like the way of T3, T4, just add a java system property.
 -Dorg.apache.tapestry.disable-caching=true. It would be fine. just a bit
 slow while reload the page.
 --
 View this message in context:
 http://www.nabble.com/T5-developing-with-WTP-and-TOMCAT-tf4273924.html#a12164566
 Sent from the Tapestry - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Regards

Denny
Site: http://dengyin2000.javaeye.com


T5 developing with WTP and TOMCAT

2007-08-15 Thread Denny deng

Hi,

I develop with WTP and TOMCAT. If I set the tomcat don't auto-reload,
tapestry5 can take the changes of html template, while it can't take the
chages of page class. It make the hot code replace failed. However, If I
enable tomcat auto-reload. tapestry can take both html template and page
class changes. But, it will cause tomcat reload the context. It's very slow,
and after some times, it will cause tomcat out of memory. I know using Jetty
servlet container will be fine. But I like developing with eclipse WTP.

So I like the way of T3, T4, just add a java system property.
-Dorg.apache.tapestry.disable-caching=true. It would be fine. just a bit
slow while reload the page.
-- 
View this message in context: 
http://www.nabble.com/T5-developing-with-WTP-and-TOMCAT-tf4273924.html#a12164566
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T5 developing with WTP and TOMCAT

2007-08-14 Thread Denny
Hi,

I develop with WTP and TOMCAT. If I set the tomcat don't auto-reload,
tapestry5 can take the changes of html template, while it can't take the
chages of page class. It make the hot code replace failed. However, If I
enable tomcat auto-reload. tapestry can take both html template and page
class changes. But, it will cause tomcat reload the context. It's very slow,
and after some times, it will cause tomcat out of memory. I know using Jetty
servlet container will be fine. But I like developing with eclipse WTP.

So I like the way of T3, T4, just add a java system property. -
Dorg.apache.tapestry.disable-caching=true. It would be fine. just a bit slow
while reload the page.

-- 
Regards

Denny
Site: http://dengyin2000.javaeye.com


Re: [T5] Submit control event handler cannot redirect?

2007-08-08 Thread Denny
The error message is clear. This type of event does not support return
values from
event handler methods.

Please take a look at http://wiki.apache.org/tapestry/Tapestry5HowToUseForms

Dealing with multiple submits Capter.


On 8/8/07, Kolesnikov, Alexander GNI [EMAIL PROTECTED] wrote:

 I am playing with a simple T5 application that has two pages: Start and
 Another.

 The Start page contains the following:

 p
 a href=# t:type=ActionLink t:id=actionRedirectDisplay
 Another page/a
 /p
 t:form t:id=theForm
 input type=submit value=Submit/
 t:submit t:id=submitRedirect value=Submit Redirect/
 /t:form

 And here is the page class contents:

 @InjectPage
 private Another anotherPage;

 @OnEvent(value=submit, component=theForm)
 Object onFormRedirect() {
 return anotherPage;
 }

 @OnEvent(component=actionRedirect)
 Object onActionRedirect() {
 return anotherPage;
 }

 @OnEvent(component=submitRedirect)
 Object onSubmitRedirect() {
 return anotherPage;
 }

 So basically the Start page provides three ways to navigate to Another
 page: by submitting the form (using HTML input type=submit), by
 clicking on the ActionLink and by by clicking on the Sunmit component.
 The latter, however, produces exception with the following message:

 Event 'selected' from Start:submitredirect received an event handler
 method return value of [EMAIL PROTECTED]
 from com.packtpub.foundations.pages.Start.onSubmitRedirect() (at
 Start.java:56). This type of event does not support return values from
 event handler methods.

 For me, this looks inconsistent. Okay, Submit control generates
 'selected' event, not 'submit', not 'action', but wouldn't it be natural
 to be able to navigate to another page as a result of a Submit button
 press?

 Thanks,

 Alexander



 --
 CONFIDENTIALITY NOTICE: If you have received this email in error, please
 immediately notify the sender by e-mail at the address shown.  This email
 transmission may contain confidential information.  This information is
 intended only for the use of the individual(s) or entity to whom it is
 intended even if addressed incorrectly.  Please delete it from your files if
 you are not the intended recipient.  Thank you for your
 compliance.  Copyright 2007 CIGNA

 ==




-- 
Regards

Denny
Site: http://dengyin2000.javaeye.com