내가 임베디드 Jetty 웹 서버와 작업하는 스프링 MVC 주석 예를 얻기 위해 노력하고 있습니다를, 임베디드JTSL 페이지 매개 변수를 평가하지 - 스프링 MVC +를 사용하여 부두
스프링 MVC 주석 예 :
http://www.vaannila.com/spring/spring-annotation-controller-1.html
내 (아주 기본) 웹 서버 :
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;
public class ServerRunner {
public static void main(String[] arguments) throws Exception {
Server server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(8080);
server.addConnector(connector);
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath("/foo");
webappcontext.setWar(".");
server.addHandler(webappcontext);
server.start();
server.join();
}
}
서버는 잘 실행하고 나는
로 이동http://localhost:8080/foo/userRegistration.htm
내 브라우저 (http 사용). 하지만 제출을 클릭하면 다음 페이지에 표현식 자체를 평가하는 대신 ${user.name}
, ${user.country}
이 표시됩니다.
는 JSP 소스 :
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Success Page</title>
</head>
<body>
User Details
<hr>
User Name : ${user.name}
Gender : ${user.gender}
Country : ${user.country}
About You : ${user.aboutYou}
Community :
<c:forEach var="community" items="${user.communityList}" >
${community}
</c:forEach> <br />
Mailing List: ${user.mailingList}
</body>
</html>
웹 응용 프로그램이 포함 된 부두에서 부두 독립에 잘 작동하지만. 누구에게이 문제가 발생 했습니까? 나는 부두 버전 6
내 web.xml을
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>Foo</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
</web-app>
무엇'처럼 보이는 web.xml'입니까? – skaffman