Questions tagged [controller]

A controller is responsible for executing a sequence of instructions in response to some stimulus (maybe a command, action, or event). This is often used in conjunction with the Spring or model-view-controller tags.

A controller is responsible for executing a sequence of instructions in response to some stimulus (maybe a command, action, or event). It may be used to refer to the controller portion of the MVC (Model-View-Controller) pattern, or a general handler for actions and events that orchestrates a response. It may also refer to the Spring annotation @Controller.

As it can refer to a number of different things, this tag is best used in conjunction with other tags. So, if you're referring to the Spring @Controller annotation, use the Spring tag in conjunction with this one. If you're referring to the general MVC controller, use the model-view-controller tag.

16598 questions
3
votes
2 answers

Connect mininet to external host

I have just set up a mininet topology. And now I want to connect one port on the switch in Mininet to an external port through an interface in Ubuntu. The Ubuntu server has two ports: ens33 connected to a real network ens38 connected to VMnet2 My…
3
votes
5 answers

Laravel Controller get limit number item

In my Controller $items = Item::all(); I want to get the first 6 items only How to change the code?
Walker Base
  • 177
  • 4
  • 15
3
votes
0 answers

Create a custom annotation for Symfony routes to check for HTTP Accept header in request

My controllers return different content types with respect to theHTTP Accept header sent by the client. At the moment on a high level my controllers follow this pattern: /** * @Route("/SomePath") * @Method({"GET"}) * @param Request $request The…
user2690527
  • 1,729
  • 1
  • 22
  • 38
3
votes
1 answer

Laravel - Get a data from a form

I'm working on a form (without MySQL for the moment) in order to get a data from an input with a confirm message page like "Congratulations $pseudo, your subscribe is successful". Problem : I can't display the data what I inserted into my…
user5687432
3
votes
2 answers

How to render two json objects as response on a rails controller

I need some help I have a controller with an action that queries two models. Now I need to send both of them as json in order to be used on my angular views. In the example bellow how should I send the "complex" and its "fields" in one json…
Pablo Palacios
  • 2,767
  • 20
  • 37
3
votes
2 answers

Render a controller in Twig - Unexpected "render" tag - expecting closing tag for the "block" tag defined

In Symfony2, at least until Symfony 2.4, it was possible to render controllers like this in twig {% render(controller("MyBundle:Default:method", { 'call' : 'action' })) %} With Symfony 3, this throws an Exception Unexpected "render" tag (expecting…
Ulti
  • 588
  • 5
  • 18
3
votes
1 answer

Btrim function is not working properly in PostgreSQL

Here, I have a problem in the value from trim() function in PostgreSQL: Ruby code: if(this.modelName=="ClientOffice") { …
Rubyist
  • 6,486
  • 10
  • 51
  • 86
3
votes
2 answers

Injecting Alasql in AngularJS: Uncaught Error: [$injector:modulerr]

I am trying to inject alasql so that I can export a table into xlsx sheet. I found AlaSQL as a solution and refered [http://jsfiddle.net/agershun/00nfeq12/][1] . This is the easy solution to my project. But on injecting //controller.js var App =…
3
votes
2 answers

Grails: sum of field within criteria builder

I'm at a loss of how to create a running sum of particular field after creating a criteria within a controller I'm currently creating a set of set of records using: def b = Tapes.createCriteria() def yesterday = b.list(sort:…
awfulHack
  • 857
  • 1
  • 10
  • 25
3
votes
1 answer

How to test controller class in MVC?

I'm building a simple iOS app in Swift according to the Model-View-Controller pattern. I can test the Model class by giving it input data and asserting the output result against my expectation. But I was wondering how I could test the Controller…
Thor
  • 9,638
  • 15
  • 62
  • 137
3
votes
1 answer

ASP.NET MVC 2 Automapper Placement

I am using Automapper to convert between my EF4 Models and my ViewModels. Automapper needs map relationships declared and I find myself copy/pasting them inside every controller's constructor. Mapper.CreateMap
John
  • 159
  • 10
3
votes
1 answer

performSegueWithIdentifier not working when being called from new instance of viewController in Swift

My mission When app receive notification and user taps on the notification i want to redirect the user to the correct View. In my case, SingleApplicationViewController. Current code PushNotification.swift - A class with static functions to handle…
Rikard Olsson
  • 841
  • 1
  • 7
  • 28
3
votes
1 answer

Use of service providers within controllers in Laravel 5.2

As for the title I've googled about two hours searching for a efficient answer and read repeatedly the official documentation, but without any step further, considering I'm relatively new to the framework. The doubt arise while searching for a…
wiredolphin
  • 1,431
  • 1
  • 18
  • 26
3
votes
1 answer

How to fix `Request.GetNextPageLink` obsolete API?

When I code the following in my controller to make it compatible with OData pagination I encounter this warning: This method is obsolete; use the ODataProperties().NextLink property from the System.Web.Http.OData.Extensions or…
Ehsan88
  • 3,569
  • 5
  • 29
  • 52
3
votes
1 answer

updating resource undefined method `valid?' for false:FalseClass

I have some validations for my Lesson model, and I'm able to highlight validation problems on the controller under the create action with the valid? method. However, if I try to valid? in an analogous manner, I get undefined methodvalid?' for…
gonzalo2000
  • 628
  • 1
  • 8
  • 22