Introduction:
Servlet to convert a JSPWiki HTML page into a clean HTML page.
The purpose of this servlet is to enable clean HTML output of a JSPWiki
document. This resolves wrong formating of tables and other HTML content, usually entered by copying from external sources or from other plugins.
Prerequisites:
This servlet was compiled with Java version 1.6.0_17. Need this or above to run. You can also compile with your own version.
Tested with JSPWiki 2.8.1
Parameters:
page - The name of the page. Will be used as the HTML title.(Required)
tidy - Define the use of the HTML Tidy class for cleanup of the HTML code. Should be used for correct display; set to no only if you have problem with the encoding. Default value: yes. (Optional)
encoding - ID of the encoding to be used like UTF-8. If not set, default character set of the machine will be used. (Optional)
Installation:
Copy wikicontent2html.jar
to /WEB-INF/lib of your JSPWiki installation.
Copy jtidy.jar, log4j.jar, xml-apis.jar to /WEB-INF/lib of your JSPWiki installation. See Dependencies section below for download links.
Should you choose to download a version from the external sites instead of using the attachemed file, make sure that the version dowloaded is the same or above the version attached.
Enter the following in the web.xml file:
Add the call to the servlet somewhere on your JSPWiki page, templates/default/Favorites.jsp is my preferred place, as it gives an option to the More... menu:
Create the file default.properties in /templates/ folder of the JSPWiki installation (if it does not already exists) and add the following content:
Dependencies:
Dependencies needed for compilation of WikiContent2HTMLServlet.java
j2ee.jar -> Java enterprise classes.
This can be found in the J2EE SDK (or tools that ship with it).
No need to install as the servlet container will have this,
JSPWiki.jar -> JSPWiki classes.
No need to install as this comes with the JSP Wiki.
jtidy.jar -> Tidy implementation for java.
Download from http://jtidy.sourceforge.net/
(latest version) or from the attached files (version 918)
.
log4j.jar -> Apache Logging Services.
Download from http://logging.apache.org/log4j/
(latest version) or from the attached files (version 1.2.14)
.
xml-apis-xerces-2.9.1.jar -> XML parser.
Download from http://xerces.apache.org/
(latest version) or from the attached files (version 2.9.1)
.
Known Issues:
In some browsers, you need to enable "Print background images" to print the page correctly.
Servlet to convert a JSPWiki HTML page into a clean HTML page.
The purpose of this servlet is to enable clean HTML output of a JSPWiki
document. This resolves wrong formating of tables and other HTML content, usually entered by copying from external sources or from other plugins.
Prerequisites:
This servlet was compiled with Java version 1.6.0_17. Need this or above to run. You can also compile with your own version.
Tested with JSPWiki 2.8.1
Parameters:
page - The name of the page. Will be used as the HTML title.(Required)
tidy - Define the use of the HTML Tidy class for cleanup of the HTML code. Should be used for correct display; set to no only if you have problem with the encoding. Default value: yes. (Optional)
encoding - ID of the encoding to be used like UTF-8. If not set, default character set of the machine will be used. (Optional)
Installation:
Copy wikicontent2html.jar
to /WEB-INF/lib of your JSPWiki installation.
Copy jtidy.jar, log4j.jar, xml-apis.jar to /WEB-INF/lib of your JSPWiki installation. See Dependencies section below for download links.
Should you choose to download a version from the external sites instead of using the attachemed file, make sure that the version dowloaded is the same or above the version attached.
Enter the following in the web.xml file:
<servlet>
<servlet-name>WikiContent2HTMLServlet</servlet-name>
<servlet-class>com.kyriakosgalatis.jspwiki.WikiContent2HTMLServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WikiContent2HTMLServlet</servlet-name>
<url-pattern>/wiki.html</url-pattern>
</servlet-mapping>
Add the call to the servlet somewhere on your JSPWiki page, templates/default/Favorites.jsp is my preferred place, as it gives an option to the More... menu:
<li><a class="action"
href="<wiki:BaseURL/>wiki.html?page=<wiki:PageName />"
title="View as HTML">View as HTML
</a></li>
Create the file default.properties in /templates/ folder of the JSPWiki installation (if it does not already exists) and add the following content:
actions.viewhtml=View Page HTML actions.viewhtml.title=View HTML
Dependencies:
Dependencies needed for compilation of WikiContent2HTMLServlet.java
j2ee.jar -> Java enterprise classes.
This can be found in the J2EE SDK (or tools that ship with it).
No need to install as the servlet container will have this,
JSPWiki.jar -> JSPWiki classes.
No need to install as this comes with the JSP Wiki.
jtidy.jar -> Tidy implementation for java.
Download from http://jtidy.sourceforge.net/
(latest version) or from the attached files (version 918)
.
log4j.jar -> Apache Logging Services.
Download from http://logging.apache.org/log4j/
(latest version) or from the attached files (version 1.2.14)
.
xml-apis-xerces-2.9.1.jar -> XML parser.
Download from http://xerces.apache.org/
(latest version) or from the attached files (version 2.9.1)
.
Known Issues:
In some browsers, you need to enable "Print background images" to print the page correctly.
Add new attachment
List of attachments
| Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
|---|---|---|---|---|---|---|
java |
WikiContent2HTMLServlet.java | 11.5 kB | 1 | 01-Dec-2009 12:05 | Kyriakos Galatis | Version 1 source code |
jar |
jtidy.jar | 187.7 kB | 1 | 01-Dec-2009 11:54 | Kyriakos Galatis | JTidy library |
jar |
log4j.jar | 367.4 kB | 1 | 01-Dec-2009 11:55 | Kyriakos Galatis | Apache Logging Services |
jar |
wikicontent2html.jar | 4.5 kB | 1 | 01-Dec-2009 12:17 | Kyriakos Galatis | No dependencies |
jar |
xml-apis-xerces-2.9.1.jar | 194.4 kB | 1 | 01-Dec-2009 11:55 | Kyriakos Galatis | XML Parser |