controller

Catch Exception when non-existant controller is requested

I want to be able to capture the exception that is thrown when a user requests a non-existant controller and re-direct it to a sweet 404 page. How can I do this? For example, the user requests http://www.nosite.com/paeges/1 (should be/pages/) they get re-directed to the 404 rather than the nasty exception screen of death? ...

Categories of controllers in MVC Routing? (Duplicate Controller names in separate Namespaces)

Hey guys, I'm looking for some examples or samples of routing for the following sort of scenario: The general example of doing things is: {controller}/{action}/{id} So in the scenario of doing a product search for a store you'd have: public class ProductsController: Controller { public ActionResult Search(string id) // id being t...

Using a USB controller as auxiliary keyboard for Visual Studio

Our family no longer uses our Mixman DM2 USB controller for making music. This frees it up for me to use as an auxiliary keyboard with 31 "keys" (and a few "sliders"). I had the crazy idea to use these buttons to send keyboard shortcuts to Visual Studio. It just seems easier pressing one key than some of the finger-bending ctrl double...

How you design Controller layer of MVC design pattern in .NET

Here are my thoughts: The purpose of using MVC is seperation of concerns and testability of gui logic. View should be able to work with different models and model should be able to work with different views. I think controller class must implement an interface for mocking/testing reasons and view should call controller methods through th...

Annotated Spring-MVC controller not recognized when controller extends interface

I'm using spring 2.5, and am using annotations to configure my controllers. My controller works fine if I do not implement any additional interfaces, but the spring container doesn't recognize the controller/request mapping when I add interface implementations. I can't figure out why adding an interface implementation messes up the con...

Spring-MVC Problem using @Controller on controller implementing an interface

I'm using spring 2.5 and annotations to configure my spring-mvc web context. Unfortunately, I am unable to get the following to work. I'm not sure if this is a bug (seems like it) or if there is a basic misunderstanding on how the annotations and interface implementation subclassing works. For example, @Controller @RequestMapping("ur...

Alternative to Html.Button<T>?

I know the Html.Button has been moved to the Microsoft.Web.Mvc namespace, but I really miss the generic versions that used to exist in the early Previews. All I want the Html.Button to do is to hit an action in my controller, but I'd rather not write the JavaScript in the onClickMethod argument. In my previous project I just snagged t...

How do I determine my controllers in MVC?

Hello, I'm fairly new to MVC coming from a php background where I designed by view and created pages when I needed something like say a login form. I'd have a file called login. This only sucked when I needed a new login form to login a different type of user. Say an admin. I'd then have to create a new page called login-admin.php o...

Can an ASP.Net MVC controller return an Image?

Can I create a Controller that simply returns an image asset? I would like to route this logic through a controller, whenever a url such as the following is requested: www.mywebsite.com/resource/image/topbanner The controller will look up "topbanner.png" and send that image directly back to the client. I've seen examples of this wher...

Is using a front controller and headers the best way to mimic a response in PHP?

I've been researching PHP frameworks as of late for some personal projects, and it looks like most of them use a front controller to mimic a response. The controller gets the params from the request, and re-routes by sending the appropriate headers depending on the logic. This is the "response". Is this the best way to do this in PHP, or...

With MVC, do interactions with autonomous peripherals belong in the Model or the Controller?

Using MVC with an observer pattern, if a user action requires polling a device (such as a camera) for data, should the polling be done in the Controller and the result passed off the Model or should a request be sent to the Model and the Model itself performs the polling. This question is my attempt to reconcile everything I am reading ...

Using MVC, how should one handle communcation between Views? Between Models?

Question number three in my quest to properly understand MVC before I implement it: I have two cases in mind: The primary application window needs to launch the preferences window. (One View invoking another View.) The primary Model for an application needs to access a property in the preferences Model. (One Model accessing another Mo...

How do I implement "create" controller action for a view with many fields in ASP.NET MVC

I'm new to ASP.NET MVC so this may be a stupid question. I have an account object that has many parameters. I've figured out a strategy to break this down into a "wizard"-like interface that will walk a user through collecting the required fields to create the initial business objects. It will then step through pages to collect other, ...

SubSonic Controller

What's the use of the controllers in SubSonic? thx, Lieven Cardoen aka Johlero ...

How to access multiple JPanels inside JFrame?

I have a JFrame that contains a "display" JPanel with JTextField and a "control" JPanel with buttons that should access the contents of the display JPanel. I think my problem is related on how to use the observer pattern, which in principle I understand. You need to place listeners and update messages, but I don't have a clue where to pu...

ASP.NET MVC OutputCache doesn't work for root URI

I'm learning ASP.NET MVC and bugged by one issue. In the HomeController, the Index action has OutputCache attribute, but it seems doesn't work. [HandleError] public class HomeController : Controller { [OutputCache(Duration=5, VaryByParam="none")] public ActionResult Index() { ViewData["Title"] = "Home Page" + DateTi...

How do you use usercontrols in asp.net mvc that display an "island" of data?

I am trying to find out how to use usercontrols in asp.net mvc. I know how to add a usercontrol to a view and how to pass data to it. What I haven't been able to figure out is how do you do this without having to retrieve and pass the data in every single controller? For example, if I have a user control that displays the most recent ...

C# - Can't resolve XInput namespace in DirectX SDK (November 2008)

Hi, i'm just starting to play around with directx and i've read a few articles on the internet that use xinput to interface with the xbox controller. but when i try to use it in my c# app, i can't seem to find the correct assembly to reference. from what I understand, it's supposed to be in Microsoft.DirectX.dll (namespace Microsoft.Di...

[MVC] What's the preferred URL to add an entity that is not an aggregate root?

Example: an Order object (aggregate root) has a collection of OrderLine objects (child entities). What's the URL add an OrderLine to an Order? Take into consideration the difference between using the aggregate roots' controller and having a separate controller for the child entity. 1: http://example.com/orders/add-orderline?order-id=42&...

In game development, is the controller in MVC purely for dealing with user input?

I've read conflicting things on this. From Wikipedia: Controller Processes and responds to events, typically user actions, and may invoke changes on the model. It's the word TYPICALLY that is confusing. If not just user input, then what else? ...