• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Getting started with struts2 but having problems

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic