Results 1 to 4 of 4

Thread: Newbie questoin : Accessing model from JSP scriptlet

  1. #1
    Join Date
    Nov 2005
    Posts
    2

    Default Newbie questoin : Accessing model from JSP scriptlet

    Hi all,

    I have returned a Hashmap called "map" from my Controller. How do I use JSP scriptlet to access the elements within this variable ?

    I have tried using
    <%
    if ${map.blah} == "hello"{
    %>
    woohoo
    <%}%>

    and it doesn't really work....

    Thanks for the help in advance!!

  2. #2
    Join Date
    Oct 2005
    Posts
    17

    Default

    not sure if mal.blah should work but try map["blah"] should work.
    Yann

    Reaching Zen a day at a time, or not...

  3. #3
    Join Date
    Oct 2004
    Location
    Palmas-TO, Brazil
    Posts
    92

    Default

    Why you not use jstl?
    Since you are using a map you have two option: key and value

    HTML Code:
    <c:if test="${situacao.key == 'hello'}">
        <div class="error">	
        </div>
    </c:if>
    Gilberto

  4. #4
    Join Date
    Oct 2004
    Location
    Palmas-TO, Brazil
    Posts
    92

    Default

    Sorry, I've forgot the other example, as Yann Perrin suggested:

    HTML Code:
    <c:if test="${situacao["blah"] == 'hello'}">  
    Note: the last one - with key word - , is more used in a loop.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •