This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Question : How-to call dynamically the calendar, the name of the current page changing for each page ?#


The calendar is really interesting to filter the blogs. But the weblog plugin allows any page to start a blog: if I start a blog inside a page named MyLog, all the entries will be named MyBlog_blogentry_DDMMyy_x. I'd like the calendar to change its parameters for each page.


<wiki:Calendar pageformat="'<wiki:PageName/>Main_blogentry_'ddMMyy'_1'" urlformat="'Wiki.jsp page=<wiki:PageName/>&weblog.startDate='ddMMyy'&weblog.days=1'"/>

But of course impossible to insert a "<wiki:" inside another "<wiki:" (well I guess).

Can someone tell me how to do this, I don't really master the jsp. Thanks


OK, sorry for taking so long. I was initially going to say that it cannot be done, but then I realized that yes, it's quite doable. It basically just requires changing the "jspwiki.tld" file to have the following:


Note that for each attribute you will have to define the "rtexprvalue" to be "true". This has now been enabled for JSPWiki 2.1.60 onwards, so you don't have to change anything if you're tracking the CVS version.

It does add some performance penalty, though.

After the change, you can do it like this:

<% String pagename = ((com.ecyrd.jspwiki.WikiContext)pageContext.getAttribute("jspwiki.context",
         PageContext.REQUEST_SCOPE)).getPage().getName(); %>

<wiki:Calendar pageformat="<%="'"+pagename+"_blogentry_'ddMMyy'_1'"%>"
      monthurlformat="<%="'Wiki.jsp?page="+pagename+"&weblog.startDate='ddMMyy'&weblog.days=%d'"%>" />

Yup. It's extraordinarily ugly, but it works. The problem is that for some really, really strange reason (at least with JakartaTomcat 4.1) it is impossible to specify a tag within the ' -signs. It all works fine if you skip the single quotes, but those are required for the SimpleDateFormat.

-- JanneJalkanen

Question: Can I insert the Calendar Plugin inside an entry?#


[{INSERT com.ecyrd.jspwiki.tags.CalendarTag WHERE pageformat="'Main_blogentry_'ddMMyy'_1'"; urlformat="'Wiki.jsp?page=Main&weblog.startDate='ddMMyy'&weblog.days=1'"}]

And if yes, how-to insert a $pagename variable inside it (see previous question)?

[{INSERT com.ecyrd.jspwiki.tags.CalendarTag WHERE pageformat="'[{$pagename}]_blogentry_'ddMMyy'_1'";

or inside a jsp:

[{INSERT com.ecyrd.jspwiki.tags.CalendarTag WHERE pageformat="'<%=pagereq%>_blogentry_'ddMMyy'_1'"; or

[{INSERT com.ecyrd.jspwiki.tags.CalendarTag WHERE pageformat="'<wiki:variable var="pagename">_blogentry_'ddMMyy'_1'";


No, this is not possible, as the CalendarTag is a JSP Tag, not a plugin. It is meant for building your template, not for inserting on a page.

There is actually a (good) reason for it being a tag instead of a plugin, but I just can't remember it right now.


CalendarTag Ideas

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
CalendarExample.png 2.9 kB 1 20-Apr-2004 18:09 MDeichsel
« This particular version was published on 26-Aug-2003 22:22 by JanneJalkanen.