• Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts 2 welcome-file-list  RSS feed

 
Ainar Martin
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....







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