Wednesday, October 31, 2012

Servlet 3.0 and HTML 5 File Upload Servlet Example

Someone asked how simple is it to create a servlet using 3.0 technology which could upload a file. It took me about 5 minutes to do using NetBeans 7.2, and another 10 minutes to tweak for the file name. I hope that this proves how quick and easy it is to do. The code is also very readable.

Here is the code for my servlet, and form:


Tuesday, October 30, 2012

NetBeans 7.2.x Tip of the Day: Sharing PMD Configuration Files

I use the PMD plugin for NetBeans 7.2 for my development. If you are not using it, you should consider it. The plugin uses the ruleset from PMD project for static code analysis. Members of my team asked which rules I use when I evaluate their code so that they can handle it before I look at their code. I thought it would be as simple as exporting it, but that was not the case.

I filed an enhancement request for the feature: Export PMD Default Configuration Ruleset. Until it is added as a feature, here is how to pass your selected ruleset along.

The file that contains the rules which I am using is called pmd.properties. The file is located in a couple of different places depending on if you are using Windows, or Mac OS X.

On Mac OS X it is located:

/Users/{USER_HOME}/Library/Application Support/NetBeans/7.2.1/config/Preferences
On Windows it is located:

C:\Users\{YOUR_USER_DIRECTORY}\AppData\Roaming\NetBeans\7.2\config\Preferences
I hope that helps if you need to share your rules.

Wednesday, October 24, 2012

JSF 2.x Tip of the Day: Creating RichFaces <a4j:commandLink/> Programmatically

As soon as I posted the previous blogpost Java Evangelist John Yeary's Blog: JSF 2.x Tip of the Day: Programmatic <h:commandLink/> I got a request for how to do it with RichFaces. The process is almost the same.

Here is an example for creating <a4j:commandLink/>
This example creates one for a table sorter on a RichFaces data table.

Popular Posts