controller

How to pass variable from controller to the view joomla mvc

喜你入骨 提交于 2019-12-07 02:30:23
问题 How do I pass my variable from joomla sub-controller to the view according to this example class MYControllerControllerParser extends JController{ public function __construct($default = array()) { parent::__construct($default); } protected function _import($file, $type) { $layout = ''; switch ($type) { case 'importcsv': $contains_headers = false; $field_separator = JRequest::getVar('separator'); $field_separator = empty($field_separator) ? ',' : $field_separator; $field_enclosure = JRequest:

RequestMappingHandlerMapping.getHandlerInternal:230 - Did not find handler method for

流过昼夜 提交于 2019-12-07 02:27:13
问题 trying to make some spring example program - constantly getting the error - it happens that my controller cannot handle /hello request. Here is debug info from log4j. 13:50:58,502 {TRACE} DispatcherServlet.initContextHolders:1018 - Bound request context to thread: org.apache.catalina.connector.RequestFacade@636f2067 13:50:58,503 {DEBUG} DispatcherServlet.doService:823 - DispatcherServlet with name 'springtest' processing GET request for [/springtest_2/hello] 13:50:58,504 {TRACE}

MVC 3 tries to launch URL to View instead of controller action

 ̄綄美尐妖づ 提交于 2019-12-07 02:21:36
问题 Sometimes when I launch my MVC 3 project it attempts to load the fully qualified URL for the view being rendered instead of the action within the controller (Which gives me a 404 error). Other times it works fine and actually hits the controller action like it's supposed to, but it's about 50/50. The URL it hits sometimes is: http://localhost:xxxx/Views/Account/LogOn.cshtml Here is the default route setup in the Global.asax file: routes.MapRoute( "Default", // Route name "{controller}/{action

Get current action's path/url including query string? (Rails)

纵饮孤独 提交于 2019-12-07 02:18:14
问题 Simple question - how do I get the path or full URL of the current action INCLUDING the query string? I wish to save it to the session variable like so: def show @thingy = Thingy.find(params[:id]) session[:some_var] = current_url ... end At the moment I'm doing the following, but it seems a bit heavy-handed (especially the specifying of query string params individually): def show @thingy = Thingy.find(params[:id]) session[:some_var] = thingy_path(@thingy, :q1 => params[:q1], :q2 => params[:q2

Test a base (abstract) controller

别等时光非礼了梦想. 提交于 2019-12-07 02:04:17
问题 I have a base controller with some functionality, that base controller is not accessible from the outside, no route matches it. Then, I extend that controller with other controllers to add extra functionality and with routes, I have 3 controllers extending that base controller just to define 3 methods on each one of them. I want to test the base controller, but I can't do post :index because there are no routes for that action (No route matches error) I don't want to add those test to one of

Visual Studio “Add Controller” list of model classes

≯℡__Kan透↙ 提交于 2019-12-07 01:38:42
问题 The "Add Controller" dialog on an MVC project provides a dropdown list of model classes to choose from. These are usually the model classes in the project, and that's what I used to see. But now I'm getting this: Any idea what's wrong and how to change it back to what I believe is the normal way? 回答1: I often run into a problem with that dialog box "forgetting" classes and showing odd choices. Closing and restarting VS has always cleared the problem up for me. 回答2: It seems there's no

ASP.NET MVC: Returning large amounts of data from FileResult

一世执手 提交于 2019-12-07 01:38:33
问题 I have a file browser application in MVC4 that allows you to download a selected file from a controller. Currently, the FileResult returns the Stream of the file, along with the other response headers. While this works fine for smaller files, files that are larger generate an OutOfMemoryException. What I'd like to do is transmit the file from the controller, without buffering in memory in a fashion similiar to HttpReponse.TransmitFile in WebForms. How can this be accomplished? 回答1: You can

Spring: controller inheritance using @Controller annotation

泄露秘密 提交于 2019-12-07 01:33:06
问题 I'd like to be able to create a base controller in my Spring app that, among other things, determines if a user is a registered user or not. This base controller, following the template design pattern, would contain an abstract protected method that controller subclasses would implement. The abstract method would have passed to it an instance of User, registered or otherwise. However, I have no idea how I would do this since it seems that by using controllers purely using the @Controller

Disable action method from being called from the address bar

痴心易碎 提交于 2019-12-06 22:01:21
问题 I have a method in my controller that I don't want to be called from the address bar in the browser... Is there a way to do that? Maybe some kind of annotation, modification in the route configuration? Which are my options? 回答1: If you are going to use this action only from within your controller or Views then you can use ChildActionOnly attribute. If you want to access it using POST then you can use [HttpPost] attribute. But if you wish to use it using GET (i.e. using AJAX call etc) and don

generate dropdownlist from a table in database

你离开我真会死。 提交于 2019-12-06 20:16:39
I'm tryng to be more precise to my previous question which can be found here, I got some nice answers but couldn't figure out how to use it in my situation Previous question I got some nice answers but couldn't figure out how to use it in my situation. basically I want to have registration page which contains Email //Comes from my AspNetUser(datamodel) class, also AspNetUsers table exists in database. UserName //Comes from my AspNetUser(datamodel) class, also AspNetUsers table exists in database. Password //Comes from my AspNetUser(datamodel) class, also AspNetUsers table exists in database.