controller

View strongly typed to View model not returning Model back to controller on postback

I have a PartialView strongly typed to a view model <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<VATRateManager_MVC.Models.ViewModels.RateControlEditViewModel>" %> <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascri...

grails: maintain transactional context from Service to Controller

Hi Have a transaction in a grails Service class on which a rollback flag is set: TransactionAspectSupport .currentTransactionInfo() .transactionStatus .setRollbackOnly() what happens is that when we return to the Controller an exception: org.springframework.transaction.UnexpectedRollbackE...

rails page titles

I don't like the way rails does page titles by default (just uses the controller name), so I'm working on a new way of doing it like so: application controller: def page_title "Default Title Here" end posts controller: def page_title "Awesome Posts" end application layout: <title><%=controller.page_title%></title> It wo...

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<CoolObject, CoolObjectViewModel>(); Where can I place the mapping declarations so they will only be called once and not every ...

How do I call other Controllers within a Zend Framework Process and retrieve their rendered view?

Hi there, I have the following setup: An endless running PHP process that looks at a job queue which contains module names, controller names, action names and a parameter array. For every job I want to call the given controllers action and retrieve the rendered view for further processing. I was thinking about bootstrapping an instan...

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: 'migratedDate', order: 'asc') { between ("migratedDate", dat.minus(1), dat) } and counti...

ASP.NET MVC controller parameter optional (i.e Index(int? id))

I have the following scenario: my website displays articles (inputted by an admin. like a blog). So to view an article, the user is referred to Home/Articles/{article ID}. However, the user selects which article to view from within the Articles.aspx view itself, using a jsTree list. So I what I need to do is to be able to differentiat...

PostgreSql + btrim function is not working properly

Here, I have probleming in trim the value in postgresql. Please have a look. Ruby code :: if(this.modelName=="ClientOffice") { this.params="model_name="+this.modelName+"&action_name="+this.actionName+"& find_condition=btrim(clients_corporate_billings.id,' ') %3D btrim('"+validString('populateValue0','text')+"',' ') & ob...

CakePHP: Fields not populating in Edit screen

Simple question from an absolute n00b. I'm trying to create an edit content screen based on the code given in the Blog Tutorial on the Cake site. Here's my edit function in the controller (it's named Contents): function edit( $id = null ) { $this->Content->id = $id; Debugger::dump( $this->Content->id ); if( empty( $this->...

One model and controller but slightly different views and routes in rails3

I have a model Notifications, and it basically handles the same few things. A simple contact form, an invitations form, etc. They all have the same generic items... ie Name, email, comment, blah. There might be one slightly different field but they are optional, so I'd like to treat them as one model with a differentiating field calle...

Adding "Featured Posts" to my blog...

I am trying to add a featured post feature to my Ruby on Rails Blog. So far I have added a featured_post column to my post table and it passes a 1 if the check box is selected and 0 if not. Now I am attempting to pull out these posts by doing the following: /views/posts/index.html.erb <% @featured_post.each do |post| %> <%= pos...

rails update redirecting to wrong controller

I have a model for a task which has a name, description, the process it belongs to, the position and a category. As there are only two different categories I have created additional controllers specific to the categories as they need to be treated differently. when i submit the edit form in one of the category controllers it is redirect...

Programming a game controller

Hello, I looking to use a controller to operate an underwater robot. I would like to use a joystick with several buttons. I would like to program a pic and make my own circuit board. I am not using a computer. Where do I look to for help on programming a pic? Thanks, Cory ...

How do I update all other records when one is marked as default?

I am trying to change all of the default_standing fields to FALSE for all other records when someone marks one as TRUE. That way I will only ever have one default record in the table. Here is what I am doing in both create and update in my controller, but it doesn't seem to be working: def update @standing = Standing.find(params[:...

Can JSF2 use beans as request-based controllers without a framework?

Hi! I'm working on the development for a web application using Java Server Faces for a group project. The majority of us have experience using request-based frameworks in PHP and we are having problems getting into the event-based (?) mindset of JSF-development. In PHP you would generally have a front controller (like the Faces Servlet...

Grails: How does that the UPDATE function work?

I got rid of the original UPDATE gsp Grails offers. I put it in the first row of my list.gsp table and change all the values of the table to g:textfield so they can be edited without going to the save.gsp But now I'm trying to make it work, and I can't. I added a update button in the last column of the row, of every row. When I chang...

Controller action is called twice

I've noticed, that "index" action of my controller is called twice. The action has following structure: def index if params[:tags].nil? # [fork #1] just return the whole collection of model @items = Item.all else # [fork #2] filter items by tags @items = Item.select_by_tags params[:tags] end # Another oper...

Is it possible to access Spring MVC annotated session vars across multiple controllers?

I have a web app running Spring 3.0 and using Spring-MVC. I have a few controllers set up like this: @Controller @RequestMapping("/admin") @SessionAttributes({"clientLogin", "selectTab", "user", "redirectUrl"}) public class AdminController { ... } @Controller @SessionAttributes({"clientLogin", "selectTab", "user", "redirectUrl"}) publi...

AJAX form is not passing through params[:id]

I'm using a simple ajax toggle partial in a view, to allow a user to toggle a message as read vs. unread. When I toggle I get a failure. MessagesController#show could not find MessageCopy without an ID. Application trace: messages_controller.rb:21 in 'show' (first line of the action) show.html.erb <%= render :partial => "read_unread_...

How can I call a controller method in a view or another controller?

I have main controller, that print main page. <? class Main extends Controller { function Main() { parent::Controller(); $this -> load -> helper('date'); } function index() { $this -> load -> view('header'); $this -> load -> view('main'); $this -> load -> view('footer'); ...