rg20
asked on
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.
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.
ASKER
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.
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.
ASKER
In your redirect, does it assume that index.do is a file or is it addressing the action class?
Thanks
Thanks
try this for your action
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<logic:forward name="index.do"/>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<logic:forward name="index.do"/>
> 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... ;-)
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... ;-)
yes if its a action the forward is to be preferred!!!!!
why? This is an initial jsp which just sends control to the first struts action...
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<welcome-file-list>
<welcome-file>index.do</we
</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"/>