• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Getting started with struts2 but having problems

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to setup maven and struts 2 project in Eclipse, but I'm having problems. I have chosen to create simple HelloWorld example and afterwards add some other functionality, but I'm having problems.

I have 'struts.xml' path in project: src/main/resources/struts.xml

and inside it:


also I have web.xml with path src/main/web/WEB-INF/web.xml and content:


From commandline I use 'mvn clean install' and I get .war file to target folder, that .war file I'm going to deploy under Tomcat (also it deploys it successfully) but when I enter url I get error:

The requested resource (/ContactWeb/Pages/Login.jsp) is not available.

same error with different url-s only path is different (/ContactWeb/Login.jsp, /ContactWeb/Login.action etc.).

In my project I do have Login.jsp, Index.jsp and also Welcome.jsp. They are under: src/main/web/Pages

I have read somewhere that in struts2 I need to but .action extension to url, but it doesn't work and also why in struts.xml is package name and namespace? what exactly needs to be there? I have read that is for page what it is going to display?
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi @Timo

I would like to add my analysis

The requested resource (/ContactWeb/Pages/Login.jsp) is not available.

it's 404 exception - Let us know how you are calling your action Login.

It should be
it should be http://localhost:8080/yourApplicationName/Login Remember in struts2 you can define any extension you want but if you are not specifying anything struts add .action

same error with different url-s only path is different (/ContactWeb/Login.jsp, /ContactWeb/Login.action etc.).

In my project I do have Login.jsp, Index.jsp and also Welcome.jsp. They are under: src/main/web/Pages

I have read somewhere that in struts2 I need to but .action extension to url, but it doesn't work and also why in struts.xml is package name and namespace? what exactly needs to be there? I have read that is for page what it is going to display?

Struts2 NameSpace

Mohan.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!