I think it's a bug; I believe there's an error related to the
RequestPathOptimizer ... the code that generates relative URLs from
Link instances; I think there's a bug there related to a trailing
slash in the request. I noticed it because with a trailing slash,
relative URLs to assets are often broken.
On Fri, Apr 4, 2008 at 10:16 AM, Peter Beshai <[EMAIL PROTECTED]> wrote:
> I think this may work (as a workaround at least):
>
> public class Start
> {
> private Integer _result;
> public Integer getResult() {
> return _result;
> }
>
> public void setResult(Integer result) {
> _result = result;
> }
> Integer onPassivate() {
> return _result;
> }
> Object onActivate(Integer result) {
> _result = result;
> if(result != null)
> return null; // continue activating the page with context
> else
> return Start.class; // since the context is invalid, return
> the page without context. This may happen automatically if you just change
> the int to Integer and leave this method untouched, but I'm unsure.
> }
> }
>
>
> Peter Beshai
>
>
>
>
> On Thu, Apr 3, 2008 at 6:25 AM, dhning <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > I get a intersting problem:
> >
> > Start.java:
> > public class Start
> > {
> > private int _result;
> > public int getResult() {
> > return this._result;
> > }
> >
> > public void setResult(int result) {
> > _result = result;
> > }
> > int onPassivate() {
> > return _result;
> > }
> > void onActivate(int result) {
> > _result = result;
> > }
> > }
> >
> > Start.tml
> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> > <head>
> > <title>t5first Start Page</title>
> > </head>
> > <body>
> > <h1>t5first Start Page</h1>
> >
> > <a href="#" t:type="actionlink" t:id="view">View</a>
> >
> > </body>
> > </html>
> >
> > Steps:
> > When inputting url such as /t5start/start, no problem. But when I input
> > url /t5start/start/ (pay attention to this redundant /), the href of
> > actionlink component will be rendered as "
> > http://localhost:8080/t5first/start/start.view?t:ac=0", then I click on
> > "view" link, exception happens.
> > a.. org.apache.tapestry.runtime.ComponentEventException
> > Exception in method com.yanziwang.pages.Start.onActivate(int) (at
> > Start.java:34), parameter #1: Coercion of start.view to type
> > java.lang.Integer (via String --> Long, Long --> Integer) failed: For input
> > string: "start.view"
> > context
> > a.. start.view
> > eventType
> > activate
> > a.. java.lang.NumberFormatException
> > For input string: "start.view"
> >
> > The correct url of view component should be "
> > http://localhost:8080/t5first/start.view?t:ac=0"
> >
> > How to handle such problems, please help.
> >
> > Thanks!
> > DH
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]