Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>ok, to process url like this:</p> <pre><code>/someurl?fooId=3&amp;barId=5 </code></pre> <p>you need to write something like this:</p> <pre><code>@RequestMapping("/someurl") public ModelAndView myController( @RequestParam("fooId") int fooId, @RequestParam("barId") int barId) { Foo foo = new Foo(); foo.bar = fooId; Bar bar = new Bar(); bar.bar = barId; // etc. } </code></pre> <p>you can go a way <strong>beyond that solution</strong> and create custom converters:</p> <pre><code>public class FooConverter implements Converter&lt;Integer, Foo&gt; { @Override public Foo convert(Integer source) { Foo foo = new Foo(); foo.bar = source; return foo; } } public class BarConverter implements Converter&lt;Integer, Bar&gt; { @Override public Bar convert(Integer source) { Bar bar = new Bar(); bar.bar = source; return bar; } } </code></pre> <p>and then after you register them in spring:</p> <pre><code>&lt;mvc:annotation-driven conversion-service="conversionService"/&gt; &lt;bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean"&gt; &lt;property name="converters"&gt; &lt;set&gt; &lt;bean class="xyz.FooConverter"/&gt; &lt;bean class="xyz.BarConverter"/&gt; &lt;/set&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p>you can use a shorter solution (where Foo and Bar is converted automatically):</p> <pre><code>@RequestMapping("/someurl") public ModelAndView myController( @RequestParam("fooId") Foo foo, @RequestParam("barId") Bar bar) { // etc. } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload