火星文 技术研习社

Noname Cat, Keep Thinking
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

JSP TagLib 异常 Unable to find setter method for attribute: scope

Posted on 2007-08-12 20:32  剑廿三  阅读(2976)  评论(0编辑  收藏  举报
问题假设有一个自定义 JspTag 包含一个名为 scope 的属性,运行时应用服务器抛出 Unable to find setter method for attribute: scope 异常

1. 检查 tld 配置文件有否写对 scope 属性

2. 重点:检查 tag 类该属性的 getter & setter ,看看是否有如下方法:

public void setScope(String scope);

如果有 getScope() 方法,其返回值只能是 String 而不是其他类型。譬如以下的 getter 是错的:

public StorageScope getScope();

请把这个方法重命名。