Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes Maven + Tiles + Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Maven + Tiles + Struts2" Watch "Maven + Tiles + Struts2" New topic
Author

Maven + Tiles + Struts2

Matthias Zeilerbauer
Greenhorn

Joined: Sep 01, 2010
Posts: 13
So I am playing a little bit with the struts2 features and try to integrate them in little example projects. I also use Maven because it is a nice feature to make depencies. But I don't know why my Application doesn't work.

My environment:
- Eclipse 3.6
- Tomcat 6
- struts 2.2.1
- tiles-plugin 2.2.1

This is my maven pom.xml file:



This is my SayHelloAction:



this is my tiles-definition.xml:



this is my struts.xml:


web.xml:


My error message is this:


This is my project structure:


I really don't know why. Because I he must find the definition file??



[Thumbnail for directories.png]

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

OGNL 3 has a javassist dependency; if you search this forum you'll see another discussion about this exact topic. One of the POMs (I forget which) declares it as a provided resource or something... I forget what I was told when I asked another S2 dev about this.
Matthias Zeilerbauer
Greenhorn

Joined: Sep 01, 2010
Posts: 13
So finally did it. After one whole day...crap! (now I will dream of tiles definitions and struts2 :rolleyes
My error was that I must not load a template file (layout.jsp) as a welcome site (at first).
Another thing what I found out was when you build a struts2-tiles webapp that you have to depend on javassist even when you use ognl 3.0!

My solution was to create an index.jsp which I declared as my welcome site which immediatly redirects to my SayHelloAction, which then loads the template file:

index.jsp:


When anybody needs my working version (also in .war available) than contact me: zeiler.matthias(at)gmx.at

Matthias Zeilerbauer
Greenhorn

Joined: Sep 01, 2010
Posts: 13
David Newton wrote:OGNL 3 has a javassist dependency; if you search this forum you'll see another discussion about this exact topic. One of the POMs (I forget which) declares it as a provided resource or something... I forget what I was told when I asked another S2 dev about this.


I had to declare it as "compile", because only "provided" had not implemented it. I don't know if that is a bug, and also don't think it is logic, since "provided" implements the depency when it doesn't exist?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's why I said OGNL 3 has a dependency on Javassist. "Provided" means that it's assumed the dependency will exist at runtime--it's not necessary at compile time, since you're not compiling OGNL itself.
Matthias Zeilerbauer
Greenhorn

Joined: Sep 01, 2010
Posts: 13
Ah ok. That means when I would compile ognl than javassit would compile also. thanks for making it clear to me.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Actually, I mis-spoke--I don't know if OGNL has a compile-time dependency on jassist, but I *do* know it has a run-time dependency. I forget which pom it is, but one of them assumes javassist will be provided at run-time. Not sure about compile time.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Maven + Tiles + Struts2