<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<mvc:annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<mvc:resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.shr.myapp" />
package com.shr.myapp.Controllers;
import java.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class TrampsController {
private static final Logger logger = LoggerFactory.getLogger(TrampsController.class);
private static List<String> tramps ;
public TrampsController() {
tramps= new ArrayList<String>();
populate(tramps);
}
@RequestMapping(value = "/tramps", method = RequestMethod.GET)
public String list(Model model) {
logger.info("Listing Walks");
model.addAttribute("tramps",tramps);
return "tramps/list";
}
private void populate(List<String> tramps) {
tramps.add("Lake Waikaremoana Great Walk");
tramps.add("Kepler Track");
tramps.add("Milford Track");
tramps.add("Routeburn Track");
tramps.add("Rakiura Track");
}
}
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<html>
<head>
<link href="<c:url value="/resources/css/tramps.css" />" rel="stylesheet" type="text/css" media="screen" />
<title>Listing Tramps</title>
</head>
<body>
<div class="container">
<h1>Tramps of New Zealand</h1>
<table class="normal-table">
<thead>
<tr>
<th>Key</th>
</tr>
</thead>
<tbody>
<c:forEach var="tramp" items="${tramps}">
<tr>
<td><c:out value="${tramp}"/></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd“>
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
我不明白该如何解决这件事,请帮帮我
根据您正在共享的URL,您使用了错误的URL,您必须使用
localhost:8080/myapp/tramps
不是
localhost:8080/myapp/WEB-INF/views/tramps/list.jsp
要调用控制器方法,如果您是spring mvc的新手,请检查我的YT频道
警告:不推荐使用属性,它对生成过程没有影响。/home/midhilaj/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/be3106efb0df111fe5a3f7b356dd070b/res/values/values.xml错误:(246,5)错误:resource android:找不到attr/fontvaria
我使用grails已经快一年了。从现在开始,我想在gsp中链接css或js文件。我做了以下几件事: > 我在web-app文件夹下创建了一个新文件(例如资源文件),并将所有文件夹放在那里(例如导入bootstrap时,我在资源下有一个父文件夹bootstrap,在bootstrap下有css、img和js文件夹及其文件)。 然后,为了导入一个css文件,我做了以下操作(以下是相关文档): 这非常有
在最近升级了我的android工作室后,我不能再构建我的项目了。 重建、清理项目和使缓存无效都不起作用! 添加android.enableaapt2=false行并不能解决真正的问题,因此我宁愿找到问题的根源。 下面显示了我的gradle.build文件:
当我尝试使用GooplayService运行游戏时,Logcat显示以下错误: 我的代码登录Google Play游戏服务: 我使用Genymotion,google play游戏服务的最新版本.
我的config.xml:
它显示找不到某些属性,如DialogComerRadius和fontVariation设置。