Click here to Skip to main content
15,886,693 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone.
i am working on java web application with struts2 framework. in this application, i have a login action that i expect to be the default action of my application. in other words, i expect that when i run application, login action execute and my url be like this:
http://localhost:8080/MyWebApplication/login

so i need to set default action in my project. but i don't know... :(
the part of my struts.xml file is like this:
XML
<package name="login" namespace="/" extends="struts-default">
        <action name="login" class="Action.loginAction">
            <result name="success" type="redirectAction">
                <param name="actionName">search</param>
                <param name="namespace">/</param>
            </result>
            <result name="error">/login.jsp</result>
            <result name="input">/login.jsp</result>
        </action>
    </package>


i tried
XML
<default-action-ref name="login" />
in my login package, but doesn't any effect.
could anyone help me to solve my problem?
thanks in advance.
Posted

1 solution

for web app web.xml file is the entry point. So you have to mention a jsp file as a welcome file in your web app and then redirect the request to your login action in the jsp page.i.e your jsp page contains only redirection code to redirect to the struts action(i.e. login action)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900