customtagの使用に問題があります
これは私のtagCalendarです
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>tagCalendar</shortname>
<info>Custom Tag Visualizzazione Lista Calendari</info>
<tag>
<name>tagCalendar</name>
<tagclass>it.postecom.postesalute.tag.TagCalendar</tagclass>
<bodycontent>empty</bodycontent>
<info>Custom Tag Visualizzazione Lista Calendari</info>
<attribute>
<name>pageRedirect</name>
<required>true</required>
</attribute>
<attribute>
<name>collectionCalendar</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute><attribute>
<name>actionUrl</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
これは私のJSPスニペットです
<ct:tagCalendar actionUrl="<portlet:actionURL/>" pageRedirect="viewPage" collectionCalendar="<%=QueryCalendar.getUserCalendars(JodUtil.getToken(request))%>" />
およびTagCalendar.javaのdoStartTagメソッド
try {
JspWriter out = pageContext.getOut();
Iterator iter = collectionCalendar.iterator();
ArrayList <JodBaseCalendar>userCalendarList = new ArrayList<JodBaseCalendar>();
int cnt = 0;
while (cnt <= 3) {
userCalendarList.add((JodBaseCalendar) iter.next());
cnt++;
}
out.println("<table>");
for(JodBaseCalendar calendar:userCalendarList){
out.println("<tr>");
out.println("<a href='"+actionUrl +"?forwardTo="+pageRedirect+"&calendarId="+ calendar.getCalendarId()+"'>");
out.println("["+calendar.getCalendarId()+" - "+calendar.getCalendarSubject()+"]");
out.println("</a>");
out.println("</tr>");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return TagSupport.SKIP_BODY;
タグはアクションに変換されませんが、文字列のように使用されます。