mvc

Why do so many MVC web frameworks favor grouping multiple controller actions in a single class?

My experience is mostly limited to PHP, yet as far as I know both Rails and ASP.NET MVC have taken the same path. The point is that nearly every web framework I've ever come across implements controller actions as methods, e.g. create, edit, show, etc. These methods reside in a single class like PostsController, but they hardly ever sha...

Remove a list of selected items in the QListView

Hi. How can I remove a list of selected items in the QListView in QT 4.6. Something like this does not work, the iterator becomes invalid: QModelIndexList indexes = ui.listview_files->selectionModel()->selectedIndexes(); foreach(QModelIndex index, indexes) { model->removeRow(index.row()); } removeRows also not suitable, it...

Passing models in array format to views in YII

How can I pass the model in array format. I want to pass models in this format from controller to view:- Users[user_contact]=Contact Users[user_contact][contat_city]=City Users[user_contact][contact_state]=state This is what I am doing public function actionCreate() { $user = new Users; $presContact = new Contacts; $presCi...

Filter through model or dao?

How should one go about filtering a series of domain objects according to user-defined criteria? Should the filtering methods be in the model or should they be in the DAO? ...

PHP 5 - Securing an admin area of a site

I'm currently writing a couple of MVC sites using Kohana as my framework. Each has a simple admin area where the admin can upload and edit content. I'm currently storing the admin's user model in a session and checking whether or not they're an administrator with the following method: private function checkAdmin() { if (!isset($_S...

Asp .net mvc 2 forms authentication not working on iis 6. Need helps determining correct routes.

I'm trying to setup Forms Authentication in an asp.net mvc 2 application that will be hosted on IIS 6. There's an issue somewhere in my routing, but I can't pinpoint exactly where it is. Here is the route entries I'm using to route the mvc requests through the aspx processing on IIS 6. These may or may not be the "right" way, but they d...

Design/Implementation Problem -- Java/JSP/Servlets

Bear with me so I can explain the layout of my problem. I am working on a website/web application that involves customers searching for real estate information. One feature on the website involves the customer performing a search on one page(well call this page A) and the following page(Page B) returns a list of line items that represent...

Designing an application

I'm currently worried that my application design is somehow awkward, so I wanted to ask you how you design your applications. I'm using C# and WinForms (Don't have the time to get into WPF right now unfortunately) So I use a ProgramContext so I can have multiple Forms in the same Application and manage them. But the question is, where ...

C# MVC How to create dynamic DataTable?

public string DefString { set; private get; } private string path = "http://someuri.org/search?Par1=15&Par2=55"; public string GetAnswer() { WebRequest myRequest = WebRequest.Create(path); WebResponse myResponse = myRequest.GetResponse(); StreamReader sr = new StreamReader(myResponse.GetResponse...

.NET MVC - Windows Integrated Authentication + Authorization

Hi Guys, My question is similar to a crapload out there.. I have a simple app to be hosted internal to my company (accessed on the intranet). its an MVC app with windows integrated authentication. I have all the code to authorize a user against AD, but how do i implement this in the client (web.config + global.asax etc) Do i use the...

Could I make dynamic render rely User Permissions in MVC 2 ?

Hi. I make security system in mvc application. In MVC it must be done by AuthorizeAttribute and roles string via actions methods. Could i make this stuff: instead of action resolve I want to make view where html parts are hidden depend on current user permission set (For example: save button are not visible if user not Administrator). ...

How to integrate phpThumb into a CodeIgniter application's architecture?

I'd like to use phpThumb ( http://phpthumb.sourceforge.net/ ) on my view layer to automatically size some images. What's the recommended way to integrate phpThumb into the CodeIgniter architecture? Has anyone done this already and found that you prefer one method of integration over another? I'm basically looking for opinions on using ...

Is it possible to write shared libraries between iPhone, Android, Blackberry, Mac and Windows?

I'm tasked with "porting" a few apps from a Windows environment to various mobile platforms and Mac as well. I plan on writing MVC patterned apps in which I write as many controllers as I can in some sort of universal library, probably in C or C++. Then writing the views in various choice languages (Objective C, Java, .NET, whatever) fo...

Asp.net MVC utilising WCF

Looking into developing new startup with potential of hopefully having high volume. Initial idea was to straight away have MVC talk to WCF services to create our Application Servers. However after a little contemplating just wondering what benefits would I gain from using WCF services with MVC application? If performance became an iss...

Structuring several mostly-static pages in ASP.NET MVC

Might not be a very consequential question, but... I have a bunch of mostly-static pages: Contact, About, Terms of Use, and about 7-8 more. Should each of these have their own controllers, or should I just have one action for each? Thanks in advance. ...

asp.net mvc simple question

I'm creating asp.net mvc login page. This is simple. Same as others. Controller contains 2 method. My problem is I'm debugging First LogOn method. ReturnUrl has value. for example "Admin/Index". After debuggin Second LogOn method. But ReturnUrl is Null. public ActionResult LogOn(string ReturnUrl) // First method { return View()...

Function to display a DateTime string or an empty string

I tried to create a view helper which takes a DateTime object and returns a string. If the DateTime object equals a new DateTime(0), the function returns an empty string. Otherwise return a formatted DateTime string. This works so far. public static string DateTimeOrEmpty(this HtmlHelper htmlHelper, DateTime dateTime) { return date...

Javascript multiple file uploader error in Asp.Net MVC : cancel button doesn't work

i have error in CANCEL button in file uploader.The CANCEL button does't work if i tried to remove(cancel) ADD MORE FILE button. here is the javascript code: <script type="text/javascript"> function addFileUploadBox() { if (!document.getElementById || !document.createElement) return false; /*************...

Loading uploaded xml file into XmlDocument object (ASP.Net, MVC, C#)

Hello, Apologies for what might be a simple question; I'm getting back into coding after a seven year absence. Loving it, but everything is taking me so long! Anyway, I'm trying to upload a file from the browser and then read it into an XmlDocument object on the server. Originally I cracked this by saving the file to disk, reading it...

Struts 2: how to send JSON to action

How to send Json to action, on Struts2? ...