model-view-controller

Zend Framework 2: get matched route in view

别等时光非礼了梦想. 提交于 2020-01-10 18:43:21
问题 I'm currently learning ZF2 by developing a small MVC application roughly based on the skeleton app. Right now I'm trying to hide some fixed HTML elements based on the route matched: just as an example, I don't want the main menu to show during the login phase. I can do that easily by passing toggle parameters as return values from the controller actions, but it doesn't feel right, so I'd like to just check the matched route from the layout and compose the layout accordingly. Problem is, I don

How do you pass values between PHP pages for MVC?

偶尔善良 提交于 2020-01-10 16:59:30
问题 How do PHP programs pass values between model, view, and controller pages? For example, if a controller had an array, how does it pass that to the view? EDIT: Thank your answers. I see a couple of them stating the components are in the same page, but when I look at something like CodeIgniter, I see three separate PHP pages for model, view, and controller. 回答1: Usually your controller will create a view object and when it creates that view object it passes the information. <?php class

EmberJS: Good separation of concerns for Models, Stores, Controllers, Views in a rather complex application?

余生颓废 提交于 2020-01-10 14:18:25
问题 I'm doing a fairly complex emberjs application, and tying it to a backend of APIs. The API calls are not usually tied to any particular model, but may return objects of various types in different sections of the response, e.g. a call to Events API would return events, but also return media assets and individuals involved in those events. I've just started with the project, and I'd like to get some expert guidance on how best to separate concerns to have a clean maintainable code base. The way

EmberJS: Good separation of concerns for Models, Stores, Controllers, Views in a rather complex application?

陌路散爱 提交于 2020-01-10 14:16:16
问题 I'm doing a fairly complex emberjs application, and tying it to a backend of APIs. The API calls are not usually tied to any particular model, but may return objects of various types in different sections of the response, e.g. a call to Events API would return events, but also return media assets and individuals involved in those events. I've just started with the project, and I'd like to get some expert guidance on how best to separate concerns to have a clean maintainable code base. The way

Two controllers for one shared view in Ruby on Rails

て烟熏妆下的殇ゞ 提交于 2020-01-10 07:54:07
问题 I have two controllers for two respective models, by example, photos and categories. index and show methods are very similar in each controller, and the views are identical. What is the best method for share the view by the two models? I've though two options: Use a helper. In the helper will put the code for the view, and will call the helper from each view (photos/views and categories/views) Use a partial in each views. I think it's a more clean solution, but I see huge DRY's in my mind

Confusion in Struts MVC architecture

旧街凉风 提交于 2020-01-10 05:52:26
问题 I am studying the Struts2 in Action and come to know that Controller in Struts2 is FilterDispatcher and Model is Action. But previously I knew that Action and FilterDispatcher both are Controller and Struts does not provide support to model layer. Which one of the above is wrong? 回答1: I would say that FilterDispatcher is a FrontController and Action is both Model and Controller in one class. 回答2: Actually Struts2 actions are controller delegates. And Struts2 provides a value stack on the view

Implementing the Controller part of MVC in Java Swing

六月ゝ 毕业季﹏ 提交于 2020-01-10 05:37:07
问题 This question is around the standard practice for implementing the MVC architecture in Java - Swing particularly. I know this question has been asked before but I want to be a bit more specific around the use of the Controller. I've been separating my models, views, and controllers where: Data are processed within a model class Swing components are within a view class Event handling anonymous classes are also in the view class (user inputs) A controller class contains references to the model

Grails “respond” renders the wrong view when launched from .war file

谁说我不能喝 提交于 2020-01-10 03:19:42
问题 A Grails application has a lot of auto-generated (from standard Grails 2.3.0 scaffolding) code using the new RESTful "respond" feature. For example, the index methods generally look like this: def index(Integer max) { params.max = Math.min(max ?: 10, 100) respond Alpha.list(params), model:[alphaInstanceCount: Alpha.count()] } This works completely fine when the application is run as "grails run-app" however fails when the application is packaged as a .war and launched that way inside a non

How do I call Initialize on a custom MembershipProvider?

穿精又带淫゛_ 提交于 2020-01-09 09:02:57
问题 I have read through all the related questions, but I still unable to get the right solution for some reason, something is not right on my side, but not sure what's causing it. I have created a Custom Membership Provider, also changed my web.config to : <membership defaultProvider="MyMemberShipProvider"> <providers> <clear /> <add name="MyMemberShipProvider" type="MyNameSpace.MyMemberShipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset=

Spring MVC, Spring Security and Hibernate cannot autowire properties between contexts

南楼画角 提交于 2020-01-07 08:19:11
问题 I am using Spring MVC 3.0.6 and Spring security 3.0.7. I cannot @Autowire the RoleDao class to my user class when in the security context. my web.xml file: <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/spring/root-context.xml /WEB-INF/security-app-context.xml </param-value> </context-param> <!-- Creates the Spring Container shared by all Servlets and Filters --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener