How to stop showing duplicated items in jspRendering a nested list with JSPWhat is the difference between JSF, Servlet and JSP?How to upload files to server using JSP/Servlet?Why would I use a templating engine? jsp include and jstl vs tiles, freemarker, velocity, sitemeshHow to avoid Java code in JSP files?How to use if-else option in JSTLif…else within JSP or JSTLOption list not loading in JSPdisplaying different classes in a table from one jsp fileIterate a List of Hashmap and form table in JSP Angular1.6

How did astronauts using rovers tell direction without compasses on the Moon?

Raindrops in Python

Three Dots in Center Page

Why don't short runways use ramps for takeoff?

Is it possible for a particle to decay via gravity?

What is my clock telling me to do?

Why didn't Stark and Nebula use jump points with their ship to go back to Earth?

Why does calling cout.operator<<(const char*) print the address instead of the character string?

Why are we moving in circles with a tandem kayak?

How can flights operated by the same company have such different prices when marketed by another?

Bouncing map back into its bounds, after user dragged it out

Would people understand me speaking German all over Europe?

Is it unprofessional to mention your cover letter and resume are best viewed in Chrome?

Antonym of "Megalomania"

Patio gate not at right angle to the house

What is a good example for artistic ND filter applications?

My employer is refusing to give me the pay that was advertised after an internal job move

Boots or trail runners with reference to blisters?

Is it possible to tell if a child will turn into a Hag?

Rampant sharing of authorship among colleagues in the name of "collaboration". Is not taking part in it a death knell for a future in academia?

Why does one get the wrong value when printing counters together?

How can Paypal know my card is being used in another account?

Coworker mumbles to herself when working, how to ask her to stop?

Why tantalum for the Hayabusa bullets?



How to stop showing duplicated items in jsp


Rendering a nested list with JSPWhat is the difference between JSF, Servlet and JSP?How to upload files to server using JSP/Servlet?Why would I use a templating engine? jsp include and jstl vs tiles, freemarker, velocity, sitemeshHow to avoid Java code in JSP files?How to use if-else option in JSTLif…else within JSP or JSTLOption list not loading in JSPdisplaying different classes in a table from one jsp fileIterate a List of Hashmap and form table in JSP Angular1.6






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















To jsp i send list of Routes



request.setAttribute(ROUTES, routeService.getAll());


Routes has Train->List<Wagon>
Wagon has type (Business, Standart, etc) and count of seats.



I need to show for every Route:



Business: 1313,
Standart: 131...


I need to summ count of seats of each Wagon of all types and show it in JSP for each Route.



How to achieve this via jstl.










share|improve this question






























    0















    To jsp i send list of Routes



    request.setAttribute(ROUTES, routeService.getAll());


    Routes has Train->List<Wagon>
    Wagon has type (Business, Standart, etc) and count of seats.



    I need to show for every Route:



    Business: 1313,
    Standart: 131...


    I need to summ count of seats of each Wagon of all types and show it in JSP for each Route.



    How to achieve this via jstl.










    share|improve this question


























      0












      0








      0








      To jsp i send list of Routes



      request.setAttribute(ROUTES, routeService.getAll());


      Routes has Train->List<Wagon>
      Wagon has type (Business, Standart, etc) and count of seats.



      I need to show for every Route:



      Business: 1313,
      Standart: 131...


      I need to summ count of seats of each Wagon of all types and show it in JSP for each Route.



      How to achieve this via jstl.










      share|improve this question














      To jsp i send list of Routes



      request.setAttribute(ROUTES, routeService.getAll());


      Routes has Train->List<Wagon>
      Wagon has type (Business, Standart, etc) and count of seats.



      I need to show for every Route:



      Business: 1313,
      Standart: 131...


      I need to summ count of seats of each Wagon of all types and show it in JSP for each Route.



      How to achieve this via jstl.







      jsp jstl






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 21:40









      NeewbieNeewbie

      289 bronze badges




      289 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1














          You should do your logic in your servlet and send it to jsp. Also you can write java codes in jsp which I suggest you to avoid. To Solve your problem you need a code like this in your servlet:



          Map<String, Int> trainMap = trainList.stream().collect(Collectors.groupingBy(Wagon::getType,
          Collectors.summingInt(Wagon::getCount)));
          request.setAttribute("trainMap", trainMap);


          And in your jsp do something like this:



          <c:forEach var="train" items="$trainMap">
          <tr>
          <td>
          <c:out value="$train.key" /> : <c:out value="$train.value" />
          </td>
          </tr>
          </c:forEach>





          share|improve this answer

























          • Thx. I did a bit different. Wrote method and query to fetch long value from database

            – Neewbie
            Mar 28 at 12:00











          • @Neewbie thats a good idea too

            – Spara
            Mar 28 at 12:07










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366614%2fhow-to-stop-showing-duplicated-items-in-jsp%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You should do your logic in your servlet and send it to jsp. Also you can write java codes in jsp which I suggest you to avoid. To Solve your problem you need a code like this in your servlet:



          Map<String, Int> trainMap = trainList.stream().collect(Collectors.groupingBy(Wagon::getType,
          Collectors.summingInt(Wagon::getCount)));
          request.setAttribute("trainMap", trainMap);


          And in your jsp do something like this:



          <c:forEach var="train" items="$trainMap">
          <tr>
          <td>
          <c:out value="$train.key" /> : <c:out value="$train.value" />
          </td>
          </tr>
          </c:forEach>





          share|improve this answer

























          • Thx. I did a bit different. Wrote method and query to fetch long value from database

            – Neewbie
            Mar 28 at 12:00











          • @Neewbie thats a good idea too

            – Spara
            Mar 28 at 12:07















          1














          You should do your logic in your servlet and send it to jsp. Also you can write java codes in jsp which I suggest you to avoid. To Solve your problem you need a code like this in your servlet:



          Map<String, Int> trainMap = trainList.stream().collect(Collectors.groupingBy(Wagon::getType,
          Collectors.summingInt(Wagon::getCount)));
          request.setAttribute("trainMap", trainMap);


          And in your jsp do something like this:



          <c:forEach var="train" items="$trainMap">
          <tr>
          <td>
          <c:out value="$train.key" /> : <c:out value="$train.value" />
          </td>
          </tr>
          </c:forEach>





          share|improve this answer

























          • Thx. I did a bit different. Wrote method and query to fetch long value from database

            – Neewbie
            Mar 28 at 12:00











          • @Neewbie thats a good idea too

            – Spara
            Mar 28 at 12:07













          1












          1








          1







          You should do your logic in your servlet and send it to jsp. Also you can write java codes in jsp which I suggest you to avoid. To Solve your problem you need a code like this in your servlet:



          Map<String, Int> trainMap = trainList.stream().collect(Collectors.groupingBy(Wagon::getType,
          Collectors.summingInt(Wagon::getCount)));
          request.setAttribute("trainMap", trainMap);


          And in your jsp do something like this:



          <c:forEach var="train" items="$trainMap">
          <tr>
          <td>
          <c:out value="$train.key" /> : <c:out value="$train.value" />
          </td>
          </tr>
          </c:forEach>





          share|improve this answer













          You should do your logic in your servlet and send it to jsp. Also you can write java codes in jsp which I suggest you to avoid. To Solve your problem you need a code like this in your servlet:



          Map<String, Int> trainMap = trainList.stream().collect(Collectors.groupingBy(Wagon::getType,
          Collectors.summingInt(Wagon::getCount)));
          request.setAttribute("trainMap", trainMap);


          And in your jsp do something like this:



          <c:forEach var="train" items="$trainMap">
          <tr>
          <td>
          <c:out value="$train.key" /> : <c:out value="$train.value" />
          </td>
          </tr>
          </c:forEach>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 27 at 10:42









          SparaSpara

          3,6702 gold badges16 silver badges43 bronze badges




          3,6702 gold badges16 silver badges43 bronze badges















          • Thx. I did a bit different. Wrote method and query to fetch long value from database

            – Neewbie
            Mar 28 at 12:00











          • @Neewbie thats a good idea too

            – Spara
            Mar 28 at 12:07

















          • Thx. I did a bit different. Wrote method and query to fetch long value from database

            – Neewbie
            Mar 28 at 12:00











          • @Neewbie thats a good idea too

            – Spara
            Mar 28 at 12:07
















          Thx. I did a bit different. Wrote method and query to fetch long value from database

          – Neewbie
          Mar 28 at 12:00





          Thx. I did a bit different. Wrote method and query to fetch long value from database

          – Neewbie
          Mar 28 at 12:00













          @Neewbie thats a good idea too

          – Spara
          Mar 28 at 12:07





          @Neewbie thats a good idea too

          – Spara
          Mar 28 at 12:07








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366614%2fhow-to-stop-showing-duplicated-items-in-jsp%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript