controller

Hot to implement grails server-side-triggered dialog, or how to break out of update region after AJAX call

In grails, I use the mechanism below in order to implement what I'd call a conditional server-side-triggered dialog: When a form is submitted, data must first be processed by a controller. Based on the outcome, there must either be a) a modal Yes/No confirmation in front of the "old" screen or b) a redirect to a new controller/view repla...

current_user.user_type_id = @employer ID

I am building a system with a User model (authenticated using AuthLogic) and three user types in three models: one of these models is Employer. Each of these three models has_many :users, :as => :authenticable. I start by having a new visitor to the site create their own 'User' record with username, password, which user type they are, e...

ASP.NET MVC download image rather than display in browser

Rather than displaying a PNG in the browser window, I'd like the action result to trigger the file download dialogue box (you know the open, save as, etc). I can get this to work with the code below using an unknown content type, but the user then has to type in .png at the end of the file name. How can I accomplish this behavior witho...

Spring 3 MVC - Form Failure Causes Exception When Reloading JSP

EDIT: NEW SIMPLER VERSION OF THIS QUESTION - http://stackoverflow.com/questions/3014579/spring-3-controllers-maintaining-model-through-flow Using Spring 3 MVC, please bear with the long code example, it's quite simple, but I want to make sure all relevant information is posted. Basically here is the use case: There is a registration p...

How do I make this ASP.NET MVC controller more testable?

I have a controller that overrides OnActionExecuting and does something like this: protected override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext); string tenantDomain = filterContext.RouteData.Values["tenantDomain"] as string; if (!string.IsNullOrWhiteSpace(tenantDomai...

Controller name convention in ASP.NET MVC

Is there a way to change the naming convention for controllers in ASP.NET MVC? What I want is to name my controllers InicioControlador instead of InicioController, or better yet, use a prefix instead of a suffix, and have ControladorInicio as my controller name. From what I have read so far, I think I have to implement my own Controlle...

Spring 3 Controllers - Maintaining Model Through Flow

I'm sure there is some way to accomplish what I'd like here, but I haven't been able to find it in the documentation import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping(value = "/test") public class TestControll...

Return another controller method inside a controller method in turbogears 2

In turbogears 1 that was easy: Class controller(Controller) @expose() def method1(self, **kw): print 'bla' return self.method2(**kw) @expose('template2') def method2(self, **kw): print 'bli' return dict(**kw) when I call method1, what I got was the template2 called by method2. but in t...

Basecamp API Rails

Hi Everyone, I was wondering if someone could do me massive favour.. I really don't understand how to make use of APIs - so I was wondering if, using Basecamp as an example, someone could talk me though the basics. So far I have an application with a dashboard controller/view, I have put basecamp.rb into my /lib directory, added the ...

How add logic to Views? Ruby on Rails

Right now I'm building a project management app in rails, here is some background info: Right now i have 2 models, one is User and the other one is Client. Clients and Users have a one-to-one relationship (client -> has_one and user -> belongs_to which means that the foreign key it's in the users table) So what I'm trying to do it's on...

JMF microphone volume controller

How to obtain the Microphone volume controller in JMF? this is what I have: I tried this implementation concept of yours, but I keep getting a null from the first volume processor when I try to get the stream, here is how I do it: // the device is the media device specifically audio Processor processorForVolume = Manager.createProcess...

Routes error on [POST] [Ruby on Rails]

Right now I'm building a project management app in rails, here is some background info: Right now i have 2 models, one is User and the other one is Client. Clients and Users have a one-to-one relationship (client -> has_one and user -> belongs_to which means that the foreign key it's in the users table) So what I'm trying to do it's on...

Bast Practise: ASP.NET MVC Controller/Action with multiple object types

Hi, I'm looking for the best method for the following issue I have. I current have a large number of objects that all inherit for a single base object and are all very similar. Is there a solution available the will allow one create action and one edit action without needing to replicate a lot of the same code. So for example I might ...

Rails check box in form decides on create action in controller?

Hi Everyone? I am trying to add a select box to the base of my create form that decides if an action runs from the controller...if that makes any sense? Basically the application creates a project in FreeagentCentral whenever a new project is made: def create @company = Company.find(params[:kase][:company_id]) @kase = @company...

Creating foreach loops using Code Igniter controller and view

Hello, This is a situation I have found myself in a few times and I just want clear it up once and for all. Best just to show you what I need to do in some example code. My Controller function my_controller() { $id = $this->uri->segment(3); $this->db->from('cue_sheets'); $this->db->where('id', $id); $data['get_cue_sheets'] = $this-...

set/add view from controller action

Hi all, I'm trying to set a view script to be executed in addition to the currently requested action view script. I want to do this from the controller action itself in a way that this new view script output will be available from the layout $this->layout()->content helper. I found the setView() method but don't know how to use it from...

Cocoa: how to connect a button to a view?

Hello, The title question might be a little vague. I will try to explain as good as i can (also note im new to cocoa programming so excuse any mistakes :) ). I have a VIEW that extends NSView where i would like to draw some images. I want the images to be loaded from some files on the disk, when i click a button. I managed to do all t...

What/Where are the Naming Rules for Controller actions in a Zend_Application App

I've created a Zend_Application using the zf tool that's bundled with Zend Framework (1.96, if that matters) What at the rules for formatting action names and how those action names get translated into into URL paths, and where in the Framework codebase does this happen? I ask because I tried to create an action like public function c...

grails question (sample 1 of Grails To Action book) problem with Controller and Service

Hi, I'm doing Grails To Action sample for chapter one. Every was just fine until I started to work with Services. When I run the app I have the following error: groovy.lang.MissingPropertyException: No such property: quoteService for class: qotd.QuoteController at qotd.QuoteController$_closure3.doCall(QuoteController.groovy:14) at qo...

Is there a method I can use across controllers and if so, how do I use it?

I have several controllers that take an instance of different classes each (Email, Call, Letter, etc) and they all have to go through this same substitution: @email.message.gsub!("{FirstName}", @contact.first_name) @email.message.gsub!("{Company}", @contact.company_name) @email.message.gsub!("{Colleagues}", @colleagues.to_sentence) @em...