java - Accessing Map value in a separate JSTL loop -


Assume that the result of a query is a field named resultSet is available templateId .

In addition, the map exists with the key of 'TemplateMap' templatedId .

I am not able to get any results from the following, appreciate any help.

  & lt; C: foreach var = "line" item = "$ {resultSet.rows}" & gt; & Lt; C: Out value = "$ {templatemap [row.templateId]}" /> & Lt; / C: foreach & gt;  

Note: This is a coding horror app, which results in & lt; Sql: query & gt; is the result of.

The following does not work either.

  & lt; C: foreach var = "line" item = "$ {resultSet.rows}" & gt; & Lt; C: set var = "tmplId" value = "$ {row.templateId}" /> & Lt; C: Out value = "$ {templatemap [tmplId]}" /> & Lt; / C: foreach & gt;  

The code you posted (and edited) is syntactically valid, so The problem is somewhere other.

To begin, the code ID suffixes I think it is actually one fact, that non-decimal numbers in e-mail long In this way, if it is a map & lt; Integer, integer & gt; , this code will not work.

I'm not sure how to work for you Maps & lt; Long, Long & gt; or Maps & lt; Long, integer & gt;

should be. I mean your words "coding horror app", but I'm sure you already know that using JSTL SQL taglib for other purposes compared to the quick prototype is considered a very bad practice;) This logic The data is in the real java classes in the access layer.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -