Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Getting a single html list element back to my spring controller

If you don't want to use JavaScript and you don't mind refreshing, then you can have your sizes as URL parameters, and have the controller refresh the current page with the appropriate product.

<ul class="options
    <h4 class="m_9">Select a Size</h4>

In your controller:

@RequestMapping(value = "/product",
params = "size", method = RequestMethod.GET)
public String getProduct(@RequestParam String
size, Model model){
    if ("s".equals(size)) {
        // add small product to model
    } else if ("m".equals(size)) {
        // add medium product to model
    return "...";

A better approach is to have the sizes inside a select tag in the form. The controller will get the size when the form is submitted, and insert the appropriate product accordingly.

Categories : Java

Related to : Getting a single html list element back to my spring controller
Angular JS single controller multiple views
It is totally fine to share one controller between multiple views. In fact this in one of the strengths of decoupling the javascript from the view like Angular code helps you do. Different views can share the same logic but still render different markup.

Categories : Javascript
Returing ModelAndView vs DTO from the Spring Controller
You can return application/json as the response. As part of your Spring project have Jackson libraries in the classpath and then return your model (DTO ?) as@ResponseBody. Spring automatically converts your Model into json and returns it as a HTTP Response (to your AJAX call). Javascript (especially JQuery) has an excellent support for parsing JSON

Categories : Jquery
Spring MVC ajax call a controller using
Here is a example,you can try it: I suppose FIReportSearchInput have id and name attributes. $.ajax({ url:"", type:"post", dataType:"json", data:{id:$("#id").val(),name:$("#name").val()}, success:function(){} }); when the spring mvc server catch this request,if your answer body is 'FIReportSearchInput fiReportSearchInput' and Object FIReportSearchInput have id and n

Categories : Java
Express route for single element
For the route you currently have, you'd need to make your request url this: /users/546e5640f5fea84a345abe2c. If you want your route to match the request url you're currently trying (/users?id=546e5640f5fea84a345abe2c), then you would instead do: /* Get User by id. */ router.get('/', function(req, res) { console.log('find user ' +; User.findById(, function (err, user

Categories : Node Js
R - getting back single element from strsplit
So basically strsplit will be applied to every single element of tst object. And it will be something likes this: > strsplit(tst, "_") [[1]] [1] "Test1" "Test2" [[2]] [1] "Test3" "Test4" Then you can break that down into a single vector by using unlist > unlist(strsplit(tst, "_")) [1] "Test1" "Test2" "Test3" "Test4" Then you can loop through every word depending on what you are trying

Categories : R
Recently Add
Concurrent collection to 50/50 read/write
How to get unique members of object class (groupofUniqueNames) from an ldap server using java
Custom error reporting: how to log down function arguments (and possibly locals) in an exception handler?
Websphere MQ message redelivery
How to use BigDecimal to achieve following code instead of using double or float?
What exactly do the service() method of this HttpServlet?
Why does the Java API use int instead of short or byte?
Hibernate. One to one mapping without cross references
How to pass array to a java method
BooleanFieldEditor doesn't load value from PreferenceStore
NoClassDefFoundError when I call the class through commnad line
Shopizer Search
Java - Bank System + Transaction Function
Hadoop security using Apache DS / Apache Directory Studio
Multiple property-placeholder with overlapping locations does not work?
could not remove/add jpanel in jframe
Java garbage collection verbose not working
If child class has a variable with same name as private variable in parent what will be used?
Jackson parse json with a one-to-many relationship in a single step
Excel opens wrong view after generating in Apache POI
On Switch How to use logic operator on case JAVA
Java: What is the absolut first second in Calendar?
Waiting One Second for a button click, if button not clicked call function
Fastest way to extract part of a large JSON File
copy directory operation using linux command in java
Figuring out how to Format Printing
Why does @FunctionalInterface have a RUNTIME retention?
Collision detection Libgdx rectangles
Cannot find symbol in method changeRecL but declared in main method
Receiving " Connection reset" when connecting from dotnet client to a java server
© Copyright 2017 Publishing Limited. All rights reserved.