Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm passing values between controllers on different pages using angularjs. This is a part of my app.js.

app.controller('JewelleryCtrl', function($scope, srvShareData) {
      $scope.sharedData = srvShareData.getData();
      sessionStorage.clear();
    });


and i'm able to get the passed values in the next page

<pre>
{{sharedData}}

in my case this {{sharedData}} contains the value "Rings". i want to compare this value in jstl but it is not working.

What I have tried:

this is what i'm trying,

<div ng-controller="JewelleryCtrl" class="ui-tabs-panel ui-tabs-hide ui-widget-content ui-corner-bottom" id="fragment-2">


    <%    
        String subcat1 = "{{sharedData}}";
        request.setAttribute("subcat", subcat1);
    %>

    <!--<h4>Address</h4>-->
<div class="sell" onsubmit="return false">
     <c:set var="subcategory" value="${subcat}" scope="session"/>
    <c:out value="${subcategory}"></c:out>
    <c:choose>
        <c:when test="${subcategory == 'Rings'}">
    <div class="col-3">
        <label>
            <select id="basemodel" name="sizeofring" tabindex="5">
                <option value="" selected="">Select Ring Size</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
             </select>
        </label></c:when> 
        </c:choose> 
    </div>


This comparison always fails. Do i have convert the {{sharedData}} to string and compare? I dont know how to do it. Any help is appreciated..

Thanks in advance..
Posted
Comments
OkuDoku 16-Sep-16 6:21am    
Have you tried to display the output of subcategory instead of just comparing it? maybe its easier to determine what went wrong then

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900