Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8648265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:16:26+00:00 2026-06-12T13:16:26+00:00

I just want use jstl:core with SpringMVC. My controller contain something like : private

  • 0

I just want use jstl:core with SpringMVC.

My controller contain something like :

private Map<UUID, ProductBean> products = new ConcurrentHashMap<UUID, ProductBean>();

…
…
…

@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";
}

I want simple using jstl like:

    <c:choose>

                <c:when test="${products.get(pbId).getMpf().size()==0}">

                    <p>No pictures uploaded</p>
                </c:when>
                <c:otherwise>

                    <ul id="products">
                                            ......
                    </ul>
                </c:otherwise>
    </c:choose>

But the program never go to the first branch

I added <%@ page import=”java.util.*” language=”java” %> package in my jsp, but it seems does not work. I follow the examples from http://www.springbyexample.org/examples/spring-web-flow-subflow-webapp-jsp-example.html. 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:16:27+00:00Added an answer on June 12, 2026 at 1:16 pm

    It looks like your controller has the following line commented out:

    //model.addAttribute("product",tmp);
    

    The JSP is looking for an object in the model named products. This is the default scope when referencing something via ${products}. Since your controller is never adding an object with this name, it fails the c:when.

    Additionally, for accessing list elements in JSTL, use the following notation:

    ${products[4]}
    

    See How to select the first element of a set with JSTL? for more detail on this.

    Furthermore, you should not be using .getXxx() either. Assuming your object conforms to the Javabean spec, you reference items with just the name like follows:

    ${products[4].mpf}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it windows.gears != undefined or something??? I just want to use javascript to
i just want to use an entity modify it to show something,but don't want
I try to call an API. I just want use active resource so I
I don't want to use any Java code, I just want to use <jsp:include>
I have a placholder that I dont just want to use Visible=false on, becouse
So, I just basically want to use AVFoundation Kit for playing my sound. I
I'm working on an app to block GtalkService. I want just use iptables for
Just want to ask if i can use Custom Validator in client side without
I just want to ask if is it okay that I use native PHP
Basically, I just want to know if its possible to use Nhibernate to migrate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.