February 3, 2011

The IdleWorx Monster MyBatis Tutorial

Building an entire Java web application with MyBatis 3, Tomcat, MySQL and Eclipse (on Windows 7)

This is a multi part tutorial which will show you how to build a Servlet/JSP based web application from scratch, using MySQL, Tomcat and MyBatis (the new version of the iBatis framework) on a windows platform using Eclipse.

You will make the most of this tutorial if

  • You have built at least a few small webapplications in the past.
  • You know how to setup Tomcat 5.x or higher version
  • You are somewhat familiar with the Eclipse IDE
  • You are familiar with SQL.
  • You know how to set-up MySQL on your development box and integrate it with your java web application.

Let's get started

To see how Tomcat, MyBatis and MySQL work together we're going to create a tiny java web application in Eclipse, called ModelingAgency.

If you don't want to follow the whole tutorial, you can skip through to the different sections below and pick out the information you need, otherwise continue to Part 1 - The Setup

Table of Contents

At the end of this tutorial you will hopefully be able to create a basic Java JSP/Servlet based webapp with MyBatis, MySQL and Tomcat in an Eclipse environment.

You can download a full version of finished ModelingAgency webapp here.

This tutorial took me a long time to write, so if you found it useful in any way, if you found errors with it or you think something is missing, please let me know and I will do my best to improve it.

4 comments:

Marc said...

The best MyBatis Tutorial I have found after searching for a week. Thank you very very much!

Anonymous said...

Thanks, Good Tutorial.

Marc said...

Hi!
Is it possible to give the operator (<,>,=,etc.) *dynamicaly to the mapper.xml? Maybe with the SelectBuilder?
I would be verry pleased for an answer.
Best regards, Marc
* ...WHERE field = X... ...WHERE field > X...

Carlos PĂ©rez said...

A very useful and complete tutorial. It's all I want :)