Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - 404 with spring 3 -


hi going through first lessons spring 3.i created dynamic web app in eclipse following structure.

spring3mvc \src\my.spring.helloworldcontroller.java                 \webcontent                    |                    |-----web-inf\jsp\hello.jsp                                         |-----index.jsp                    |-----web-inf\web.xml                    |-----web-inf\spring-servlet.xml                    |-----web-inf\lib\...*.jar files 

i created spring-servlet.xml below

 <beans xmlns="http://www.springframework.org/schema/beans"              xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"             xmlns:context="http://www.springframework.org/schema/context"              xmlns:mvc="http://www.springframework.org/schema/mvc"               xmlns:p="http://www.springframework.org/schema/p"                 xsi:schemalocation="http://www.springframework.org/schema/beans               http://www.springframework.org/schema/beans/spring-beans-3.0.xsd                http://www.springframework.org/schema/mvc                       http://www.springframework.org/schema/context                 http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd                 http://www.springframework.org/schema/context/spring-context-3.0.xsd">                  <mvc:annotation-driven/>          <context:component-scan base-package="my.spring" />         <bean id="jspviewresolver" class="org.springframework.web.servlet.view.internalresourceviewresolver"             p:prefix="/web-inf/jsp/"         p:suffix=".jsp">            <property name="contenttype" value="text/html; charset=utf-8" />         </bean>       </beans> 

and coded controller

package my.spring; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.servlet.modelandview;  @controller public class helloworldcontroller {  @requestmapping("/hello")  public modelandview helloworld() {   string message = "hello world, spring 3.0!";   return new modelandview("hello", "message", message);  } } 

index.jsp has link hello view

<html> <body> <a href="hello.html">say hello</a>  </body> </html> 

finally in hello.jsp have put

<html> <body> ${message} </body> </html> 

my web.xml has

<display-name>spring3mvc</display-name>   <welcome-file-list>     <welcome-file>index.jsp</welcome-file>   </welcome-file-list>    <servlet>         <servlet-name>spring</servlet-name>         <servlet-class>             org.springframework.web.servlet.dispatcherservlet         </servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>     <servlet-mapping>         <servlet-name>spring</servlet-name>         <url-pattern>*.html</url-pattern>     </servlet-mapping> 

when run app on tomcat6 server( thru eclipse),i can see index page @ http://localhost:8080/spring3mvc/ .it displays link hello page.when click on it(http://localhost:8080/spring3mvc/hello.html),i 404 error.

message /spring3mvc/hello.html description requested resource (/spring3mvc/hello.html) not available. 

any idea how can solve this?

thanks

mark.

i belive problem not view resolver (it print other exceptions).

read error message carfully, tells problem is:

message /spring3mvc/hello.html description  requested resource (/spring3mvc/hello.html) not available. 

it hello .html (handler) can not found, not jsp. -- don't know exact problem it. -- tryed reproduce error, did not exact same error message.

added -- find problem

when start server prints mappings controller in log file. in case there must like

info : org.springframework.web.servlet.mvc.annotation.defaultannotationhandlermapping - mapped url path [/hallo] onto handler 'hallocontroller' 

if don't have such statement, wrong context scan, or have forget enable annotation driven mvc @controller programming model. can enabled adding:

<!-- enables spring mvc @controller programming model --> <annotation-driven /> 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -