GreatWebGuy Self-proclaimed greatness is a hard thing to prove.

6Jul/083

Europa to Ganymede, a flawless Eclipse upgrade

I've been burned by Eclipse upgrades before, especially when it comes to running local tomcat servers in the IDE. I think as recent as 3.1 to 3.2 and 3.2 to 3.3, this or that got moved and all my tomcat servers disappeared, or they were there and they just didn't want to start. I'm pleased to report that this upgrade was uneventful for me. I was able to start all my servers and run my applications with no issues, my eclipse settings were preserved for the most part, with a couple of perspective issues here and there where the perspective reset itself to the default.

Recommended steps to CYA during an eclipse upgrade:

  • Back up your old eclipse directory, just rename the folder
  • Make a copy of your existing workspace
  • Download and unzip eclipse in the same spot the old version was
  • Download and unzip any plugins you had previously and were using into the new version of Eclipse, I use PHPEclipse and jadclipse, neither of these have new versions but the plugins worked fine in Ganymede
  • Start eclipse, check your servers and apps make sure they compile and run, any sign of trouble just roll on back to the old version of Eclipse and the old version of your workspace

Piece of cake, right. Hopefully your experience is as uneventful as mine.

16Jun/0822

Input focus with jQuery

Form input focus always seems a pain to me, I don't like all of the generated inline javascript that struts or other frameworks add to accomplish this and it always seems to be one issue or another. So here's a simple solution that applies focus to the last input element in the document that has a class of focus. Short and sweet, nothing fancy, requires the jQuery library of course.

The javascript, preferrably in an external javascript file

    $("input.focus:last").focus();

The html

2May/0820

Converting a Java project to a Dynamic Web project in Eclipse

Once a project is created in Eclipse Europa of a certain type, it's not the most straight forward process of changing the project to a different type. For example you have a project that Eclipse considers to be a Java project, but it's actually a Web Project, you don't get to take advantage of all of the features available for Web Projects, such as deploying to a local tomcat server, unless Eclipse is aware that it's a web project. This has to do with the project settings and what eclipse considers the "Nature" of the project.

24Apr/0824

Default html button submit on enter with JQuery

I basically needed the update button to be the default action on clicking enter in the form, but there were multiple submit buttons in my form and they weren't in the order I needed due to UI design. This was a quick and dirty solution to select an html submit button and make it the default when a user clicks enter from certain or all input elements on the form. It could be tweaked to give specific behavior to specific types of input boxes, such as invoking a tab on enter in between required elements, but the general idea is using jQuery to click the default button when the user hits enter.

23Feb/0834

Simple Cross Site Scripting (XSS) Servlet Filter

Ran into some issues on some of our Java sites today and needed a quick fix to protect the sites from malicious Cross Site Scripting (XSS) attempts. If you're not aware of what XSS is and have websites that have sensitive user data, you may want to read up, you're probably vulnerable, which means your users are vulnerable. I'm not claiming this is a perfect solution, but it was easy to implement and corrected the vulnerabilities with form and url injection. We basically have a Servlet Filter that's going to intercept every request sent to the web application and then we use an HttpServletRequestWrapper to wrap and override the getParameter methods and clean any potential script injection.