我正在尝试使用重载方法在Grails 2.3.4中的控制器中附加
XML.
我在ReportController中有以下重载方法.
String makePhotoXml(StringBuilder sb,Report r,String url,String desc) { sb.append("<photo>") sb.append(Utilities.makeElementCdata("url",url)) sb.append(Utilities.makeElementCdata("caseId",r.caseId)) sb.append(Utilities.makeElementCdata("type",r.type)) sb.append(Utilities.makeElementCdata("date",r.dateCreated.format('MM/dd/yy'))) sb.append(Utilities.makeElementCdata("address",r.address)) sb.append("<extra>extra</extra>") sb.append(Utilities.makeElementCdata("description",desc)) sb.append("</photo>") } String makePhotoXml(List<Report> reports) { StringBuilder sb = new StringBuilder() sb.append("<photos>") sb.append("<title>Photos</title>") for (Report r : reports) { for (Photo photo : r.photos) { makePhotoXml(sb,r,photo.url(),photo.description) } for (Document doc : r.photodocuments) { makePhotoXml(sb,doc.url(-1),doc.getDescription()) } } sb.append("</photos>") }
运行应用程序时,我收到此编译器错误:
| Error Compilation error: startup Failed: /Users/Anthony/GrailsApps/AppOrderWeb/grails-app/controllers/com/apporder/ReportController.groovy: 1360: Controller actions may not be overloaded. The [makePhotoXml] action has been overloaded in [com.apporder.ReportController]. @ line 1360,column 5. String makePhotoXml(StringBuilder sb,String desc) {
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。