You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by TNO <tn...@free.fr> on 2008/08/28 14:53:15 UTC

T5.0.14 - OnActivate problem and coercion error

Hello,

here's my problem :

the short exception

ERROR 14:28:02.703 Processing of request failed with uncaught exception: 
Exception in method org.atlog.mjweb.base.BaseInfo.onActivate(long) (at 
BaseInfo.java:15), parameter #1: Coercion of xfade2.css to type 
java.lang.Long (via String --> Long) failed: For input string: 
"xfade2.css"  (DefaultRequestExceptionHandler.java:54)
org.apache.tapestry5.runtime.ComponentEventException: Exception in 
method org.atlog.mjweb.base.BaseInfo.onActivate(long) (at 
BaseInfo.java:15), parameter #1: Coercion of xfade2.css to type 
java.lang.Long (via String --> Long) failed: For input string: "xfade2.css"
    at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1054)
 at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
...

my component

@IncludeJavaScriptLibrary("classpath:org/atlog/mjweb/components/xfade2.js")
@IncludeStylesheet("classpath:org/atlog/mjweb/components/xfade2.css")
public class Bandeau extends BasePage {

    public Info getInfo() {
        return getOneInfo("BANDEAU");
    }

}


my class BaseInfo

public class BaseInfo extends BasePage {

    private Info _info;

    void onActivate(long idInfo) {
        _info = findById(idInfo);
    }

    Object[] onPassivate() {
        Object[] o = new Object[2];
        o[0] = _info.getIdInfo();
        o[1] = getUrlName(_info.getTitre());
        return o;
    }

    private Info findById(Long idInfo) {
        return getDAO().getInfoDAO().get(idInfo);
    }

    public Info getInfo() {
        return _info;
    }

}

my page class

public class MandatInfo extends BaseInfo {
  
}


My component "Bandeau" is included in my "MandatInfo" page.

I don't understand what's wrong...
Is there a problem whith @IncludeStylesheet ?

thanks for help



---
Antivirus avast! : message Sortant sain.
Base de donnees virale (VPS) : 080827-0, 27/08/2008
Analyse le : 28/08/2008 14:53:16
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


[RESOLVED] Re: T5.0.14 - OnActivate problem and coercion error

Posted by TNO <tn...@free.fr>.
I resolve the problem !!!
But, in my case, it is not a classic problem !

Because my problem come from javascript code :

In an onload fonction, I found this code :

    // http://slayeroffice.com/code/imageCrossFade/xfade2.css
    //css = d.createElement("link");
    //css.setAttribute("href","xfade2.css");
    //css.setAttribute("rel","stylesheet");
    //css.setAttribute("type","text/css");
    //d.getElementsByTagName("head")[0].appendChild(css);

So my java code was OK, my application work but I have some exceptions 
trace. I remove the javascript code and now it's OK

Thanks

Szemere Szemere a écrit :
> This is a classic problem.  The path to your assets is shifted by one level
> because of the parameter you are passing.
>
> Not sure of the fix for your specific case, but if you referenced an asset
> like this in a .tml, you would use
> href="${asset:context:org/atlog/mjweb/components/xfade2.css}"
>
> HTH,
> Szemere
>
>   


---
Antivirus avast! : message Sortant sain.
Base de donnees virale (VPS) : 080828-0, 28/08/2008
Analyse le : 29/08/2008 12:17:04
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.0.14 - OnActivate problem and coercion error

Posted by Szemere Szemere <sz...@googlemail.com>.
This is a classic problem.  The path to your assets is shifted by one level
because of the parameter you are passing.

Not sure of the fix for your specific case, but if you referenced an asset
like this in a .tml, you would use
href="${asset:context:org/atlog/mjweb/components/xfade2.css}"

HTH,
Szemere