model-view-controller

How should changes to MVC objects be propagated?

泪湿孤枕 提交于 2020-01-16 04:45:11
问题 This is a follow-up to a previous question: Should sub-objects be fetched in the Model or the Model Mapper? Let's say a User can have one or more PhoneNumber objects. According to the answer in the above question, these sub-objects will be fetched upon instantiation of the User. If I were to delete a PhoneNumber from the User's phoneNumbers property (an array of PhoneNumbers), or modify one of the PhoneNumber objects, where should this change be propagated? Should I manually delete/update the

Can't get past “A jquery script reference is required in order to enable Ajax support in the ”WebGrid“ helper”

瘦欲@ 提交于 2020-01-16 04:16:24
问题 I am having a similar as the user here: ASP.NET MVC 3.0 WebGrid - Ajax Enabled and here: http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/22be0501-1b0b-496a-9d0c-f9f5138996ac However none of the suggestions from those threads is helping here. The specifics: When running in my local debugger on my Windows 7/IIS 8 machine, I am getting the 'A jQuery script reference is required in order to enable Ajax support in the "WebGrid" helper' message after an ajax postback trying to

How do I change the records being displayed on the page with buttons on the page (RoR)

只愿长相守 提交于 2020-01-16 02:12:57
问题 I have a rails app that shows statistics based on an employee's daily production. currently my page shows ALL records. I know how to show various different combinations such as records made between two dates etc... but what I really would like to do is make it so that single page (say the index page) has 3 controls that allow for it to switch between daily statistic records, weekly statistic records and a custom date constraint of statistic records (such as from date xx/xx/2009 to date xx/xx

DDD and domain interfaces/classes

那年仲夏 提交于 2020-01-16 01:03:21
问题 In my application I have an assembly - MyApplication.Core which contains all of my domain objects - Customer, Order etc, as well as interfaces for repositories - ICustomerRepository, IOrderRepository I have another assembly - MyApplication.Data which contains concrete implementations of those interfaces - OrderRepository etc. The repositories are responsible for retrieving data from the DB and presenting it using the domain objects. One thing I'm not sure about is whether my domain objects

spring mvc- form submit back button

允我心安 提交于 2020-01-15 12:26:28
问题 I have a simple jsp form (page1.jsp)that allows the user to enter a bunch of textboxes. The submit button posts the form and displays page2 On Page2- there is a tab called Page1- on clicking this tab, the user should be able to view page1 with all the information that he entered, so that he can edit it ,if he chooses to. I have my controller set up for the first part page1- page2, working correctly. However I am not sure how to implement the second part page2 ->page 1. I am unable to show the

Progress reporting from background task

强颜欢笑 提交于 2020-01-15 12:15:37
问题 I have a background task that imports files into a database. I want the user to see what is currently happening (collecting files/ importing files), which file is currently processed and how far the task has progressed. How can I do this in an easy way? The interaction between Model and Controller is so close, that I could almost put the importing code into the window's code file and change the progress bar value etc. directly. What do you think? How would you solve this problem? 回答1: Use a

How to return an error message from the Model?

柔情痞子 提交于 2020-01-15 11:45:30
问题 In suppliment to this question, if business logic should be in the model, how do I return an error message from the model? def save(self, *args, **kwargs): if <some condition>: #return some error message to the view or template 回答1: Pastylegs is correct, but you shouldn't be doing that sort of logic in the save method. Django has a built-in system for validating model instances before saving - you should use this, and raise ValidationError where necessary. 回答2: Raising an exception is the way

Most efficient way to implement a 'logged-in' check with MVC in PHP?

一笑奈何 提交于 2020-01-15 10:41:47
问题 I know questions similar to this have been asked, but I have been searching through the internet and I can't seem to find exactly what I'm looking for. The most common answer is to put it in the controller. I liked a particular solution from stackoverflow that had a SessionController and NonSessionController , both extending the main controller but with SessionController checking if the user is logged in before the dispatch. Does this mean that the controller would look something like this?

Return a generic list to the MVC Controller

混江龙づ霸主 提交于 2020-01-15 10:13:10
问题 I have a class that looks like this; public class item { public string Tradingname { get; set; } } I have a Partial View that inherits from the "item" class; <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<item>" %> <%= Html.TextBoxFor(x => x.Tradingname) %> In my view I create a number of them. Let's Say 2; <% using (Html.BeginForm()) { %> <% Html.RenderPartial("TradingName", new Binding.Models.item()); %><br /> <% Html.RenderPartial("TradingName", new Binding.Models.item(

How to parse JSON received in MVC Controller

陌路散爱 提交于 2020-01-15 04:35:07
问题 I have a JSON file that is being sent to an MVC controller via a POST request from the client side. Since there isn't a direct way to store JSON in C#, I'm trying to create models to store the data. Here is the structure of the JSON: { "SubscriptionsType1": { "Obj1": { "Value1": "3454234", "Value2": "345643564", "Value3": "665445", "Value4": "True" }, "Obj2": { "Value1": "3454234", "Value2": "345643564", "Value3": "665445", "Value4": "True" }, "Obj3": { "Value1": "3454234", "Value2":