You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Roger <ro...@googlemail.com> on 2008/08/21 16:24:01 UTC

Action as Welcome File

Sorry, I know that I've read about this here before, but I can't find the 
thread. Can someone point me to how to configure an action as the "welcome" 
file?

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: RE: Action as Welcome File

Posted by Stephan Schröder <si...@gmx.de>.
> <filter-mapping>
>         <filter-name>struts2</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>         <dispatcher>INCLUDE</dispatcher>
>         <dispatcher>ERROR</dispatcher>
> </filter-mapping>

this result in an xml-error: The content of element type "filter-mapping" must match "(filter-name,(url-pattern|servlet-name))".

> In my web.xml I have:
> 
> <welcome-file-list>
>         <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
> 
> and in index.jsp I have:
> 
>      <%
>         String redirectURL = 
> "http://localhost:8080/myproject/MyAction.action";
>         response.sendRedirect(redirectURL);
>     %>
> 
> Seems like a hack to me, but gets the job done.  Is there a more elegant 
> way?

Mine is slightly more elegant:
<welcome-file-list>
      <welcome-file>index.html</welcome-file>
</welcome-file-list>
 
 and in index.html I have:

<html>
	<head>
		<meta http-equiv="refresh" content="0; URL=public/index.action">
	</head>
	<body>
		one moment please...
		<a href=public/index.action>Link</a>
	</body>
</html>

Is this an initialisation issue or why doesn't <welcome-file>/public/index.action</welcome-file> work?

/Stephan
-- 
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action as Welcome File

Posted by Ylva Degerfeldt <yl...@gmail.com>.
Hello James,

I had the same problem and another Struts 2 developer showed me one
way to do it. (I didn't get it to work to specify the action as a
welcome-file.) The solution is almost like you did. The only
difference is how you call the action from index.jsp. I don't know if
it's more elegant but this should also work (at the top of index.jsp):

<meta http-equiv="Refresh" CONTENT="0; URL = /myproject/MyAction.action"/>

-Just in case you wanted to know.

/Ylva

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action as Welcome File

Posted by Randy Burgess <ra...@d5systems.com>.
If you use an action as the welcome file you normally would also have to
create a file named welcome.action. I usually just create an empty file with
the appropriate name if I want to use an action as the welcome page.

Regards,
Randy Burgess
Sr. Software Architect
D5 Systems, LLC


> From: Ramez Hassan <ra...@asset.com.eg>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Thu, 21 Aug 2008 17:43:10 +0200
> To: 'Struts Users Mailing List' <us...@struts.apache.org>
> Subject: RE: Action as Welcome File
> 
> Hi,
> I guess you can do that by specifying the following in web.xml:
> <welcome-file-list>
>         <welcome-file>/actionnamespace/welcome.action</welcome-file>
>     </welcome-file-list>
> 
> 
> And also by adding the following filter mapping attributes in struts filter
> dispatcher in order to be loaded which ever the type of dispatch by the web
> container
> 
> <filter-mapping>
>         <filter-name>struts2</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>         <dispatcher>INCLUDE</dispatcher>
>         <dispatcher>ERROR</dispatcher>
>         </filter-mapping>
> 
> 
> -----Original Message-----
> From: James Neff [mailto:james.neff@tethyshealth.com]
> Sent: Thursday, August 21, 2008 4:42 PM
> To: Struts Users Mailing List
> Subject: Re: Action as Welcome File
> 
> Felipe Lorenz wrote:
>> Hi..
>> 
>> Did you try change in web.xml file? Change from index.jsp to
>> your_action.action!! i dont know if it work...
>> 
>> Felipe.
>> 
>> On Thu, Aug 21, 2008 at 7:24 AM, Roger <ro...@googlemail.com>
> wrote:
>>   
>>> Sorry, I know that I've read about this here before, but I can't find the
>>> thread. Can someone point me to how to configure an action as the
> "welcome"
>>> file?
>>> 
>>> Regards
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>> 
>>> 
>>>     
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>>   
> I would like to know if there is a better way to do this.
> 
> In my web.xml I have:
> 
> <welcome-file-list>
>         <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
> 
> and in index.jsp I have:
> 
>      <%
>         String redirectURL =
> "http://localhost:8080/myproject/MyAction.action";
>         response.sendRedirect(redirectURL);
>     %>
> 
> Seems like a hack to me, but gets the job done.  Is there a more elegant
> way?
> 
> --James
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Action as Welcome File

Posted by Ramez Hassan <ra...@asset.com.eg>.
Hi,
I guess you can do that by specifying the following in web.xml:
<welcome-file-list>
        <welcome-file>/actionnamespace/welcome.action</welcome-file>
    </welcome-file-list>


And also by adding the following filter mapping attributes in struts filter
dispatcher in order to be loaded which ever the type of dispatch by the web
container

<filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>ERROR</dispatcher>
        </filter-mapping>


-----Original Message-----
From: James Neff [mailto:james.neff@tethyshealth.com] 
Sent: Thursday, August 21, 2008 4:42 PM
To: Struts Users Mailing List
Subject: Re: Action as Welcome File

Felipe Lorenz wrote:
> Hi..
>
> Did you try change in web.xml file? Change from index.jsp to
> your_action.action!! i dont know if it work...
>
> Felipe.
>
> On Thu, Aug 21, 2008 at 7:24 AM, Roger <ro...@googlemail.com>
wrote:
>   
>> Sorry, I know that I've read about this here before, but I can't find the
>> thread. Can someone point me to how to configure an action as the
"welcome"
>> file?
>>
>> Regards
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   
I would like to know if there is a better way to do this.

In my web.xml I have:

<welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

and in index.jsp I have:

     <%
        String redirectURL = 
"http://localhost:8080/myproject/MyAction.action";
        response.sendRedirect(redirectURL);
    %>

Seems like a hack to me, but gets the job done.  Is there a more elegant 
way?

--James




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action as Welcome File

Posted by James Neff <ja...@tethyshealth.com>.
Felipe Lorenz wrote:
> Hi..
>
> Did you try change in web.xml file? Change from index.jsp to
> your_action.action!! i dont know if it work...
>
> Felipe.
>
> On Thu, Aug 21, 2008 at 7:24 AM, Roger <ro...@googlemail.com> wrote:
>   
>> Sorry, I know that I've read about this here before, but I can't find the
>> thread. Can someone point me to how to configure an action as the "welcome"
>> file?
>>
>> Regards
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   
I would like to know if there is a better way to do this.

In my web.xml I have:

<welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

and in index.jsp I have:

     <%
        String redirectURL = 
"http://localhost:8080/myproject/MyAction.action";
        response.sendRedirect(redirectURL);
    %>

Seems like a hack to me, but gets the job done.  Is there a more elegant 
way?

--James



Re: Action as Welcome File

Posted by Felipe Lorenz <fe...@gmail.com>.
Hi..

Did you try change in web.xml file? Change from index.jsp to
your_action.action!! i dont know if it work...

Felipe.

On Thu, Aug 21, 2008 at 7:24 AM, Roger <ro...@googlemail.com> wrote:
> Sorry, I know that I've read about this here before, but I can't find the
> thread. Can someone point me to how to configure an action as the "welcome"
> file?
>
> Regards
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org