controller

How to store variables in all pages requestScopes within Spring

落花浮王杯 提交于 2019-12-13 08:39:33
问题 I usually add objects in my jsp requestScopes using Controllers. For example, if I need to list categories in "localhost/products/viewall", I simply change my ProductsController adding something like @RequestMapping("/products/viewall") public void viewCategories(Model model) { List<Category> categories = service.findAllCategories(); model.addAttribute("categories", categories); } so, this method adds a list of categories to my requestScope. I need to do the same, but for all the pages of the

Rails 3 Action Controller Record Not Found

女生的网名这么多〃 提交于 2019-12-13 08:39:23
问题 I'm using jQuery UI Tabs with Ajax and I am getting an error: Failed to load resource: the server responded with a status of 404 (Not Found) The resource is :3000/messages/profile_messages If I go to http://localhost:3000/messages/profile_messages in my browser I get Action Controller: Exception caught: ActiveRecord::RecordNotFound in MessagesController#show Couldn't find Message with ID=profile_messages Rails.root: /Users/me/Desktop/myapp app/controllers/messages_controller.rb:18:in `show'

kendo combobox reset after loading back view from controller

两盒软妹~` 提交于 2019-12-13 08:08:06
问题 I have a kendo combobox @(Html.Kendo().ComboBox() .Name("ddSystems") .Filter("contains") .Placeholder("-- Select --") .BindTo((IEnumerable<SelectListItem>)ViewBag.systemList) ) Onchange, a textbox is loaded in ajax. A submit button posts the textbox value and combobox value to the controller. When I get back to the view, I need ddSystems to be reset to empty. I used $('#ddSystems').data('kendoComboBox').value(null) and $('#ddSystems').data('kendoComboBox').text('') but it always retains the

Grails grailApplication.controllerClasses sort controller by package

你。 提交于 2019-12-13 07:41:31
问题 I have the following code that grabs all controllers, sorts it, and outputs in li tags: <g:each var="c" in="${grailsApplication.controllerClasses.sort { it.fullName } }"> <li<%= c.logicalPropertyName == controllerName ? ' class="active"' : '' %>> <g:link controller="${c.logicalPropertyName}">${c.naturalName}</g:link> </li> </g:each> I have a need to filter out controllers by package i.e. grab controller from a certain package. For example: com.app.module.mars.controller.HelloController com

Rails: DropDown Selection to Controller Action

纵然是瞬间 提交于 2019-12-13 07:37:26
问题 Good Day, i have this form view/startseites/index.html.erb and i specified a methode in my people_controller, she doesnt go. I prepared some ghost code for understanding. I want to give the entries from dropdowns with the button_to tag to the controller action checkValid. There i want to validate the entries against the database. I have to read and write from and to the table. I hope its clearly enough. class PeopleController < ApplicationController def checkValid @trainerName = params[

rspec controller specs testing post action

我与影子孤独终老i 提交于 2019-12-13 07:15:53
问题 For some reason the post spec working fine but the post_comment_spec test fails. Post has many post_comments, post_comment belongs to post. error: 1) Posts::PostCommentsController when user is logged in POST create with invalid attributes doesn't save the new product in the db Failure/Error: <span class="post-comment-updated"><%= local_time_ago(post_comment.updated_at) %></span> ActionView::Template::Error: undefined method `to_time' for nil:NilClass posts_controller def create @post =

Does the Controller's HttpPost ActionResult get called at the start of, during, or after the form's submit event?

眉间皱痕 提交于 2019-12-13 07:06:55
问题 This is a followup to my question here: Why are my "replacement parameters" getting transformed into empty strings? Okay, maybe somebody can help me understand what's going on here (note that I didn't write this code, so I'm approaching it from the perspective of a problem bear that has just been heli-dropped into unfamiliar terrain). As it seemed more natural/conventional to do so, I changed my handler from a submit button click handler to the form's submit handler: $("form").submit(function

Strategy to route to pages in codeigniter

和自甴很熟 提交于 2019-12-13 06:45:16
问题 i was wondering whats the best way to route to pages in codeigniter? Say for example user wants to route to the index page, but should i create a method in a controller that just fo rthat page, or what is better way? 回答1: No need to create separate methods or controllers. Here's how I do it: class Pages extends CI_Controller { function _remap($method) { is_file(APPPATH.'views/pages/'.$method.'.php') OR show_404(); $this->load->view("pages/$method"); } } So the url http://example.com/pages

Web API 2 Attribute Routing Controller Selection

给你一囗甜甜゛ 提交于 2019-12-13 06:27:01
问题 I use Web API 2 Attribute Routing in my project to provide JSON interface over my data. I am facing weird behaviour of controller selection, not decided yet whether it's a bug or a feature :) Let me describe my approach. I would like to simulate OData syntax with help of attribute routing (direct OData usage has been refused due to design principles). For example, to get entity with id=5 I use HTTP GET request to URI http://mydomain.com/api/Entity(5) . I expect to use the same URI with HTTP

MVC passing IEnumerable<CustomVM> to Controller

跟風遠走 提交于 2019-12-13 06:24:32
问题 Can someone help me to solve this problem. I want to pass ienumerable or just simple list of my custom viewmodel to controller. Theres my code: @model IEnumerable<WebWareApp.ViewModels.OstukorvVM> @{ ViewBag.Title = "Ostukorv"; } <h2>Hetkel ostukorvis olevad tooted:</h2> @using (Html.BeginForm("Create", "ToodeTellimuses")) { @Html.AntiForgeryToken() <table> <tr> <th>Tootenimi</th> <th>Tootegrupp</th> <th>Tootja</th> <th>Mõõdud</th> <th>Varvus</th> <th>Hind</th> <th>Vali Kogus</th> <th></th> <