Java Java Spring @RequestParam gibt Fehlermeldung

F

Furtano

Gast
Ich möchte auf dropdownFilmeFilter zugreifen.

Aber ich bekomme den Fehler:
description The specified HTTP method is not allowed for the requested resource (Request method 'GET' not supported).

PHP:
@RequestMapping(value = "/articles", method = RequestMethod.POST)
        public String showArticles(@RequestParam ("dropdownFilmeFilter") String filter, Model model) {

            if (filter.equals("aufsteigend"))
                System.out.println("it runs");

            List<Article> article = (List<Article>) gd.findAll(Article.class);
            model.addAttribute("articles", article);
            return "articles";
        }


<div class="filmFilter">
        Filme: <c:out value="${ articles.size() }"></c:out>
        Sortieren 
        <form name="filter" action="articles" method="post">
            <select name="dropdownFilmeFilter">
            <option value="aufsteigend">Preis: aufsteigend</option>
            <option value="absteigend">Preis: absteigend</option>
            <option value="bewertung">Kundenbewertung</option>
            <option value="erscheinung">Erscheinungsdatum</option>
            </select>
            <input type="submit" name="mysubmit" value="OK" />
        </form>
    </div>
 
Hallo

Ich bin JEE fokusiert (JBoss'ler) und kenne Spring nur gaaanz am Rande.

Was verwendest du als Servlet Container?

Von hier aus sehen die HTTP Methoden okay aus, jedoch bin ich mir gerade nicht mehr sicher ob diese case sentitive progagiert werden. Kannst du mal (grossgeschrieben "POST") ins form tag packen und versuchen?

Greez
 
Das ist die ServletContext

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
        ">

	<!-- tell spring to load the properties declared in this file which introduces 
		all the mandatory configuration for the database -->
	<context:property-placeholder
		location="classpath:META-INF/hibernate.properties" />

	<!-- bean post-processor for JPA annotations like @PersistenceContext -->
	<bean
		class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

	<bean
		class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

	<!-- Enables the Spring MVC @Controller programming model -->
	<mvc:annotation-driven />

	<!-- Enable annotation-driven transaction management -->
	<tx:annotation-driven />

	<mvc:resources mapping="/images/**" location="/images/" />

	<!-- Scans within the base package of the application for @Components to 
		configure as beans -->
	<!-- @Controller, @Service, @Configuration, etc. -->
	<context:component-scan base-package="maxweiss.htw.kbe.spring" />

	<!-- Resolve logical view names to .jsp resources in the /WEB-INF/views 
		directory -->
	<bean
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/WEB-INF/views/" />
		<property name="suffix" value=".jsp" />
	</bean>

	<!-- Spring needs this factory to inject EntityManagers to our classes using 
		@PersistenceContext -->
	<bean id="emf"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
				<property name="showSql" value="${hibernate.show_sql}" />
				<property name="databasePlatform" value="${hibernate.dialect}" />
			</bean>
		</property>
		<property name="jpaProperties">
			<props>
				<prop key="hibernate.hbm2ddl.auto">${hibernate.ddlmode}</prop>
			</props>
		</property>
	</bean>

	<!-- We need this to let spring manage our transactions by using @Transactional -->
	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>
</beans>
 
Zurück
Oben