亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在Intellij中運行導入的Spring mvc項目?

如何在Intellij中運行導入的Spring mvc項目?

炎炎設計 2023-05-24 15:10:37
我正在使用 IntelliJ 并導入了 Spring MVC 項目。我配置了 Maven 設置并用于mvn clean install 構建我的項目。為了運行,我在 IntelliJ 的配置上配置了 tomcat:run。但紅色標記顯示為:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <groupId>com.luv2code</groupId>    <artifactId>spring-security-demo</artifactId>    <version>1.0</version>    <packaging>war</packaging>    <name>spring-security-demo</name>    <properties>        <springframework.version>5.0.2.RELEASE</springframework.version>        <maven.compiler.source>1.8</maven.compiler.source>        <maven.compiler.target>1.8</maven.compiler.target>    </properties>    <dependencies>        <!-- Spring MVC support -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-webmvc</artifactId>            <version>${springframework.version}</version>        </dependency>        <!-- Servlet, JSP and JSTL support -->        <dependency>            <groupId>javax.servlet</groupId>            <artifactId>javax.servlet-api</artifactId>            <version>3.1.0</version>        </dependency>        <dependency>            <groupId>javax.servlet.jsp</groupId>            <artifactId>javax.servlet.jsp-api</artifactId>            <version>2.3.1</version>        </dependency>        <dependency>            <groupId>javax.servlet</groupId>            <artifactId>jstl</artifactId>            <version>1.2</version>        </dependency>        <dependency>            <groupId>junit</groupId>            <artifactId>junit</artifactId>            <version>3.8.1</version>            <scope>test</scope>        </dependency>    </dependencies>
查看完整描述

2 回答

?
心有法竹

TA貢獻1866條經驗 獲得超5個贊

嘗試這樣做:
File->Project Structure->Modules->檢查是否添加了 Web 模塊
如果“否”:
1. 添加此模塊。然后查看第 2 點。
如果“是”:
檢查那里的Web 資源目錄
2。它必須指向您的webapp目錄路徑。

查看完整回答
反對 回復 2023-05-24
?
揚帆大魚

TA貢獻1799條經驗 獲得超9個贊

在你的 DemoController showHome 中應該返回一個 ModelAndView 這樣的東西然后 ViewResolver 將它映射到home.jsp


@RequestMapping("/")

public ModelAndView showHome() {

? ? return new ModelAndView("home");

}

查看完整回答
反對 回復 2023-05-24
  • 2 回答
  • 0 關注
  • 155 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號