I make static classes in servlet, these classes are controllers for web pages. Requests are redirected to controllers by controller urls that are in static HashMap that contains all controllers. Are there any posibilities that user/session realted stuff could get messsed up with other users sessions? I will of course save all session rel...
Hi Friends,
How can I access my lang variables in controller?
function index()
{
$seo_title = $this->lang->line('blablabla');
$data['page_title'] = $seo_title;
$this->load->view('contact/index.php',$data);
}
in my lang file blablabla has string in, and it works well when I call from view file. but when I want to call fro...
I was using some image cropping example that I found online and now I got confused. There is actually no "crop" method in my controller. Instead (following the guide) I put a
render :action => 'cropping', :layout=> "admin"
In my create method. That renders a page the view called cropping.html.erb . It works fine but I have no idea h...
Hello everyone,
I would like someone to explain me what _forward is exactly doing, I cannot see if _forward is also rendering the attached view to the action or just executing the action.
Also is it possible to pass argument to $this->action in a view script ?
More generally my problem is how to code a confirmation page, let's say t...
I have a RESTful resource in my Rails app called "Photo". I'm using Paperclip to serve different "styles" of my photos (for thumbnails and the like), and I'm using a custom route to RESTfully access those styles:
map.connect "photos/:id/style/*style", :controller => "photos", :action => "show"
That's working fine, but I want to write ...
If you have worked with some of the frameworks like CodeIgniter or KohanaPHP, then you probably have seen that they are built so that the controller loads everything. Therefore, if you are in a library and wish to load additional resources you must get a copy of the controller instance and then use that to load the additional classes.
$...
So I'm using the excellent Ancestry gem But while the documentation seems very complete I don't understand how to pass the parameter of my element which I want to be the parent of my newly created element. Firstly, do I want to do it in the new or create action... allow me to explain. For example: (with some actions removed for brevity)
...
What is a Controller in the context of Composite WPF?
...
Hi all,
Have a question about the design/usage of asp.net mvc here.
In the html helper class, you can get to the current controller by Html.ViewContext.Controller. Moreover, you can get to the request, route collection and much more from the html helper class.
Doesn't this go against the rule of MVC? Doesn't this opens up a ways for...
Hi all,
I tried to ask this once, but I think that my former question was too unclear for you guys to answer, so I'll try again
I'm making a website using the Zend Framework, and am trying to include the premade messageboard Phorum. So far, I've made it work by not running it through my bootstrap using my .htaccess file. What I'd li...
I want to test the OnException, OnActionExecuted event of an MVC controller.
If I use mock like this:
var httpContext = MockRepository.GenerateMock<HttpContextBase>();
var request = MockRepository.GenerateMock<HttpRequestBase>();
httpContext.Expect(c => c.Request).Return(request).Repeat.AtLeastOnce();
r...
Hi, i have the following base controller...
public class BaseController : Controller
{
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
if (something == true)
RedirectToAction("DoSomething", "Section");
base.Initialize(requestContext);
}
}
Basically, all my controllers will derive f...
In my application I have a custom model binder that I set to the DefaultBinder in the global.asax:
ModelBinders.Binders.DefaultBinder = new XLDataAnnotationsModelBinder();
When writing unit tests for controllers I need to make sure the controller uses the custom model binder but I don't know how to do this.
My test looks like this:
...
Ok i have this controller:
class ExampleController extends AppController {
var $name = 'Example';
public function test_me () {
$this->Example->Create();
$this->Example->set( 'variable_from_db_1' => 'random_value_1',
'variable_from_db_2' => 'random_value_2' );
//here, how can i...
I'm using a g:select (actually, a g:currencySelect) in my view.
I want a controller action to fire as soon as the user changes the value in the resulting select box.
How can I do this?
...
I'm working on creating a simple MCV application, in order to understand MVC better. The problem I'm having is registering event listeners.
The way I see MVC is that the view dispatches events, the controller listens for these events and acts on them, either updating the model or amending the view.
So in my MVC app I have a controller wh...
I'm trying to fill a JSON object with a list of items from the database when the page first loads. This list of items comes from the database. Right now, I've strongly typed the View and am looping through the list of items to build an HTML unordered list, and then in the JavaScript building the JSON object from what's been output in the...
I have this validation in my user model.
validates_uniqueness_of :email, :case_sensitive => false,
:message => "Some funky message that ive cleverly written"
In my tests I want to ensure that when a user enters a dupe email address that my message definately gets shown but without having to duplicate the error string from abov...
Hi,
I'm trying to use JQuery's $.getJSON to access Model data from the Controller, and build a JSON object in the javascript to use as the user adds and removes items from a list. All JS is done in an external file. The hit to the server for the Model data is done only once after the page first loads so I can get the full list of option...
In ASP.Net MVC, how can I check in a controller method, if it was called using post or get?
I am aware I can limit methods to being called only by post or by get - but how can I check for post/get in a method that allows both?
...