Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to set one of jsp files in my jsps folder as the default view for the application. Is there any way we can tell in <welcome-file-list> that abc.jsp needs to be default and it can be found in such and such path. Also the url pattern is html so is there a way it can be mapped in Spring MVC.

For example - When a user types www.example.com , I want the application to direct to abc.jsp page and also when someone types www.example.com/something, even then application should direct to abc.jsp, but the url pattern shouldnt be compromised.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
79 views
Welcome To Ask or Share your Answers For Others

1 Answer

Add

<mvc:view-controller path="/" view-name="abc"/>

to the config file. Then the ROOT will resolve to the abc view. Then add

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/views/"/>
    <property name="suffix" value=".jsp"/>
</bean>

to the config file. This will resolve the view to /WEB-INF/view/abc.jsp.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...