model-view-controller

Thunderdome MVC- Why one-model-in in MVC?

删除回忆录丶 提交于 2019-12-23 08:53:22
问题 When Jeremy & Chad posted about their FubuMvc project, one of the differentiators they mentioned was their "Thunderdome Principal": The “Thunderdome Principle” – All Controller methods take in one ViewModel object (or zero objects in some cases) and return a single ViewModel object (one object enters, one object leaves). The Controller classes will NEVER be directly exposed to anything related to HttpContext. Nothing makes me cry like seeing people trying to write tests that mock or stub that

Passing a large HTML string from View to Controller

好久不见. 提交于 2019-12-23 08:46:27
问题 Note: I'm a front-end developer wearing a .Net developer's hat for now. Laughable, I know, but how I ended up in this mess is not the point of this question. With that disclaimer out of the way, here's what is happening. As the title suggests, I need to pass a quite long HTML string (as in multiple pages of text) from a View to a Controller. I spent the last few days researching various ways to achieve this. TBH, some things made sense while some didn't. Here's my code piece inside View : var

Passing a large HTML string from View to Controller

╄→гoц情女王★ 提交于 2019-12-23 08:46:16
问题 Note: I'm a front-end developer wearing a .Net developer's hat for now. Laughable, I know, but how I ended up in this mess is not the point of this question. With that disclaimer out of the way, here's what is happening. As the title suggests, I need to pass a quite long HTML string (as in multiple pages of text) from a View to a Controller. I spent the last few days researching various ways to achieve this. TBH, some things made sense while some didn't. Here's my code piece inside View : var

How can I access a CodeIgniter configuration variable from a model/controller?

早过忘川 提交于 2019-12-23 07:39:05
问题 I would like to access the $db['default']['dbprefix'] variable from /application/config/database.php (CodeIgniter configuration file) from within a model so I can write my own queries using the value from the file. How can this be done? 回答1: Try: $this->load->database(); echo $this->db->dbprefix; Normally you can use $this->config->item but I think that only allows variables set in $config 回答2: The documentation says you should be using: $this->db->dbprefix('tablename'); Doesn't make a huge

Why isn't Ajax sending data?

六眼飞鱼酱① 提交于 2019-12-23 06:40:07
问题 The following Ajax code doesn't even trigger my action if the input variable (a) isn't set to Null. Ajax code: var ab = "Chocolate Smoothies ya know?"; $("#customerSubmit").submit(function (e) { e.preventDefault(); $.ajax({ url: "/api/Booking/lander", method: "post", data: { a: ab } }) }); The following my controller code: [HttpPost] public void lander(string a) { System.Diagnostics.Debug.WriteLine(a); } And when I do not set it to null, the input received is null. screenshot when the

delete uploaded file from an array of id when they are delted in joomla?

℡╲_俬逩灬. 提交于 2019-12-23 05:41:51
问题 I am trying to delete an array of ids and when it gets deleted I want the uploaded pic associated with it also to get deleted using unlink. I am using joomla and mysql for the admin mvc component in joomla. My code for controller in remove is has follows: function remove() { $arrayIDs = JRequest::getVar ( 'cid', null, 'default', 'array' ); //Reads cid as an array $model = & $this->getModel ( 'greetings' ); jimport ( 'joomla.filesystem.file' ); if (is_array ( $arrayIDs ) && count ( $arrayIDs )

delete uploaded file from an array of id when they are delted in joomla?

柔情痞子 提交于 2019-12-23 05:41:35
问题 I am trying to delete an array of ids and when it gets deleted I want the uploaded pic associated with it also to get deleted using unlink. I am using joomla and mysql for the admin mvc component in joomla. My code for controller in remove is has follows: function remove() { $arrayIDs = JRequest::getVar ( 'cid', null, 'default', 'array' ); //Reads cid as an array $model = & $this->getModel ( 'greetings' ); jimport ( 'joomla.filesystem.file' ); if (is_array ( $arrayIDs ) && count ( $arrayIDs )

Java MVC multiple JFrame

ⅰ亾dé卋堺 提交于 2019-12-23 05:26:18
问题 I am creating an mvc java application with netbeans . first, when running the program, it should be only show 2 buttons "Teacher" & "Student". when I click the teacher button , it will leads me to viewTeacher where i can input or edit data about "Teacher" . same goes for student button. I have finished the whole MVC but I am confused about the first buttons: - should I make more 1 view? viewForm, viewTeacher, viewStudent. viewForm is the first 2 buttons appear: "Teacher" & "Student" OR -

Java keeps adding buttons! - JFrames - [closed]

人走茶凉 提交于 2019-12-23 05:25:30
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . Alright, so, I am trying to make a game using a JFrame that, when you click a button, adds money, and show update some text(a JLabel ). You see, it should just update the Windows.Money variable and display ONLY the new variable on the screen, but, it adds more buttons. Please note: The money part

Symfony business logic

空扰寡人 提交于 2019-12-23 05:12:06
问题 In symfony, I see some coders put business logic in the actions ( controllers that is ), and some coders put it in the models ( Doctrine ). Where should the business logic belong, in the controller or model? What if I didn't use Doctrine, and it was just plain text files? 回答1: Put the business logic in the controller is a bad pratice, the model is home for it. If you don't have Doctrine, you can still have entities, model classes of your own (you should). Your files can be abstracted, and