Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Use welcome-file-list to run struts action?

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 15886
265
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
A Harry
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cheers CH, that's exactly what I wanted it to do!
 
A Harry
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
    Bookmark Topic Watch Topic
  • New Topic