 |
 |
等 级:列兵 |
 |
经 验:498 |
 |
性 别:帅哥 |
 |
文 章:138 |
 |
精 华:0 |
|
|
|
1.Engine类
public class TBaseEngine extends BaseEngine{
/**
* 根据传递进来的页面名称,返回一个PageLink方式的url,配合RedirectException即可完成PageLink跳转。
*
* @param pageName
* 页面名称
* @return
*/
@SuppressWarnings( { "deprecation", "unchecked" })
public String getPageLinkUrl(String pageName) {
IEngineService service = this.getService(Tapestry.PAGE_SERVICE);
Map parameters = new HashMap();
parameters.put(ServiceConstants.PAGE, pageName);
return this.getInfrastructure().getLinkFactory().constructLink(service,
false, parameters, true).getURL();
}
}
2.
在登陆页LoginPage.java使用
public abstract class LoginPage extends BasePage implements PageBeginRenderListener,PageValidateListener{
.....
//下面是LoginPage.java的135行,出错误在这里
String url = ((TBaseEngine) cycle.getPage().getEngine()).getPageLinkUrl("MainPage");
throw new RedirectException(url);
...
}
3.
MainPage.page
<page-specification class="com.longcredit.KEye.app.business.LoginPage">
....以下无关省略
4.问题:
在LoginPage.java使用 //ActPage page = (ActPage) cycle.getPage("MainPage");都是正常的,今天顺手写了个避免重复提交的实现,经常写,反而出错了
下面是错误:
| org.apache.tapestry.BindingException |
| Exception invoking listener method loginSubmit of component Login: Failure invoking listener method 'public org.apache.tapestry.IPage com.longcredit.KEye.app.business.LoginPage.loginSubmit(org.apache.tapestry.IRequestCycle)' on $LoginPage_0@79dbc7[Login]: org.apache.tapestry.engine.BaseEngine |
| binding: |
org.apache.tapestry.binding.ListenerMethodBinding@205b65[parameter listener, component=Login, methodName=loginSubmit, location=context:/WEB-INF/Login.page, line 8, column 64] |
| component: |
$LoginPage_0@79dbc7[Login] |
| location: |
context:/WEB-INF/Login.page, line 8, column 64
| 3 |
"-//Apache Software Foundation//Tapestry Specification 4.0//EN" |
| 4 |
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd"> |
| 5 |
<page-specification class="com.longcredit.KEye.app.business.LoginPage"> |
| 6 |
|
| 7 |
<component id="loginForm" type="Form"> |
| 8 |
<binding name="listener" value="listener:loginSubmit"/> |
| 9 |
</component> |
| 10 |
|
| 11 |
<component id="username" type="TextField"> |
| 12 |
<binding name="value" value="username"/> |
| 13 |
</component> |
|
| |
| org.apache.hivemind.ApplicationRuntimeException |
| Failure invoking listener method 'public org.apache.tapestry.IPage com.longcredit.KEye.app.business.LoginPage.loginSubmit(org.apache.tapestry.IRequestCycle)' on $LoginPage_0@79dbc7[Login]: org.apache.tapestry.engine.BaseEngine |
| component: |
$LoginPage_0@79dbc7[Login] |
| location: |
context:/WEB-INF/Login.page, line 5, column 72
| 1 |
<?xml version="1.0" encoding="GB2312"?> |
| 2 |
<!DOCTYPE page-specification PUBLIC |
| 3 |
"-//Apache Software Foundation//Tapestry Specification 4.0//EN" |
| 4 |
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd"> |
| 5 |
<page-specification class="com.longcredit.KEye.app.business.LoginPage"> |
| 6 |
|
| 7 |
<component id="loginForm" type="Form"> |
| 8 |
<binding name="listener" value="listener:loginSubmit"/> |
| 9 |
</component> |
| 10 |
|
|
| |
| java.lang.ClassCastException |
| org.apache.tapestry.engine.BaseEngine |
| Stack Trace: |
- com.longcredit.KEye.app.business.LoginPage.loginSubmit(LoginPage.java:135)
- sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- java.lang.reflect.Method.invoke(Method.java:585)
为什么总显示类型不匹配啊,我的也面类 类型是一致的
|
|
|
|
|
|