beego中Controller的GetControllerAndAction方法
beego中Controller的GetControllerAndAction方法
GetControllerAndAction方法在beego中的源码
// GetControllerAndAction gets the executing controller name and action name.
func (c *Controller) GetControllerAndAction() (string, string) {
return c.controllerName, c.actionName
}
/*
作者注释写的很清楚,该方法时返回控制器名称和方法名
*/
//控制器的结构如下
// Controller defines some basic http request handler operations, such as
// http context, template and view, session and xsrf.
type Controller struct {
// context data
Ctx *context.Context
Data map[interface{}]interface{}
// route controller info
controllerName string
actionName string
methodMapping map[string]func() //method:routertree
AppController interface{}
// template data
TplName string
ViewPath string
Layout string
LayoutSections map[string]string // the key is the section name and the value is the template name
TplPrefix string
TplExt string
EnableRender bool
// xsrf data
_xsrfToken string
XSRFExpire int
EnableXSRF bool
// session
CruSession session.Store
}
beego中Controller的GetControllerAndAction方法的更多相关文章
- SpringMVC中Controller类的方法返回String不跳转,而是将字符串显示到页面
问题描述: 在spring中,控制层的注解一般都是使用@Controller,如果哪个请求参数需要返回数据的话,我们可以在该方法上配合@ResponseBody注解使用,这也是比较常见的方式了. 今天 ...
- Srping MVC中Controller的void方法
第一种 通过修改response来修改页面 /** * 方式一:通过声明HttpServletResponse类型的方法入参,来使用HttpServletResponse对象. * 注意:在Contr ...
- SpringMvc中controller之间的方法调用
方法一, return new ModelAndView("redirect:"+新地址); 方法二, response.sendRedirect(新地址); return nul ...
- 在springmvc中controller的一个方法处理多个不同请求
value的uri值为以下三类: A) 可以指定为普通的具体值: B) 可以指定为含有某变量的一类值(URI Template Patterns with Path Variables): @Req ...
- 详解SpringMVC中Controller的方法中参数的工作原理
Spring MVC中Controller的处理方法的参数可以是Integer,String,自定义对象,ServletRequest,ServletResponse,ModelAndView等等,非 ...
- 详解SpringMVC中Controller的方法中参数的工作原理[附带源码分析]
目录 前言 现象 源码分析 HandlerMethodArgumentResolver与HandlerMethodReturnValueHandler接口介绍 HandlerMethodArgumen ...
- ASP.NET Core MVC中的IActionFilter.OnActionExecuting方法,可以获取Controller的Action方法参数值
用过ASP.NET Core MVC中IActionFilter拦截器的开发人员,都知道这是一个非常强大的MVC拦截器.最近才发现IActionFilter的OnActionExecuting方法,甚 ...
- 详解SpringMVC中Controller的方法中参数的工作原理——基于maven
转自:http://www.tuicool.com/articles/F7byQn 前言 SpringMVC是目前主流的Web MVC框架之一. 如果有同学对它不熟悉,那么请参考它的入门blog:ht ...
- springmvc中Controller方法的返回值
1.1 返回ModelAndView controller方法中定义ModelAndView对象并返回,对象中可添加model数据.指定view. 1.2 返回void 在controller方法形参 ...
随机推荐
- P1464 Function
Function 简 单 的 递 归 这道题一开始十分智障地用递归做,虽然知道没那么简单,但还是冒着送死的心态交了一遍,果然,如我所料 样例输入: 密密麻麻,几万行的样例输入 //:) ...
- 详解 List接口
本篇博文所讲解的这两个类,都是泛型类(关于泛型,本人在之前的博文中提到过),我们在学习C语言时,对于数据的存储,用的差不多都是数组和链表. 但是,在Java中,链表就相对地失去了它的存在价值,因为Ja ...
- NCTF2019 小部分题解
前言 礼拜五领航杯打的比较累,做不出WEB,D3CTF没用,做了NJCTF的一些题目(懒,睡觉到12点起) Misc 第一次比赛先去做misc,以前一直做WEB,以后要WEB+MISC做.礼拜六下午做 ...
- PHP代码审计理解(二)----齐博CMS7.0文件覆盖
0x00 前言 因为我是跟着视频操作的,这回真的没理解为什么定位到了这个存在漏洞的文件... /do/fujsarticle.php 因为没有前文,所以这里无法分析这个$FileName为什么可以$_ ...
- 一行配置美化 nginx 目录 autoindex.html
demo
- 三步教你如何在Github部署自己的简历
相信铁子们有很多都是将找工作的小白(和小编一样!!嘿嘿)小编也和在座的大家一样,一个普通的不能再普通的二本学生(北华大学) < 单身!单身!单身!> 听很多人都说:像我们这个样子,害!放 ...
- Sublime text 3快捷键壁纸版
- Python 如何写 Ubuntu syslog
address='/dev/log' 是关键 import logging from logging.handlers import SysLogHandler logger = logging.ge ...
- 获取磁盘的 总容量,空余容量,已用容量 【windows】
使用windows api 输入:盘符字符串 输出:磁盘容量 float get_disk_spaces(const char drive_letter, float & total_spac ...
- 浅谈 Objective-C Associated Objects
简介 Associated Objects 是 Objective-C 2.0 中 Runtime 的特性之一. 在 <objc/runtime.h> 中定义的三个方法, void obj ...