Here is a plug-in that formats code (Java, xml, etc) within html in a very nice way.
http://code.google.com/p/syntaxhighlighter/
This looks great. I'll be adding this functionality ASAP to handle code snippets.
<bean id="limaBean" class="com.example.LimaBeanImpl">
<bean class="org.springframework.web.context.support.ServletContextAttributeExporter">
<property name="attributes">
<map>
<entry key="limaBeanInServletContext">
<ref bean="limaBean">
</ref>
</entry></map>
</property>
</bean>
public class DocumentViewerServlet extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
LimaBean limaBean = getLimaBean();
limaBean.doSomething();
...
}
private DocumentService getLimaBean()
{
ServletContext servletContext = this.getServletContext();
return (LimaBean) servletContext
.getAttribute("limaBeanInServletContext");
}
}
public class VegetableServletTest extends TestCase
{
private VegetableServlet servlet = null;
private LimaBean fakeLimaBean = null;
protected void setUp() throws Exception
{
super.setUp();
servlet = new VegetableServlet();
fakeLimaBean = new FakeLimaBean();
MockServletConfig config = new MockServletConfig();
config.getServletContext().setAttribute("limaBeanInServletContext",
fakeLimaBean);
servlet.init(config);
}
}