Note that there are some explanatory texts on larger screens.

plurals
  1. POjstl: how to know the variable? does it have some scope?
    primarykey
    data
    text
    <p>I just want use jstl:core with SpringMVC.</p> <p>My controller contain something like :</p> <pre><code>private Map&lt;UUID, ProductBean&gt; products = new ConcurrentHashMap&lt;UUID, ProductBean&gt;(); </code></pre> <p>... ... ...</p> <pre><code>@RequestMapping(value="/createproduct/{pbid}", method=RequestMethod.GET) public String getProduct(HttpServletRequest req, Model model, @PathVariable("pbid") UUID pbid) { if(!products.containsKey(pbid)){ ProductBean tmp=new ProductBean(); products.put(pbid, tmp); //model.addAttribute("product",tmp); System.err.println("============empty now===============\n"); }else{ ProductBean tmp=products.get(pbid); System.err.println(pbid.toString()); System.err.println(tmp.getMpf().printFileNameList()); } req.getSession().setAttribute("pbId", pbid); model.addAttribute("pbId", pbid); return "production/createproduct"; } </code></pre> <p>I want simple using jstl like:</p> <pre><code> &lt;c:choose&gt; &lt;c:when test="${products.get(pbId).getMpf().size()==0}"&gt; &lt;p&gt;No pictures uploaded&lt;/p&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;ul id="products"&gt; ...... &lt;/ul&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; </code></pre> <p>But the program never go to the first branch </p> <p>I added &lt;%@ page import="java.util.*" language="java" %> package in my jsp, but it seems does not work. I follow the examples from <a href="http://www.springbyexample.org/examples/spring-web-flow-subflow-webapp-jsp-example.html" rel="nofollow">http://www.springbyexample.org/examples/spring-web-flow-subflow-webapp-jsp-example.html</a>. It seems they also have variable not declare in jsp like ${persons}. I want the products variable can work both controller and jsp view part. what I need to do? where I should declare it? Do I need to include other packetage in my jsp?</p>
    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.
 

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