《MVC 系列》- 入门案例
2017-12-28 00:00
323 查看
项目结构
新建项目
选择模板
控制器类
public class HelloController : Controller { // GET: /Hello/Index public ActionResult Index() { //自动匹配与Action名相同的视图 return View(); } // GET: /Hello/Index2 public ActionResult Index2() { //指定具体的视图名,逻辑地址 return View("Index"); } // GET: /Hello/Index3 public ActionResult Index3() { //指定具体的视图名,绝对路径 return View("/Views/Hello/Index.cshtml"); } }
视图文件
@{ ViewBag.Title = "Index"; } <h2>Welcome to MVC</h2>
测试
在浏览器输入http://localhost:2290/Hello/Index相关文章推荐
- [转] 使用 MVC 5 的 EF6 Code First 入门 系列
- 快速入门系列--MVC--03控制器和IOC应用
- ionic入门教程第二课-从Tabs案例看Ionic的MVC架构
- Spring 基于注解的MVC入门案例
- ASP.NET MVC 入门系列教程
- ASP.NET MVC 入门系列教程
- Netty 快速入门系列 - Chapter 3 Netty5.x【第六讲】 -Netty5 案例
- Quartz 入门系列教程-01-入门案例
- [01] 使用 MVC 5 的 EF6 Code First 入门 系列:建立一个EF数据模型
- OPEN(SAP) UI5 学习入门系列之三:MVC (上) - 模型
- Asp.Net MVC2 实用入门系列:第七篇:闲话ASP.NET MVC
- MVC 5 的 EF6 Code First 入门 系列:排序、筛选和分页
- [渣译文] 使用 MVC 5 的 EF6 Code First 入门 系列:MVC程序中实体框架的连接恢复和命令拦截
- Spark RDD/Core 编程 API入门系列 之rdd案例(map、filter、flatMap、groupByKey、reduceByKey、join、cogroupy等)(四)
- [渣译文] 使用 MVC 5 的 EF6 Code First 入门 系列:为ASP.NET MVC应用程序读取相关数据
- [03] 使用 MVC 5 的 EF6 Code First 入门 系列:排序、筛选和分页
- [渣译文] 使用 MVC 5 的 EF6 Code First 入门 系列:为ASP.NET MVC应用程序实现继承
- MVC系列之一 入门概述
- ASP.NET MVC 入门系列教程
- MySQL---数据库从入门走向大神系列(十二)-构建MVC项目