Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Tuesday, January 25, 2011

Escaping special HTML characters in JSP

If you have a string that contains special characters such as '&' and you want to display this in a JSP page, you may get a ' The content of elements must consist of well-formed character data or markup.'

This code will fail if linkParm contains a '&'
<a href="main.do${userBean.linkParm}">
main link
</a>


The short answer is
<a href="main.do<c:out value='${userBean.linkParm}'/>">
main link
</a>


This seems overkill, indeed.

Tuesday, December 21, 2010

activemq and the java.io.EOFException: Chunk stream does not exist at page: 0

If you start activemq and get an error like that

INFO | Scheduler using directory: activemq-data/localhost/scheduler
ERROR | Failed to start ActiveMQ JMS Message Broker. Reason: java.io.EOFException: Chunk stream does not exist at page: 0
java.io.EOFException: Chunk stream does not exist at page: 0

It means that there is something wrong with the scheduler.

If you don't use the built in persisten scheduler you can easily turn it off by changing the activemq.xml config file (/opt/local/share/java/activemq/conf/activemq.xml)

<broker xmlns="http://activemq.apache.org/schema/core" ....
to
<broker xmlns="http://activemq.apache.org/schema/core" schedulerSupport="false">

Thursday, November 25, 2010

activemq and the java.io.EOFException: Chunk stream does not exist at page on broker start

Deleting the activemq-data directory seems to be the only recovery solution (which is not an option in production)

rm -rf /opt/local/share/java/activemq/data