Springs dispatcher servet searching a jsp page instead of calling a controller method -
hi trying authenticate user seems calling jsp page instead of controller mapping.
my dispatcher servlet is
<bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname" value="${database.driver}" /> <property name="url" value="${database.url}" /> <property name="username" value="${database.user}" /> <property name="password" value="${database.password}" /> </bean> <bean id="sessionfactory" class="org.springframework.orm.hibernate3.annotation.annotationsessionfactorybean"> <property name="datasource" ref="datasource" /> <property name="annotatedclasses"> <list> <value>com.beingjavaguys.domain.user</value> <value>com.beingjavaguys.domain.chat</value> </list> </property> <property name="hibernateproperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> </props> </property> </bean> <bean id="hibernatetransactionmanager" class="org.springframework.orm.hibernate3.hibernatetransactionmanager"> <property name="sessionfactory" ref="sessionfactory" /> </bean>
my web.xml
is
dispatcher org.springframework.web.servlet.dispatcherservlet 1
<servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
and controller is
@requestmapping(value="/authenticate",method=requestmethod.post) public modelandview getauthenticateresult(@modelattribute("user") user user, bindingresult result) { if(userservice.authenticate(user)) { return new modelandview("/userlist"); } else{ return new modelandview("login"); } } @requestmapping(value="/userlist", method=requestmethod.get) public modelandview getuserlist() { map<string, object> model = new hashmap<string, object>(); model.put("chat", userservice.getchat()); return new modelandview("userdetails", model); }
i calling authenticate.html
login file using post
method problem error
http status 404 - /spring-hibernate-integration-helloworld/web-inf/view/userlist.jsp type status report message /spring-hibernate-integration-helloworld/web-inf/view/userlist.html.jsp description requested resource not available.
why searching jsp file instead of redirecting controller method? if use redirect:/userlist.html
works then.whats logic behind it?
if return string interpreted name of view render. name of view passed no viewresolver
(in case internalresourceviewresolver
) generate (internal) url forward to. in case jsp.
now redirect:
, forward:
prefixes 2 special cases. redirect:
result in client side redirect url, in turn call controller due configuration. forward:
handled on server side , not client side.
Comments
Post a Comment