dzone (63)


java How can I refactor HTML markup out of my property files?

java How can I refactor HTML markup out of my property files?

I've recently inherited a internationalized and text-heavy Struts 1.1 web application. Many of the JSP files look like:<p><bean:message key="alert"/></p> and the properties files look like: m…


Hidden Features of Java

After reading Hidden Features of C# I wondered, What are some of the hidden features of Java?…



css Styling HTML helpers ASP.NET MVC

If I have an HTML helper like so: Name:<br/><%=Html.TextBox("txtName",20) %><br/> How do I apply a CSS class to it? Do I have to wrap it in a span? Or do I need to somehow utilize the HtmlAttribut…


java .toArray(new MyClass[0]) or.toArray(new MyClass[myList.size()])?

Assuming I have an ArrayList ArrayList<MyClass> myList; And I want to call toArray, is there a performance reason to use MyClass[] arr=myList.toArray(new MyClass[myList.size()]); over MyClass[] ar…


Dependency injection with NHibernate objects

I am wondering how to tell NHibernate to resolve dependencies on my POCO domain objects. I figured out that methods like CalculateOrderTax should be in the Domain object because they encode domain sp…


What are the known “gotchas” with regards to the Chain of Responsibilty pattern?

I have been finding myself using the Chain of Responsibility pattern often(3 times is often for me) in my current project and I'm wondering if I have become a little over-enthusiastic about the solu…


jvm design decision

Why does the jvm require around 10 MB of memory for a simple hello world but the clr doesn't. What is the trade-off here, i.e. what does the jvm gain by doing this? Let me clarify a bit because I'm n…


multithreading What is the Re-entrant lock and concept in general?

I always get confused. Would someone explain what Reentrant means in different contexts? And why would you want to use reentrant vs. non-reentrant? Say pthread(posix) locking primitives, are they re-…


tomcat Get ServletContext in JAX-RS resource

I'm playing around with JAX-RS, deploying on Tomcat. It's basically: @Path("/hello") @Produces({"text/plain"}) public class Hellohandler{@GET public String hello(){return "Hello W…


java Young,Tenured and Perm generation

I'm confused with Heap,Young,Tenured and Perm generation. Could anyone please explain?…




java example spring how class with design boot and without