• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts.xml file in Eclipse

 
pramod talekar
Ranch Hand
Posts: 366
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Could you please tell me where to place struts.xml file in Eclipse.

Thanks,
Pramod
 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pramod,

Place your struts.xml inside your src folder.

Java Resource src
|---
|--- struts.xml



Regards,
Vanlal
 
Jaimesh M Ponkia
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a web project, you can keep your config file in WEB-INF folder and configure the same in web.xml file.
 
pramod talekar
Ranch Hand
Posts: 366
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaimesh,

So you mean both struts.xml and web.xml should be in WEB-INF??
 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi pramod ,

In your eclipse , struts.xml and web.xml should be in the following location

Java Resource src
|---
|--- struts.xml (under src folder)
|---
Web Content
|--- META-INF
|--- WEB-INF |--- web.xml (under WEB-INF folder)

Regards,
Vanlal
 
Jaimesh M Ponkia
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Your web.xml should have the configuration as follows:

 
Jaimesh M Ponkia
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vanlalhmangaiha khiangte wrote:Hi pramod ,

In your eclipse , struts.xml and web.xml should be in the following location

Java Resource src
|---
|--- struts.xml (under src folder)
|---
Web Content
|--- META-INF
|--- WEB-INF |--- web.xml (under WEB-INF folder)

Regards,
Vanlal


Vanlal,

How would you specify the sturts.xml file path in web.xml if its in the src folder? As far as I know, the web.xml would be able to identify content that is placed within the WebContent folder and nothing outside that.
 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pramod talekar wrote:Hello,

Could you please tell me where to place struts.xml file in Eclipse.

Thanks,
Pramod


This is the default location in Eclipse .. When you create a new project "dynamic web project" ..
There is no need for a separate init-param in web.xml ..

Moreover in your web.xml

If you use a configuration like the above in your code .. you can place your struts.xml anywhere in your project ...

Regards,
vanlal
 
Jaimesh M Ponkia
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vanlalhmangaiha khiangte wrote:
pramod talekar wrote:Hello,

Could you please tell me where to place struts.xml file in Eclipse.

Thanks,
Pramod


This is the default location in Eclipse .. When you create a new project "dynamic web project" ..
There is no need for a separate init-param in web.xml ..

Moreover in your web.xml

If you use a configuration like the above in your code .. you can place your struts.xml anywhere in your project ...

Regards,
vanlal

How will struts know what is the name of your configuration file and where is it placed unless you specify it somewhere?
 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

In Struts 2 the struts.xml file has to be in the classpath, not at the root of WEB-INF.
So, in your project, you should put in the "src" folder, so when it deploys it goes into WEB-INF/classes.
You can also verify this ...


Regards,
Vanlal
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not regarding the IDEs, where should be the struts configuration files reside?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic