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

Reply via email to