SpringMVC generic errors

I was looking around the net for this. Maybe I didn’t look hard enough but I wasn’t able to find it. Finally a coworker told me. If you use the SpringMVC framework and wish to show generic validation error messages at the top of the page, here’s how you do it:

<spring:hasBindErrors name="formName">
  <div class="genericErrors">
  <span class="errorRight">
	<c:choose>
	      <c:when test="${errors.errorCount > 1}">
		    There are ${errors.errorCount} errors. Please correct them.
	      </c:when>
	      <c:otherwise>
		    There is ${errors.errorCount} error. Please correct it.
	      </c:otherwise>
	</c:choose>
	Scroll down if necessary to see all of the error messages in red.
  </span>
</div>
</spring:hasBindErrors>

Obviously if you wish to display specific error for a field, you’d use

<form:errors path="yourInputName" />

To read more about error handling in SpringMVC, read the chapter 13 of its documentation.

Hosting Drama

Obviously I am nowhere near as actively on the whole personal web world as I used to be. Most of my sites are shut down. The only somewhat active site is this one. Amazingly I still get so much traffic that makes this site top the resource usage sites on the server.

Today I got the following email from my web host hostquack.com:

Hello,

Your account has been suspended due to consuming high resources on our shared server. I would recommend you to optimize your database and php pages in order to utilize server resources properly to see if it works. If this won’t help, I would highly recommend you to have a vps or dedicated server.

Let me know your comment.

Here’s my dilemma: I want to keep using pure-essence.net because well I had it since I met Andy. I do not wish to give up my domain name. But obviously after 10 years, this name gets known and some of my posts get popular. I no longer use it that frequently but I seem to have to pay the price for its popularity. No shared hosting can handle it well any more. I really DO NOT wish to have to spend money on a VPS or dedicated server.

My temporary solution was to optimize my site. I found this wordpress performance enhancement post and followed its suggestions. I turned on WP build-in object cache and installed and activate wp-super-cache plugin. My host agreed to monitor how my site is doing after the tweaks. Fingers crossed.

I spend most of my non-working hours on the pet society game nowadays. It’s a mindless game but trading items make it well addictive.