permaculture playing cards*
The moose likes Struts and the fly likes Use welcome-file-list to run struts action? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Use welcome-file-list to run struts action?" Watch "Use welcome-file-list to run struts action?" New topic
Author

Use welcome-file-list to run struts action?

A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
Can I the welcome-file-list element in web.xml to run the startup struts action of my application?

Currently to start my app up the url is http://localhost:8080/PRD/PRD.do
but would prefer something like http://localhost:8080/PRD or http://localhost:8080/PRD/main.jsp

If I have to use a jsp file to redirect/forward to it what would this file look like?

many thans
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

You can define PRD.do as a welcome file and that should allow you to enter

http://localhost:8080/PRD

to bring up your application


Junilu - [How to Ask Questions] [How to Answer Questions]
A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
Thanks for replying - in my web.xm file I've put -

<welcome-file-list>
<welcome-file>PRD.do</welcome-file>
</welcome-file-list>

when i type in this url http://localhost:8080/PRD/ now I get a directory listing for the PRD directory

What am I doing wrong?

thanks
Mark Jones
Greenhorn

Joined: Apr 30, 2004
Posts: 4
Here is what I would do:

1) Create a 'welcome.jsp' which simply does a redirect to your struts alias. For example:

<html>
<body>
<%response.sendRedirect("home.do");%>
</body>
</html>

2) Add the 'welcome.jsp' to your welcome-list. For example:
<welcome-file-list>
<welcome-file>welcome.jsp</welcome-file>
</welcome-file-list>


This setup works for me!
-Chughead
A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
cheers CH, that's exactly what I wanted it to do!
A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
ah here we go & theres alway a gotcha - works fine on Tomcat 5 but not on Weblogic 8.1

Does anything ever get any easier in this god damm environment? - why does everything have to be such a battle!
A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
funny though putting this line in the welcome.jsp file

<meta HTTP-EQUIV="REFRESH" content="0; url=PRD.do">

& it works fine on both servers!

the weblogic error was -

<2004-08-13 14:25:20,640> ERROR - Invalid path /jsp/PRD was requested

Why? who knows, who cares just as long as it works!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use welcome-file-list to run struts action?
 
Similar Threads
Dobut in Realm Authentication
How can i change the url of struts?
webapp not on 8080 and html:base
Calling .do directly
Basic JSP problem