I am new to JSF and I am doing an enhancement project. I added one a4j: comandButton and while I was trying to call the action method specified inside controller class, I am not getting any result. Instead of the newly created method I was trying to put an old action method and it was working perfectly. I am not sure what mistake I am doing or what the things need to be added.
<a4j:commandButton` id= "data" value="Data"
styleClass="normalButton"
action = "#{controller.dataReset}"
status="waitStatus" oncomplete="clearDirtyFlag();">
</a4j:commandButton>
Related
I'm trying to find out if its possible to create a controller or action result in MVC that will trigger for every action.
Basically I want a check to occur before people are directed to the url each time, if this check fails I will return a different view but I don't want to write this out for every single action in my controller.
Can this be done??
This can be done with a custom ActionFilterAttribute.
Overriding OnActionExecuting means I can put the same check in for all actions.
I am trying to call an Action from my view using #Html.Action("ActionName","controllerName"). But my page fails to load with below error:
A single instance of controller 'Web.Areas.Area1.Controllers.ActionController'
cannot be used to handle multiple requests. If a custom controller
factory is in use, make sure that it creates a new instance of the
controller for each request.
I am using structure map for Dependency injection. Please help me what am i missing.
You need to add
x.For<{Your controller name}>().AlwaysUnique();
in IoC.cs file. This should be done for every controller in your project.
For more details check this link.
Is there any default method that we can set in MVC controllers? I am trying to debug a code and one method is being called (public HttpResponseMessage GetBySpecification) for the first time when controller is called; from where this method is passed I am not able to figure that. URI and get is being passed to controller.
Please help
I am new to Umbracoo . I was trying to call Controller action method from umbracoo . I find the solution for how to render view but did not find any way to call action method of controller ..
for this purpose first you would have to inherit your controller from Umbraco.Web.Mvc.SurfaceController or Umbraco.Web.Mvc.RenderMvcController
have a look at:
http://our.umbraco.org/documentation/reference/mvc/surface-controllers
http://our.umbraco.org/documentation/reference/mvc/custom-controllers
Make sure that your view/partialView is created from umbraco backend as template so that it would have it's record save in database through unique id.
it would be hidden in your solution explorer first show all hidden items and the include in your project and start working on it.
I am following a tutorial and got to this point: http://rubysource.com/building-your-first-rails-application-views-and-controllers/
rails generate controller urls new
The reason we only passed in the new action (instead of new, create,
and show) is because Rails automatically generates a dummy view for
each action included in the generator call. In this case, we only want
a dummy view for the new action, so we exclude the others.
So why we only need to create the controller for new? Can someone plase explain it in a little more details?
The command is used to create the UrlsController with only one method: new.
This command will also automatically create a view file for you in:
app/views/urls/new.html.erb
Had you supplied more arguments like:
rails generate controller urls new create show
You would have gotten:
app/views/urls/new.html.erb
app/views/urls/create.html.erb
app/views/urls/show.html.erb
Since the tutorial only needs the new view it was unnecessary to create the additional views, hence those additional arguments were not added to the generate command.
Later in the tutorial you manually add the create and show methods, but you never add views for those methods (since those methods will not be needing specific views files in this application).
So: what you did was create the controller UrlsController with one method new, and the corresponding view for that method. The rest of the methods you will code in manually later in the tutorial so there was no need to auto-generate anything else (create or show).
This will only create the new action in the controller and should skip the other ones.
EDIT:
It will generate a controller called UrlsController in app/controllers and in that controller there will only be one method called action which corresponds to a route or url called urls/new