PDA

View Full Version : Could not open ServletContext resource in excel view



geek.shrek
Sep 10th, 2008, 06:54 PM
Hi,

I'm using Spring 2.5

and I have this error when I try to have excel view


java.io.FileNotFoundException: Could not open ServletContext resource [/test.xls]

here's my test-servlet.xml snippet


<bean class="org.springframework.web.servlet.view.ResourceBundl eViewResolver">
<property name="basename" value="views"/>
<property name="order" value="0" />
</bean>

<bean id="excelController" class="com.TestExcelController">
</bean>

<bean id="excelView" class="com.DataExcelView">
</bean>

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResou rceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
<property name="order" value="1" />
</bean>

<bean id="messageSource" class="org.springframework.context.support.ResourceBundle MessageSource"
p:basename="messages" />


<bean id="searchData" class="com.SearchFormController">
<property name="formView" value="search"/>
<property name="commandName" value="test_search_info"/>
<property name="successView" value="searchResult"/>
<property name="commandClass" value="com.SearchInfo"/>
<property name="validator"><ref bean="searchFormValidator"/></property>
</bean>


<bean id="searchFormValidator" class="com.TestSearchValidator">
</bean>


<bean id="simpleUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name="mappings">
<props>
<prop key="/search.htm">searchData</prop>
<prop key="/test.xls">excelController</prop>
</props>
</property>
</bean>



excel-view.class=com.DataExcelView
excel-view.url=test


my test-servlet.xml sits under /WEB-INF folder

Does anyone know what did I did wrong? :confused:

geek.shrek
Sep 11th, 2008, 01:14 PM
Fixed it :D