File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Default Action In Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Default Action In Struts2" Watch "Default Action In Struts2" New topic

Default Action In Struts2

Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69

Dear All,
Can we do this(I tried it at my end but no success)

By entering,

the default action name InitializeAction(for some initialization) should get called and then from its execute method i will show the result (i.e login.jsp)

I dont want to use struts.xml and will use Annotation


David Newton

Joined: Sep 29, 2008
Posts: 12617

I don't think there's any non-XML way to set the default action (but could be wrong). It'd be pretty inefficient at startup if there was, too; not a big deal, but still.
Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69


I have one query

I am using Annotation and declared it in web.xml where to find annoted action class this way
web.xml snippet

Everything is working fine if action classes are in mypackage.action

but if move existing or create a new action class

in com.mycompany.mypackage.action.otheraction

i am getting this
HTTP Status 404

Can you explain this to me?

Thanks in advance

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Default Action In Struts2
It's not a secret anymore!