Questions tagged [model-view-controller]

1

votes
1

answer
601

Views

How validate data from post in restful api

I need to validate some data before insert into the database, for that i create a little service that return invalid fields from an entity. It works ok when validating single entities. class EntityValidator { protected $validator; public function __construct(ValidatorInterface $validator) { $this->v...
fajuchem
1

votes
1

answer
436

Views

Python - PyQt5 - MVC

I'm creating my first application in Python. Currently I'm implementing the first view with PyQt5 and the MVC pattern. Therefore I created a 'main' class that is starting the controller by creating a new controller object (The first programming language I learned was Java, so maybe this is not necas...
DummerTroll
1

votes
2

answer
42

Views

Should multiple Spring controllers direct to same view file?

Suppose in Controller A, I have @GetMapping('/path/1') public String getIndex() { //it's own unique logic ... return 'path/to/file'; } and in Controller B, I have @GetMapping('/path/2') public String getIndex() { //It's own unique logic ... return 'path/to/file'; } Is it a good practice to have two...
John Doe
1

votes
2

answer
81

Views

JSON string from server side not coming properly using ajax jquery

What I am doing is, i am getting data from server side using mvc. The data is properly coming in return part. But when I m debugging in the client side, I am only getting the parameter value as [. Below is the JSON response which I am getting. [{'VENDORNAME':'ABC','VENDORCODE':'1234'},{'VENDORNAME':...
B N
1

votes
2

answer
48

Views

Observer Pattern on MVC for specific fields

On the MVC pattern, which is the best option for the Model to notify the View (if this is the right approach in the first place) where, from all the fields of data the Model is storing, only a couple of them are updated. Specifically when we only want to update specific fields of the View. I am curr...
Fred
0

votes
0

answer
11

Views

Have a sql statement that is executing twice on IIS but once on MSVS, why?

I have a sql statement that executes twice when posted to the IIS, but it only executes once when in MSVS I am not sure why it works in one but not the other. Some other information I have a wildcard SSL that is attached to the server, and I only see one post request in the network Log. The actual...
Danimal
0

votes
0

answer
13

Views

HttpClient - An existing connection was forcibly closed by the remote host - IIS Published web app

I have tried a ton of solutions that I searched about this issue, but none of them fixed my web app. So, I have a web app that uses a vendor API to populate my data. I was able to successfully connect to the API and transact different kinds of API calls locally. After I completed my web app, I trie...
Lex
0

votes
0

answer
7

Views

Improving the relevance of production errors reporting

The support mailbox became unusable : In our mvc application, we catch exceptions thrown at several places (OnException implemented, try/catch in InvokeActionMethod, etc.) and we send a mail for each place (with a log4net appender). This results in an abundance of error mails in the common exchange...
Jean-Luc T.
0

votes
0

answer
6

Views

How to manage multiple clients website having same code structure but different UI?

I want to create websites for many colleges using MVC. Since coding structure will be common for all the client websites but the website templates will be different I need suggestions on handling this. Do I need to create a core framework for this and use the same for other website projects? If I do...
Karthik
1

votes
3

answer
4.2k

Views

Spring MVC - how to pass data from filter to controller

I use Spring MVC in my web application. For every request I'd like to prepare the environment, for example load some data from the datastore and save it so every controller could access that information. I assume that's what filters are for (among other things). I can attach an information to the re...
tobik
1

votes
1

answer
954

Views

Umbraco Surface Controller Not Routing Correctly

I have a bit of trouble getting a surface controller to fire correctly. public class SocialShareSurfaceController : Umbraco.Web.Mvc.SurfaceController { public ActionResult Index() { return Content('hello world'); } } I'm trying to get to the controller via this URL: http://website.local/umbraco/surf...
Ayo Adesina
1

votes
1

answer
61

Views

Kentico 12 MVC ComponentDefinitionProvider Warning

Does anyone know what the 'ComponentDefinitionProvider' in K12 is and where I can disable this feature? I do not use it and I get warnings in the event log. I would like to disable it to stop this.
Elmar Höfinghoff
1

votes
2

answer
43

Views

Javascript MVC, addEventListener cannot be attached to dom element

I have these javascript files. It is really small test project to understand how MVC works with javascript. When I try to click 'Delete Bloak' button, nothing happens except with last button, which has id of 100. The other buttons do not have any click event attached to them. Why? Controller.js var...
Oakar
1

votes
2

answer
40

Views

How to develop an edit option on hover of a div

I'm trying to use the hover option to display an small edit image/button in the top right hand corner of a div. I have a dynamically created table of x by y number of cells. What I would like to do is have a tiny edit button in the top right hand corner that allows me to click on that button and bri...
user1397978
0

votes
0

answer
2

Views

How to fix this ajax request to stop failing in MVC5

I'm the similar ajax requests to get other database info working. Perhaps its something minor that is causing the issue. Each time I execute this function it fails and throws the alert. It is returning the 13 user records stored in my database, during debugging I can see that these 13 records are al...
1

votes
1

answer
59

Views

Send data to another JavaScript file from a JavaScript file

I want to see the information of this admin in the panel when admin enters the panel. But there are more than one admin on the system. Therefore, I need to find the administrator who logs in to the system according to the mail entered from the login page. When I click submit button, I need to send t...
Engr. Arda
1

votes
0

answer
420

Views

sapui5 QUnit testing - how to use controller functions in my testcontroller

I am really new to the sapui5 language. And currently I'm starting with Qunit testing. My question is, how can I Import functions from other controlls to my test- controlls? e.g. in python there is an 'Import function from module'. this is my test for my configuration.controller this is my _getParen...
Not Me
1

votes
1

answer
1.9k

Views

Cannot find type definition file for 'node' error in angular

I am new in Anguar2. I am working on MVC Core. When I am trying to run my application after debugging, I can view the screen but after few seconds I am getting the following error: 'in E:\Websites2017\MVC\MVC6\Angular2ASPCORE\Angular2ASPCORE\node_modules\angular2-platform-node\node-location.d.ts (1,...
Partha
1

votes
0

answer
104

Views

MVC DropDownList Displays System.web.mvc.SelectListItem

I made a drop down list using @Html.DropDownList() But instead of displaying my list items, it displays System.web.mvc,selectlist item Here's the code: @{ List listItems = new List(); listItems.Add(new SelectListItem { Text = 'Department', Value = 'dep' }); listItems.Add(new SelectListItem { Text =...
Peer Sahab
1

votes
1

answer
1.5k

Views

ErrorException thrown with message "htmlspecialchars() expects parameter 1 to be string, object given Stacktrace: #59

ErrorException thrown with message 'htmlspecialchars() expects parameter 1 to be string, object given (View: G:\xampp\htdocs\Blog\resources\views\songs\index.blade.php)' Stacktrace: #59 ErrorException in G:\xampp\htdocs\Blog\vendor\laravel\framework\src\Illuminate\Support\helpers.php:577 #58 ErrorEx...
Istiyak Amin
1

votes
1

answer
136

Views

MVC Structure in swift

Do we need to create the Web services singleton class file out of the MVC folder, while following MVC Structure or it stays in Model folder together with the Mapper classes
Sushmita Sinha
1

votes
0

answer
19

Views

What exactly could be the reason that my .htaccess file disturbs my script (because of redirecting)?

I am programming a php model-view-controller. Basic structure: mvc | |app | |_ models | |_ views | |_ controllers | |web |_index.php |_css |_js ... As so I use my .htaccess file for redirecting the url: RewriteEngine On RewriteBase /mvc/web/ # Let any content of web be shown (css, fonts, images,...
po0l
1

votes
0

answer
45

Views

How do I properly segregate my View and Model in this specific use case

So I'm working through a MOOC, Stanford's 'Developing iOS 11 Apps with Swift', and in the course the professor highly emphasizes how important it is to separate your View from your Model in the MVC architecture. One of the assignments is a simple implementation of this game: Set. While I did decoupl...
Eric Groom
1

votes
1

answer
46

Views

MVC - Sequence contains no elements

Everything was working fine so far but I have started to get this error. Can you please help me what is wrong with the code. my product model public class Product : EntityBase { public Product() { this.Photos = new List(); this.OrderDetails = new List(); this.Suppliers = new List(); this.Comments =...
livefreeor
1

votes
3

answer
79

Views

How to reference this in closure

I am using PHP Version 7.1.1. In index.php of my MVC I create a route collection ($routes). To it I want to add a route group (with addGroup). This addition process relies on a closure (e.g. an anonymous function), passed as argument to addGroup. Inside of closure I am trying to reference the collec...
1

votes
0

answer
34

Views

ActionListener from controller doesn't trigger

I have an MVC with swing project with two views, a model and a controller. The controller has as fields a list of models, and a list of views. I tried to add a listener on a button from one of my views: private void initializeNewOrderListeners() { NewOrderView view = (NewOrderView) views.get(0); JBu...
user30771
1

votes
1

answer
81

Views

Is shared services right way to implement DRY in angular 2?

I am looking for implementing ERP frontend in angular 2. I have my exisiting implementation in codeigniter HMVC structure.From which I have converted all models/controllers calls in to REST APIS. The older structure was reusing lots of view component for CRUD operations in modules such as CRM, Acco...
jaydeep marvaniya
1

votes
2

answer
242

Views

Git - Error when trying to commit code From Eclipse

I've created a new dynamic web project in eclipse and am trying to connect it to a repository. I follow the steps of creating the git repository for the project and the project gets added to the proper directory I set for the repository. The issue is when I try to commit the files I keep getting an...
mustardtiger10
1

votes
1

answer
190

Views

Best practices to separate business logic from the Controller to the Model layer with Play framework + Scala + Slick

I am a newbie in using Play framework. I am struggling to design a model with one-to-many and retrieve it using Json. I am using Play 2.6, Scala 2.11 with Slick 3.0.0. I have two tables: Rack : case class RackRow(id: String, produced: Float, currentHour: Long) and Gpu: case class Gpu(id: String, rac...
Felipe
1

votes
0

answer
36

Views

Separate Data Mapper on Deeper Level & Single Action Class

I've seen lot of DataMapper example been made like this: namespace DataMapper; class UserMapper { protected $pdo; public function __construct(\PDO $pdo) { $this->pdo = $pdo; } public function getByUserId($user_id) { /* ... */ } public function store(User $user) { /* ... */ } } I was following those...
Rahman
1

votes
0

answer
53

Views

PHP building directory structure image and css errors

Sorry If this is basic but its really holding back my learning of correctly building a directory structure and I just cant figure out how to fix the problem. Consider the following structure: My Problem Whenever I create a file in the directory other than src my images and css paths gets messed up i...
Marilee
1

votes
0

answer
24

Views

Datapicker filter is not working

I am trying to filter by date using a Datapicker.I inserted the input form in the table head and i have an input form only for date. When i click on the form, it appears the calendar to choose a date, but when i click the date it does not show results for that date. I am also using datatables. Thi...
Raina
1

votes
0

answer
34

Views

When Web API is called from same project is working fine. But when I call same API from another project in same machine, it is giving 405 method

First time when I created Web API project(MVC pattern) and I created few API controllers and called from html page(Ajax call),I am able to call all APIs and get the data. But second time I've created two separate solutions one is asp.net Web API and another is MVC Web application. Now I'm running b...
as90
1

votes
0

answer
311

Views

How to solve assertion error status 404 in web mvc test

I have a controller like this ,This seems to be a problem with Spring boot No one has been able to solve this issue , The same issue was raised by another user , check link Error when using @WebMvcTest annotation on a Spring Boot test class @Controller @RequestMapping('/book') public class BookContr...
valik
1

votes
2

answer
193

Views

ruby on rails: undefined method `_path'

I'm getting the error from line #7 of my views when I'm trying to create a new room: undefined method `rooms_path' for # I'm a little confused about why am I getting this error. I have built a relationship between Room and Facility that each Facility has many Rooms. The Facility part works bug free,...
Stella Han
1

votes
1

answer
4.2k

Views

Laravel 5.5 - Passing form's Data to Controller then Passing Data from Controller to the same View

I give up ! 2days i'm looking for solution for my problem. All I need is pass FORM Data to Controller, then just show it on the same View. Easy, right ? But i can not find any solution and Laravel's Manual does not explain that clearly... So this is my View with the form : form.blade.php {{-- Here...
Kamil Lonowski
1

votes
0

answer
101

Views

Show Out Of Stock text in Magento

I need to add on my dropdown list an style into thee out of stock text, im already using this: if (count($productsIndex) == 1) { $stockItem = Mage::getModel('cataloginventory/stock_item') ->loadByProduct($productsIndex[0]); if ($stockItem->getQty() == 0) { $value['text'] .= ' Out Of Stock'; } } $inf...
lucasvm1980
1

votes
1

answer
27

Views

How to model data for similar requests?

I have an issue, I'm not sure how should I model the data from the backend when I have some really similar views on the front, particularly some forms. For example in one of them the user sends an id for a seller and a product code, but in another one the inputs ask for an id seller, a product code,...
Alex D.
0

votes
0

answer
3

Views

PHP MVC: Choose .env or .yaml files for sensitive data in MVC application?

Currenly, in my web MVC application I have a pretty flexible configuration system, with configuration settins defined in .php files (in a config directory). Though, sensitive data (like db credentials, etc) is saved in some .env files, as CONSTANT_NAME= pairs. Technically, these values overwrite any...
dakis
0

votes
0

answer
4

Views

Accept.js POST is causing part of my model to have null properties

I'm using the Accept.js credit card form in their Sandbox environment. I was able to get everything to work yesterday such that when i post and hit our API all of the MVC model properties were filled like i expected. However, today, suddenly there are several properties that are null but some are...
crodgers123

View additional questions