aspose file tools
The moose likes Struts and the fly likes Struts 2 welcome-file-list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 welcome-file-list" Watch "Struts 2 welcome-file-list" New topic
Author

Struts 2 welcome-file-list

Ainar Martin
Greenhorn

Joined: Mar 22, 2011
Posts: 11
I have already view other posts in this forum related with this subject but neither of the solutions presented have worked.

In my struts.xml I declare a generic action without a class mapped like:

<action name="LogForm">
<result>Login.jsp<result/>
<action/>

I have removed my welcome-file-list from my web.xml file. But when I try to run and deploy the application in WebLogic I get the error:
No action mapped for action .

How can I start my application with an action and not with a jsp file, since I need to apply an interceptor to control sessions.
I have already tried to redirect from the jsp file to an action with <s: action=""> but I don't like this solution.

Thanks in advance.



devi sam
Greenhorn

Joined: Nov 25, 2010
Posts: 9
Hi Ainar Martin ,

How you call your action from your browser. For example you try like this,
http://localhost:8080/example/LogForm.action


Ainar Martin
Greenhorn

Joined: Mar 22, 2011
Posts: 11
Hello, thanks for your reply.

If I try to access an action directly I get a page not found error for example:

http://localhost:8080/MyProject/login.action

where login.action is an action that I have declared in my struts.xml file

Though if I access my login.jsp page and submit, then the action gets executed.
I would like to execute the action first to apply an interceptor that controls the user sessions.

Thank you.
devi sam
Greenhorn

Joined: Nov 25, 2010
Posts: 9
Hi,

What is your requirement? you want to access a jsp page from struts action throw struts.xml means try like this in your xml mapping,
<struts>

<action name="loginAction">
<result name="success">/login.jsp</result>
</action>

<action name="loginAction" class="LoginAction">
<result name="success">/login.jsp</result>
</action>
</struts>

The first empty action will call your login.jsp.The second loginAction will mapped to the LoginAction class, if the execute method will return success means it will display login.jsp.

Thank you....







 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Struts 2 welcome-file-list