Working example

Let's modify our webapp example. Instead of passing the name, we will pass the user id, then find it in the database, and print it in the jsp.


    public class IndexAction {

        FooService fooService;

        Long id;

        User user;

        public void view() {
            if (id != null) {
                user = fooService.findUserById(id);


    ...hello ${}...


    public class FooService {

        AppDao appDao;

        @Transaction(propagation = PROPAGATION_SUPPORTS, readOnly = false)
        public void storeUser(User user) {

        @Transaction(propagation = PROPAGATION_SUPPORTS)
        public User findUserById(long id) {
            return appDao.findById(User.class, Long.valueOf(id));

Final words

This tutorial ends here, but it is just a beginning for your quest through Jodd! Enjoy!