Converting between strings and dates is too finicky for Tapestry to
handle automatically (without screwing it up for some people).

Instead of including the Dates as event context values,, try
converting them to long values (seconds since "the epoch") and then
convert them back to usable Dates inside your event handler method.

On Sun, Mar 15, 2009 at 12:22 PM, dwi ardi irawan
<[email protected]> wrote:
> hi, could anyone help me....
>
> here's my code
>
> ....
> @Persist("flash")
> @Property
> private Date twawal, twakhir;
> .....
>
> public Link getDailyChart(){
>        System.out.println(twawal); // OK
>        System.out.println(twakhir); // OK
>        return _resources.createEventLink("chart", new Object[]{"400","400",
> twawal, twakhir});
>    }
>
>    public StreamResponse onChart(final int width, final int height, final
> Date _twawal, final Date _twakhir){
>
>        return new StreamResponse(){
>            public String getContentType(){
>                return "image/gif";
>            }
>            public InputStream getStream() throws IOException {
>                BufferedImage image  =
> generateDailyChart().createBufferedImage(width, height);
>                ByteArrayOutputStream byteArray = new
> ByteArrayOutputStream() ;
>                ChartUtilities.writeBufferedImageAsPNG(byteArray, image) ;
>                return new ByteArrayInputStream(byteArray.toByteArray());
>            }
>            public void prepareResponse(Response response){}
>        };
>    }
>
> ....
>
>
> i got an error said :
> "Could not find a coercion from type java.lang.String to type
> java.util.Date.  Available coercions: Double --> Float, Float --> Double,
> Long --> Boolean, Long --> Byte, Long --> Double, Long --> Integer, Long -->
> Short, Number --> Long, Object --> Object[], Object --> String, Object -->
> java.util.List, Object[] --> java.util.List, String --> Boolean, String -->
> Double, String --> Long, String --> java.io.File, String -->
> java.math.BigDecimal, String --> java.math.BigInteger, String -->
> java.text.DateFormat"
>
> can anyone help me ?
>
>
> --
> http://www.dwiardiirawan.com
> "cos everyone could be extraordinary...lighten up !"
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to