default home page

Greetings oh great ones.

I am working with Struts.  I need to tell the application that the home page is index.do and not index.jsp.

The reason being is that index.jsp has some beans which need to be set before the user gets there.  

There is no login required at this time.

When the user clicks on links in the index page, different data is displayed, but when they initially get there, there is no data to display.

I did not want to create another page to show the initial form, and hope I can just do it in the struts-config file.

LVL 9
rg20Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimYatesCommented:
Try adding to WEB-INF/web.xml :

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

other wise, you'll need to add an index.jsp page that contains just:

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<logic:redirect href="index.do"/>


0
rg20Author Commented:
When I add the welcome file list to the web.XML  Which by the way I was looking for earlier and could not find it in the struts-config.  It just shows me a list of the files on the web page.  

It seems that the servlets are not activated at that time.

I am going to play with that for a while and see if I can get it to work.  I will look at the second choice if all else fails.

Thanks.

0
rg20Author Commented:
In your redirect, does it assume that index.do is a file or is it addressing the action class?
Thanks
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

kiranhkCommented:
try this for your action

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<logic:forward name="index.do"/>
0
TimYatesCommented:
>  In your redirect, does it assume that index.do is a file or is it addressing the action class?

the latter...  it will call the action class for "index.do" referenced in the struts-config.xml

> try this for your action

That's *exactly* what I put kiranhk... you just use forward rather than redirect...  ;-)
0
kiranhkCommented:
yes if its a action the forward is to be preferred!!!!!
0
TimYatesCommented:
why?  This is an initial jsp which just sends control to the first struts action...
0
rg20Author Commented:
It turns out that you can access the actionform before the page is loaded as long as you set one of the variables in the action form to "".  

Once you do that, the bean will be created on startup.  So a second page is not necessary.
you can then use the bean:write method to call the data using the actionform name.

<bean:write name="actionform" property="propertyname" />


Thanks for all your help anyway.

0
PAQ_ManCommented:
PAQed with points refunded (50)

PAQ_Man
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.