• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Auto-redirect for my index page

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm using WebLogic 9.2.2. Right now, I have an index.html page that redirects to the main page of my application ...

<html>
<script type="text/javascript">
location.replace("jsp/login.jsf");
</script>
</html>

Simple, but I thought there may be an even simpler way. Is there some way I can configure my web.xml or something else such that visiting /myapp/ automatically redirects to my login page?

Thanks, - Dave
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What if someone has JavaScript disabled?
I always use a meta tag with a refresh parameter to redirect visitors. I also put a link to the page I want people to be redirected to in the body of the page just in case the automatic redirect doesn't work.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So there's nothing I can do in the WebLogic container or web.xml to enable auto-redirecting? I'm trying to avoid having to create an index.html page at all. - Dave
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You asked for a "simpler way". I gave you the simplest way I know.
You can always point a context in web.xml to a servlet and have the servlet do a forward. Not as simple IMHO, but you won't have to create an index.html file.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not familiar with WebLogic, so this may be a dumb question, but doesn't it allow you to specify a JSP as your welcome page instead of index.html?
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The documentation doesn't rule it out.
The MedRec example provided with Weblogic does so.
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Have you checked out the following in the web.xml

The welcome-file element contains file name to use as a default
welcome file, such as index.html


if you put in a domain like abc.com then the web.xml welcome-file element should be able to provide you with your start page.

I guess this is what you want to do.

Br
Rahul
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic