질문이 있습니다. 사소한 응용 프로그램이 있습니다. Spring MVC를 사용하고 JSP 페이지에서 일부 facelets을 사용한다. 그러나 나는 그것을 할 수 없다. 제로니모를 사용하고 있습니다. Geronimo에는 MyFaces JSF 구현이있다. 나는 지금 적절한 방법을 쓰지 않을 것이다. faces-config.xml
, 또는 무엇이 빠졌는가? 브라우저에서 페이지를 열면 Geronimo는 IllegalStateEcxeption
: No Application을이 어플리케이션에 대해 구성합니다. 이것은 faces-initialization이 전혀 작동하지 않는 경우에 발생합니다.스프링 MVC와 MyFaces를 함께 사용할 수 있습니까?
: 나는 디스패처 서블릿을 선언하고있는 web.xml 서블릿에 직면 한
@Controller
public class BasicController {
@RequestMapping("/")
public ModelAndView index() {
ModelAndView mv = new ModelAndView();
mv.setViewName("main");
return mv;
}
@ModelAttribute("appVersion")
public String getVersion() {
return Version.VERSION + " (" + Version.BUILD_TIME + ")";
}
}
는 :
<servlet>
<servlet-name>sd</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>sd</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>faces-servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>faces-servlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
나는 WEB-INF에 디스패처 서블릿을 구성한 /sd-servlet.xml :
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".jsp" />
</bean>
<context:component-scan base-package="eu.barbucha.trackAnniversaries.webLayer"/>
<mvc:annotation-driven/>
<mvc:resources location="/files/" mapping="/files/**"/>
내그들은 정말 수,
<?xml version='1.0' encoding='utf-8'?>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="files/basic.css" media="all"/>
</head>
<body>
<p>Example <h:outputText value="text"/>.</p>
<hr/>
<i>${appVersion}</i>
</body>
</html>