model-view-controller

MVC pattern with java Swing

二次信任 提交于 2019-12-24 01:15:51
问题 I have an Idea to develop a java Swing application using the MVC pattern. I have described my idea below and please let me know that, is this a correct way of using the MVC pattern for java Swing? this is the view following methods are used to get and set the name of the above view, //at top of the view its model and controller is defined as Model model = null; Controller controller = null; //constructor public view(){ this.model = new Model(); this.controller = new Controller(this, model);/

MVC pattern with java Swing

房东的猫 提交于 2019-12-24 01:14:13
问题 I have an Idea to develop a java Swing application using the MVC pattern. I have described my idea below and please let me know that, is this a correct way of using the MVC pattern for java Swing? this is the view following methods are used to get and set the name of the above view, //at top of the view its model and controller is defined as Model model = null; Controller controller = null; //constructor public view(){ this.model = new Model(); this.controller = new Controller(this, model);/

C# Google OAUTH2 using OWIN on Mono results in “System.Web.HttpException (0x80004005): headers have already been sent”

社会主义新天地 提交于 2019-12-24 01:13:16
问题 I've followed a number of tutorials for adding google OAUTH2 authentication to an existing MVC project, but I end up with the same issue involving a 404 to the client and the following trace generated: System.Web.HttpException (0x80004005): headers have already been sent at System.Web.HttpResponse.set_StatusCode (System.Int32 value) [0x00012] in <d31574f4ab6745f49b1626160268508f>:0 at System.Web.HttpResponseWrapper.set_StatusCode (System.Int32 value) [0x00000] in

c# mvc: Persisting data from View to Controller and then via single object for List<ViewModel>

点点圈 提交于 2019-12-24 01:08:59
问题 I am working with a View that returns List<ViewModel> to the Controller 's Create action method. Questions: Is it correct to return List<ViewModel> to the controller? The reason I am doing is that I have to make multiple rows entry to the DB for each user. 2. My Controller implemenation is incorrect because I am trying to add data through single User object where I have recieved List of ViewModels which is only the representation of the View for single user. So how the controller should be

How to resolve 'The access token has expired but we can't refresh it' in MVC

╄→尐↘猪︶ㄣ 提交于 2019-12-24 00:57:32
问题 I'm currently working on Google Api which aims to get the circles of a loggedin person.I already have the access token but the problem is whenever I try to run my code it returns this exception The access token has expired but we can't refresh it How do I resolve this issue? var claimsforUser = await UserManager.GetClaimsAsync(User.Identity.GetUserId()); var access_token = claimsforUser.FirstOrDefault(x => x.Type == "urn:google:accesstoken").Value; string[] scopes = new string[] {PlusService

In a PHP MVC, what's the correct way of passing controller data to model classes?

南楼画角 提交于 2019-12-24 00:48:44
问题 In the PHP MVC I'm currently developing, the base controller checks if a user is logged in and, if so, updates its properties (see code). Since these properties are used in various methods of model classes, I'd like to pass them from the base controller to the (base) model. What's the proper way of doing this? class Controller { protected $user_logged_in = false; protected $logged_in_user_id = null; function __construct() { if(isset($_SESSION['user_id'])) { $this->user_logged_in = true; $this

Proper model-view-controller design

笑着哭i 提交于 2019-12-23 23:53:14
问题 I have a Java project that I'm trying to implement with a model-view-controller design. I have the backbone of all of the components established. I'm having some trouble deciding on how to connect it all together, particularly the view and the controller. I have a class called MainView that extends JFrame . I have various other classes that help make up the MainView each of which extends JPanel . As an example one of these classes is called ParameterView . Should I allow the controller to see

Spring - using applicationContext.xml and XXXXX-servlet.xml

为君一笑 提交于 2019-12-23 23:19:36
问题 I am integrating Spring MVC into an existing project I have been working on. By integrating, I mean I am rewriting the project using Spring, and using much of my old code. I have already setup the environment and have began working on it. I will refer to this project as ProjectX . I have already setup and configured my ProjectX-servlet.xml that holds the view-resolver bean, and the controller beans, etc. I want to set up an applicationContext.xml file that I can place all my DAO beans in such

In a MVC web application, who is responsible for filtering large collections of objects, view or model?

妖精的绣舞 提交于 2019-12-23 22:29:55
问题 I have a web application built on an MVC design. I have a database which contains a large number of objects (forum threads) which I can't load into memory at once. I now want to display (part of) this collection with different filters in effect (kinda like what stackoverflow does with questions sorted by date, votes, tags etc). Where do I implement the filtering logic? It seems to me that this must go into the model part of the application, as only models interact with the database (in my

Observer Pattern in MVP

空扰寡人 提交于 2019-12-23 22:28:03
问题 I have a System (game) which I try to implement using the architecture Model-View-Presenter. What I have done right now is a while loop in the presenter that calls continuously the view methods for displaying. The way I do this is using a Producer/Consumer pattern, where the View register and event handler for touch events(Android) and produce the corresponding touch imstances, that the presenter consumes in the while loop. Now I would like to use the pattern Observer/Suscriber between The