model-view-controller

ASP.NET Master Pages equivalent in Java

烂漫一生 提交于 2020-01-21 03:27:43
问题 What would be the Master Pages equivalent in the Java web development world? I've heard of Tiles, Tapestry and Velocity but don't know anything about them. Are they as easy to use as Master Pages? I want something as easy as set up one template and subsequent pages derive from the template and override content regions, similar to Master Pages. Any examples would be great!! 回答1: First, the equivalent of ASP.Net in Java is going to be a web framework, such as the ones you mention (Tiles,

MVC DDD: Is it OK to use repositories together with services in the controller?

寵の児 提交于 2020-01-21 01:46:53
问题 most of the time in the service code I would have something like this: public SomeService : ISomeService { ISomeRepository someRepository; public Do(int id) { someRepository.Do(id); } } so it's kinda redundant so I started to use the repositories directly in the controller is this ok ? is there some architecture that is doing like this ? 回答1: You lose the ability to have business logic in between. I disagree with this one. If business logic is where it should be - in domain model, then

PHP MVC: Multiple databases, multiple data mappers?

风流意气都作罢 提交于 2020-01-17 13:57:14
问题 I am working on my HMVC project. Right now I am using data mappers in order to move data between the models (domain objects) and a MySQL database. Each mapper receives a MySQL adapter as dependency. The injected adapter receives a PDO instance (a database connection) as dependency and runs sql queries on the database. I also use a dependency injection container (Auryn). I'd like to be able to simultaneously retrieve data from storages of different types (MySQL database, PostgreSQL database,

PHP MVC: Multiple databases, multiple data mappers?

落爺英雄遲暮 提交于 2020-01-17 13:57:10
问题 I am working on my HMVC project. Right now I am using data mappers in order to move data between the models (domain objects) and a MySQL database. Each mapper receives a MySQL adapter as dependency. The injected adapter receives a PDO instance (a database connection) as dependency and runs sql queries on the database. I also use a dependency injection container (Auryn). I'd like to be able to simultaneously retrieve data from storages of different types (MySQL database, PostgreSQL database,

Setting model attributes for every action within each controller

余生颓废 提交于 2020-01-17 09:11:27
问题 I would like to set three common attributes on my model for each @RequestMapping within the many controllers in a Spring Boot application. I have read about @ModelAttribute but it needs to be placed within each Controller. I have more than 20 controllers in my application and each having more than 10 @RequestMapping . Is there a way to set such model attributes in one place which gets initialized at the start of the application? 回答1: If you want to execute some code on Spring Boot startup,

Pass a variable from view to model in mvc

旧城冷巷雨未停 提交于 2020-01-17 08:15:06
问题 I am trying to build a comment system. The database structure TABLE `posts` ( `post_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `post_text` text NOT NULL, `user_id` int(11) NOT NULL, `post_creation` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`post_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; TABLE `comments` ( `comment_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `comment_text` text NOT NULL, `comment_creation` TIMESTAMP NOT NULL ON UPDATE CURRENT

PHP MVC Structure

社会主义新天地 提交于 2020-01-17 07:20:45
问题 As part of a university project I'm developing a web application in PHP and trying to follow MVC principles as much as possible. I'm not using an off-the-shelf framework because I want as much of the project to be my work as possible to help get a higher mark. To delete an item (each item has an id, status, title, parent_id) from a database I go do the following process.... User hits a delete button and is asked to confirm When clicking confirmed a "page" loads which calls the controller,

zend 2: Automatically inject a template for all actions of a module without modifying site wide configuration

给你一囗甜甜゛ 提交于 2020-01-17 06:22:12
问题 I am using the Zend skeleton application. I want to have a sub menu bar (via a template) injected underneath the default site wide menu bar, but I don't want to modify the site wide app settings, I'd like to just have it in the module. Looking at examples it seems I would have to manually inject the menu bar template in each of my controller's actions and in every template where I want it to appear like this: public function indexAction() { $view = new ViewModel(); $subNavView = new ViewModel

zend 2: Automatically inject a template for all actions of a module without modifying site wide configuration

落花浮王杯 提交于 2020-01-17 06:22:12
问题 I am using the Zend skeleton application. I want to have a sub menu bar (via a template) injected underneath the default site wide menu bar, but I don't want to modify the site wide app settings, I'd like to just have it in the module. Looking at examples it seems I would have to manually inject the menu bar template in each of my controller's actions and in every template where I want it to appear like this: public function indexAction() { $view = new ViewModel(); $subNavView = new ViewModel

Calendar object won't update in database but does update within session

邮差的信 提交于 2020-01-17 06:11:06
问题 I'm representing Appointments in an entity bean which have a startTime and endTime of type Calendar . This is stored using JPA as TIMESTAMP . If I edit the Appointment object's start / end time it updates on the object itself during the session but it's not updated within the database itself. Other elements such as the Appointment's description successfully update in the database.. It's only he start and end time which are not. Entity class (this is indirectly updated in the database with