Results 1 to 11 of 11
  1. #1
    Cbani is offline Member
    Join Date
    Jan 2010
    Posts
    90
    Rep Power
    0

    Default ui development using jstl+jsp+javascript using spring framework.

    hi guys,

    i m stuck in a ui development using jstl+jsp+javascript using spring framework.

    need solution very urgently...plz help.

    i have a jsp page where i have two select box..
    i have a hashmap<string, hashset> which comes from the server side.

    my requirement is to populate the first select box with the keys of the hashmap and the second as the values(hashset) of the corresponding key.

    i am able to display the first one;

    now, the second select box should get populated with the hashset of the particular key from the map.


    the second one should get populated once the user selects any of the options from the first select box; and onChange should display the corresponding values of the map that is a set.


    here is my code

    Java Code:
    <td align="left"><strong>Environment Component Name:</strong></td>
    <td align="left">
    <form:select path="envCompName" id="envCompName" [B]onchange="<c:set var="set" value="${map.value}" /> "[/B]>
    <form:option value="-" label="--Please Select Env Component--" />
    <c:forEach items="${superPackage.superPackageMap}" var="map" >
    <form:option value="${map.key}" label="${map.key}" id="envCompNameOpt"/>
    <form:hidden path="house" id="hiddenSet" value="${map.value}" />
    </c:forEach>
    </form:select>
    </td>
    <td align="right"><strong>Environment Name:</strong></td>
    <td align="right"><form:select path="envName" id="envName" >
    <form:option value="-" label="--Please Select Environment--" />
    <c:forEach items="${set}" var="mySet" >
    <form:option value="${mySet}" label="${mySet}" id="envCompNameOpt"/>
    </c:forEach>
    </form:select></td>
    the code you see in bold gives me a syntax error.please suggest how can i solve that..any code will be helpful..i have tried calling a javascript function onChange of first one...but no luck :(

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Cbani, please don't post unrelated questions in others threads. Start a new thread next time on the correct sub-forum. This time only I'll move this to the correct place.

  3. #3
    Cbani is offline Member
    Join Date
    Jan 2010
    Posts
    90
    Rep Power
    0

    Default

    hey sorry Eranga..i was searching for a related thread but when dint get; added here..next time i ll take care of the same... but please provide some solutions

  4. #4
    Cbani is offline Member
    Join Date
    Jan 2010
    Posts
    90
    Rep Power
    0

    Default

    any idea guys?

  5. #5
    Cbani is offline Member
    Join Date
    Jan 2010
    Posts
    90
    Rep Power
    0

    Default

    hi guys,

    now i have modified my code to remove the syntax errors.

    Java Code:
                                                      <tr>
    													<td align="left"><strong>Environment Component Name:</strong></td>
    													<td align="left">
    													<c:set var="map" value=""/>
    														<form:select path="envCompName" id="envCompName" onchange='" <c:set var='valueSet' value='${map.value}'/> "' >
    															<form:option value="-" label="--Please Select Env Component--" />
    															<c:forEach items="${superPackage.superPackageMap}" var="map" >
    																<form:option value="${map.key}" label="${map.key}" id="envCompNameOpt"/>														
    															</c:forEach>
    														</form:select>
    													</td>
    													<td align="right"><strong>Environment Name:</strong></td>
    													<td align="right"><form:select path="envName" id="envName" >
    														<form:option value="-" label="--Please Select Environment--" />
    															<c:forEach items="${valueSet}" var="set" >
    																	<form:option value="${set}" label="${set}" id="envCompNameOpt"/>
    															</c:forEach>
    														</form:select></td>
    													<td style="padding: 4px 18px 5px; white-space: nowrap;"
    														width="10%"><input type="button" value="Deploy"
    														class="darkBlueButton" onclick="" /></td>
    												</tr>

    but my jsp is throwing exception at run time. pls suggest

    This attribute is not recognized. <form:select path="envCompName" id="envCompName" onchange='" <c:set var='valueSet' value='${map.value}'/> "' >


    This attribute is not recognized. <form:select path="envCompName" id="envCompName" onchange='" <c:set var='valueSet' value='${map.value}'/> "' >

    the one you see in bold is where its pointing out
    i m really stuck up....pls help
    Last edited by Cbani; 08-13-2010 at 07:58 AM.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  7. #7
    Cbani is offline Member
    Join Date
    Jan 2010
    Posts
    90
    Rep Power
    0

    Default

    This attribute is not recognized. <form:select path="envCompName" id="envCompName" onchange='" <c:set var='valueSet' value='${map.value}'/> "' >


    This attribute is not recognized. <form:select path="envCompName" id="envCompName" onchange='" <c:set var='valueSet' value='${map.value}'/> "' >


    This is what i am getting in my jsp...


    i found a bad workaround(not suggestable); writing java code inside my jsp.
    by this workaround i am able to achieve the functionality i was looking for.

    can you suggest any solution wherein there is no java code in jsp. i.e. by using only jsp jstl and javascript?

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  9. #9
    Cbani is offline Member
    Join Date
    Jan 2010
    Posts
    90
    Rep Power
    0

    Default

    thats a tablib uri prefix for jstl; the problem is not there.
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

    the problem is in the below code where i try to embed a jstl tag inside a select tag
    <form:select path="envCompName" id="envCompName" onchange='" <c:set var='valueSet' value='${map.value}'/> "' >


    this form is a spring form tag as u see below
    <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
    Last edited by Cbani; 08-16-2010 at 06:17 AM.

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. What is RMI concept in Spring Framework
    By Java Tip in forum Spring Framework
    Replies: 0
    Last Post: 04-02-2008, 10:36 AM
  2. How to run Queries in Spring framework
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 04-01-2008, 10:42 AM
  3. What is RmiServiceExporter in Spring framework
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 10-04-2007, 09:21 PM
  4. What is RMI concept in Spring Framework
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 10-04-2007, 09:21 PM
  5. What is weaving in Spring Framework
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 09-26-2007, 08:30 PM

Posting Permissions

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