0

Spring JSP を呼び出しても起動しません。どうやらリソースが利用できないようです。これが私のコントローラーコードです。

@Controller
public class BulletinsController {
    private List<Bulletin> bulletins;
    private BulletinDAO bulletinDAO;

    // getters and setters, including autowiring for the BulletinDAO

    @RequestMapping(value = "/getApprovedBulletins", method = RequestMethod.POST)
    public ModelAndView getApprovedBulletins() {
        try {
            bulletins = bulletinDAO.getApprovedBulletins();
            mav.setViewName("WEB-INF/jsp/EnterBulletin");
            if (bulletins != null) {
                mav.addObject("bulletins", bulletins);
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
            mav.setViewName("WEB-INF/jsp/FailurePage");
        }

        return mav;
    }

ここに jcbulboard-servlet.xml の関連部分があります

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost/cpc" />
    </bean>

    <bean id="bulletinDAO" class="com.dao.BulletinDAO">
        <property name="dataSource" ref="dataSource" />
    </bean>

    <bean id="bulletinsController" class="com.controller.BulletinsController">
        <property name="bulletinDAO" ref="bulletinDAO" />
    </bean>

これが私のweb.xmlです。

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4"
        xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <display-name>Job Connections Bulletin Board</display-name>

        <servlet>
            <servlet-name>jcbulboard</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
            <servlet-name>jcbulboard</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>

        <welcome-file-list>
            <welcome-file>Welcome.jsp</welcome-file>
        </welcome-file-list>
</web-app>
4

1 に答える 1