Archive for the ‘Spring’ Category
Monday, July 21st, 2008
I had a chance to attend Mark Fisher's presentations a couple of times before at NEJUG. This time around, it was a local Java Meetup group in Cambridge. He's a very humble and knowledgeable guy about a lot of things, from Spring to Hibernate to Seam, to Scala & MDA!
With ...
Posted in Events, Java, Spring | No Comments »
Thursday, May 15th, 2008
I figured I'd lay this out there. It's not awesome code, just quick and dirty. But it works.
[java]
@Override
protected void buildExcelDocument(Map model, HSSFWorkbook workbook,
HttpServletRequest req, HttpServletResponse resp) throws Exception {
//CREATE THE SHEET
String periodDate = (String)model.get(PAYROLL_PERIOD_KEY);
HSSFSheet sheet = workbook.createSheet(periodDate);
sheet.setDefaultColumnWidth((short) 12);
...
Posted in Java, Spring, Web | 1 Comment »
Tuesday, May 13th, 2008
This has apparently gotten a fair amount of attention over the last year or so, but I never encountered it until today- call me lucky. Here's the situation, you're using Spring MVC and you have a controller that extends another controller (A->B).
Your unit test extends AbstractTransactionalDataSourceSpringContextTests, and makes use of ...
Posted in Spring, UnitTest | No Comments »
Friday, May 2nd, 2008
Adding a database back end to Spring Security seems deceptively simple. And to be fair, there are several ways to do it. The way I had in mind looked like a shortcut.
In my application there is basically one table for all users. It contains the values I need for username, ...
Posted in Hsqldb, Java, Security, Spring, Xml | No Comments »
Thursday, May 1st, 2008
Astute readers of my last Acegi article will note that Acegi has been assimilated into the Spring project, and is now called Spring Security. This next example is how I was able to get Spring Security running on my webapp.
I decided early on that I did not want to mess ...
Posted in Java, Security, Spring, Tutorials, Web, Xml | No Comments »
Monday, April 28th, 2008
Carbon Five Community has a really nice article on different ways of implementing/overriding properties files in Spring.
In a real-world application, we not only need to collect settings, but also override them in different environments. Many of our applications are deployed in 4 or more environments (developer machine, build server, staging ...
Posted in Article, Spring, Useful Links | No Comments »
Monday, April 28th, 2008
Note; This was my first day of adding Acegi to an existing webapp.
You can find a lot of Acegi security framework examples on the web these days. Unfortunately, nearly all of the examples use Acegi use the pre 1.0 version, which is before someone removed the SecurityEnforcementFilter..
The official description ...
Posted in Java, Security, Spring, Tutorials, Web, Xml | No Comments »
Wednesday, November 7th, 2007
Scenario: A simple jsp page with a standard drop down box. A Selection criteria (could be another drop down box and a couple of check boxes) to change the values in these drop down box dynamically, without submitting the page.
What you will learn:
Configure dwr.xml with spring beans
Configure application contexts for ...
Posted in Ajax, CodeSnippets, Con-(in)sulting, Spring, Tutorials | No Comments »
Monday, November 5th, 2007
When I first wrote my custom Email utlity 4 years back using JavaMail, it spread well over hundred lines of code. Looking at Spring's out of the box functionality for sending Emails with attachements & velocity templates makes you wanna feel sorry for your old code. The reference doc by ...
Posted in CodeSnippets, Spring, Tutorials | 2 Comments »
Thursday, June 14th, 2007
The next time you thought of writing a detailed exception handling logic for your webapp but continued to show java.lang.NullPointerException to the end users on the webpage. The following simple snippet of code would save you some harassmment from your manager more often than you think.
Add this in your xxx-servlet.xml ...
Posted in Spring | 2 Comments »
Tuesday, May 29th, 2007
I've written the start of another data load updating framework. This time I'm using Spring, Hibernate, and Hibernate Annotations.
It took a little tweaking to get this to work, and so I've decided to add my example in the hopes that this will help others get started quickly. This is a ...
Posted in Hibernate, Java, Spring | No Comments »
Tuesday, May 8th, 2007
If you have a small project, often you would have webpages which load a bunch of dropdown values or static data; like a List of Values (LOVs) which have a code and description. Most probably you would be configuring these in a database and access via dao or even sophisticated ...
Posted in Java, Spring | 1 Comment »
Sunday, April 29th, 2007
I've been getting startup errors trying to deploy this spring MVC application:
SEVERE: Error listenerStart
I can't find the error in the logs since this is a container start up error.
Here's what I did:
Prequisite: attach the spring src
Put a breakpoint in the ContextLoaderListener:
in the spring jar on the build path, find ...
Posted in Java, Servers, Spring | No Comments »
Monday, April 9th, 2007
I'm writing an application that's going to perform some serious data munging with a database. The schema has been defined (mostly) but there's no data I can use to test. For a short period of time I added my own data to the dev db server, but I found that ...
Posted in Hsqldb, Java, Spring | 1 Comment »
Wednesday, March 14th, 2007
At my latest client engagement I've become the king of batch applications. Small, stand-alone applications run via a scheduler or a set of shell scripts that perform a heavy amount of data-munging.
The problem with being assigned batch applications is that they're never allocated much time in the project plan; ...
Posted in Hibernate, Java, Spring | 5 Comments »