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方法形参 ...
随机推荐
- C++ 11 +,开坑。
最近换新工作了.工作中需要用到高端的c++11的一些操作,至于我后面又plus一下还是因为可能是c++14或者17中提供的一些操作.反正都是c++11以及之后的一些特性. 首先,今天看一下关于函数模板 ...
- 详解 Collection集合
(请关注 本人"集合总集篇"博文--<详解 集合框架>) 首先,本人来讲解下 Collection集合的继承体系: Collection集合 的继承体系: Collec ...
- [linux][MongoDB] mongodb学习(一):MongoDB安装、管理工具、
参考原文:http://www.cnblogs.com/kaituorensheng/p/5118226.html linux安装完美实现! 1. mongoDB安装.启动.关闭 1.1 下载安装包 ...
- DataTable 与XML 交互
一.将DataTable的内容写入到XML文件中 /// <summary> /// 将DataTable的内容写入到XML文件中 /// </summary> /// < ...
- SVM家族(一)
SVM家族简史 故事要从20世纪50年代说起,1957年,一个叫做感知器的模型被提出, 1963年, Vapnikand Chervonenkis, 提出了最大间隔分类器,SVM诞生了. 1992年, ...
- 异常体系结构 throwable
package com.yhqtv.demo01Exception; /* * 一.异常体系结构 *java.lang.Throwable * ------java.lang.Error:一般不编写针 ...
- CTO的窘境
做CTO太难了,常年的coding思维让你早已与世隔绝,CTO有很好的技术方案,但CEO.CFO等O听不懂是很麻烦的事.总得来说,做CTO一定要技术背景出身,有很强的沟通能力和情商,敏锐的洞察力和决断 ...
- thinkphp5--多文件入口设置
来源:http://www.cnblogs.com/walblog/p/8035426.html 今天在用tp5做项目的时候发现,前台是可以绑定默认到index模块的,但是后台不好弄,于是查了一下手册 ...
- (第七篇)系统编码、自启动配置、HOSTNAME、系统启动、定时任务、进程管理、硬盘及其分区
linux查看系统编码和修改系统编码的方法 查看支持的字符编码 使用locale命令, 如: root@ubuntu:/etc# locale 然后修改/etc/locale.conf,如改成中文编码 ...
- QIntValidator没有最小值的限制,继承然后写个新类来控制最小值
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/firecityplans/article ...