This has proven useful at work, where our Wiki pages are sometimes printed out for meetings, or used as a poor man's (or busy man's) Power Point. In both cases the menu on the left is not useful. What this mod does is add a "Hide Menu" item on the menu, and a "Show Menu" item on each page where the menu is hidden. All Wiki links within the pages work, and point to pages that also don't have a menu.

This mod can be done on any JSPWiki install without recompiling the JSPWiki code. It does require that the Wiki RPC Interface be on, and this code calls the Hula library. I've tested it against JSPWiki 1.8.2 only, but don't see why it wouldn't work on newer versions.

I didn't want to mess with the code, so this is a bit of a hack to get around the fact that the links in wiki-produced HTML are always to Wiki.jsp.

This is likely an incomplete set of instructions; if you use this, please fill in what I'm leaving out.

  • Pick or create a new directory in your web server's visible structure where some files will go. I'll refer to that directory as /foo.
  • Make sure that your XML-RPC connection is on, and that the hula.jar directory is in the WEB-INF/lib directory that foo will use.
  • Copy the attached Wiki.jsp file on this page to /foo. Do not copy this over the Wiki.jsp that your normal Wiki uses! You'll need to change line 9 to point to the location of your Wiki's XML-RPC URL is, and edit line 45 to point to where your JSPWiki install is.
  • Edit the LeftMenu.jsp that your JSPWiki uses to include a link to /foo/Wiki.jsp. For example, i put mine at the end of the file, so that

<!-- End of automatically generated page -->
<BR/><A HREF="/foo/Wiki.jsp?page=<%=pagereq%>">Hide Menu</A><BR/>
<!-- End of automatically generated page -->
  • You'll likely want to restart the server, just so that it will recompile the pages to include the modified LeftMenu.jsp.
  • Now view a some page in the Wiki, and click the Hide Menu item you just added.
  • You will likely get some complaints about missing .js files, so copy them from your JSPWiki installation into foo until they go away.
  • You should see the same Wiki page you started at, but with no menu, and a Show Menu link at the top. Links to other pages should also have no menu.
  • Click the Show Menu link, and you should get back to the fully editable Wiki page.



Undoubtedly useful. I'd say there's a real need for presenting just the page contents (and maybe even generating interesting things out of them such as PDF, PS... what else?) that a real API call might be warranted. More on this on a saner day.. --ebu

Relatedly, I'll mention the PrintWiki sample app included in Hula, which allows you to pick a bunch of pages and present them on one page. And it works for any Wiki that supports the Wiki RPC Interface, not just JSPWiki. Doesn't do any file conversions, though; that's for someone with a stronger constitution than I. -- MahlenMorris

The way I solved this same problem was to create .jsp page called Printer.jsp which essentially only loaded the actual page. Then I made a small plugin which gave you a link to the current page, but instead of Wiki.jsp it used Printer.jsp.

This was a very ugly way of doing printable wiki pages. ++ NiiloNeuvo

I've done that with css print media which is very basic at this moment but works just fine for me. See PrintMediaCasecadeStyleSheetPatch -- PhilipVanBogaert
I am getting an error on pagereq. Anyone know how this gets resolved?

<A HREF="/contrib/Wiki.jsp?page=<%=pagereq%>">Hide Menu</A>

.caucho.jsp.JspParseException: /templates/local/LeftMenu.jsp:34: cannot resolve symbol symbol : variable pagereq location: class _templates._local._viewtemplatejsp out.print((pagereq)); ^ /templates/local/LeftMenuFooter.jsp:24: cannot resolve symbol symbol : variable pagereq location: class _templates._local._viewtemplatejsp out.print((pagereq)); ^ 2 errors

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
Wiki.jsp 1.0 kB 1 10-Mar-2003 20:05 MahlenMorris
« This page (revision-24) was last changed on 26-Sep-2007 23:15 by JanneJalkanen