Hi, I was a jspwiki newbie (August 2003).

you can contact me mailto:webmasterDOTfxparlant(at)laposte.net (Just drop me a line, if you changed something important here because I might not come by everyday)

My homepage is at

Jspwiki is a wonderful wiki. The only problem I encountered was the price for a jsp hosting at the time I decided not to host my site on my personal computer at home.

Table of content:#

  • Insert header (javascript and meta)
  • Wiki and ID: why use a wiki? (New)
  • My titles in blogs
  • change css dropdown
  • Q:Calendar URL variable


19.10.2003 -- insert header (javascript and meta)#

On a very limited number of pages, I need to insert script in header, or a special meta tag. I've created a little snippet in viewtemplate.jsp, but I'm sure there are betters ways. If someone had an idea ?
<% 
String pagereq2 = ((com.ecyrd.jspwiki.WikiContext)pageContext.getAttribute
  ("jspwiki.context", PageContext.REQUEST_SCOPE)).getPage().getName(); 
String pagereqHead = pagereq2 + "_head.jsp";
java.io.File file = new java.io.File(application.getRealPath
  ("templates/default/" + pagereqHead));
out.print(file.getPath());
if( file.exists())
{
    %>
         <jsp:include page="<%=pagereqHead%>" flush="true"/>
<%
    }
else 
{
}
%>

FrancoisParlant Ideas


Wiki and ID#

Why use a Wiki ? Imagine: I want to make a comment pointing to a specifiq sentence, or a specific word in a page. Maybe it's the translation of a word, or of a verse (or an error message). Now, the wiki is not there to edit the page and add a comment right in the middle of the page. NO!

The wiki allows you to insert an ID tag, to which your comment will point.

THIS IS THE BEST FEATURE EVER ... even xpath can't go further than this : when you point to the third DIV and inside it the SECOND Span whith attribute class = lgfr, if someone wants to change something in the page, your path is rubbish. Only giving the ability to add an ID tag can let people give semantical comments relevant.

The only other tool useful is the reference manager ... and wiki has got it : a database which checks which points are refered to.

MORE : the only thing we will need is an aggregator from the ID tags point of view. To insert in a page a link to all the comments which points to this ID (and if there is a rdf description of the relation between the link and the paragraph in the page, show it)(06.sept.2003)


My titles in blog#

You'll find my question about this in WebLog

Here is what I put in my entries:

<jw:titles>
<span class="lgfr">Mon titre en fran├žais</span>
<span class="lgen">My title in english</span>
</jw:titles>
(03.sept.2003)

Change css dropdown#

Adapted from http://www.emptypages.org/more/php/quick_site_skin.html

My only achievement was to make a css change dropdown I added to the left menu.

My entries are multi languages : one line in french, one line in english, one in spanish.

<span class="lgen">Hello</span>
<span class="lgfr">Salut</span>
...

I like to have it this way, all in a same document. But to make it more readable, I use css to hide certain languages:

mycssEn.css

.lgen {background: blue}
.lgfr {display:none}

mycssen.css
.lgen {display:none}
.lgfr {background: green}

mycssboth.css
.lgen {background: blue}
.lgfr {background: green}

So a little dropdown in !LeftMenu changes the value of a cookie to fr, en or both, by linking to a switch.jsp and redirect to the previous page.Then the "view template" takes the cookie value to construct the link to the stylesheet.

This idea comes directly from a MovableType plugin and I just had to make it work on jsp. (I know nothing of JSp, but I could find all I needed for this in google)

Little difficulty:#

IE5 doesn't send the parameter in the "refere" header, so the redirection after the cookie change allways returned to Main page instead of the previous one. So I needed to construct the current page adress to send it with the link and use it for redirection. Unfortunately, there is no way of getting the context into a variable (edit.jsp, attach.jsp...) so I had to create a "probable" redirection to the "view" page even if the real previous page was an edit.(august 2003)

Actually, there is. Try:

 <%  String requestcontext = pageContext.getAttribute
WikiTagBase.ATTR_CONTEXT,PageContext.REQUEST_SCOPE).getRequestContext(); %>
After this, the variable "requestcontext" will tell in which context it was called. You can also use the CheckRequestContextTag. --JanneJalkanen


Q:Calendar URL variable.#

You 'll find about this in IdeasCalendarTag.

I need to make the calendar follow each page being a blog.

<wiki:calendar url="'[{$pagename}]_blogentry'DDMMyy'_1'" ...>

JanneJalkanen gave a very nice answer to this which solves wonderfully the problem.(august 2003)

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-23) was last changed on 03-Mar-2011 11:11 by Janne Jalkanen