0

There is a jsp page where I put my name and this display column shows the occupant details.It shows occid, firstname etc. The prob is that I want to use this occid in toggle1(occid) and toggle2 but cant seem to use it. Is there any wait to access the occid from display column in toggle1 and toggle2? It will be of great help.

 <display:table name="sessionScope.List" pagesize="2"
                               export="true" sort="list">  

                    <display:column  property="occid" title=" Occupant ID" style="text-align:center;" ></display:column>
                    <display:column  property="firstName" title="First Name" style="text-align:center;" ></display:column>
                    <display:column  property="lastName" title="Last Name" style="text-align:center;"  ></display:column>
                    <display:column  property="sonOf" title="Father's Name" style="text-align:center;"  ></display:column>
                    <display:column  property="district" title="District" style="text-align:center;"  ></display:column>
                    <display:column  property="village" title="Village"  style="text-align:center;" ></display:column>

                    <display:column  title="Reservation Form" style="text-align:center;">
                        <a href="javascript:toggle1('${occid}')">
                            Show reservation details
                        </a>
                    </display:column>

                    <display:column  title="Agreement Form" style="text-align:center;">
                        <a href="javascript:toggle2('${occid}')">
                            Show agreement details
                        </a>
                    </display:column>

And this is the toggle javascript code.

function toggle1(occid)
{
alert(1);
$.ajax({
    type: "GET",
    url: "getReservationDetails",
    data: "occid="+occid,              
    success: function(data){
        document.getElementById("resdet").innerHTML = data;   
    }
});
}
9
  • 1
    Please add an upper case letter at the start of sentences. Also use a capital for the word I, and abbreviations and acronyms like JEE or WAR. This makes it easier for people to understand and help. Commented Jun 10, 2013 at 15:12
  • @AndrewThompson Is it okay now? Commented Jun 10, 2013 at 15:17
  • Why do you need occid in java code. Seems like you need it in javascript ! What are you trying to do with toggle method. Can you post javascript code for toggle !! Commented Jun 10, 2013 at 15:18
  • with the occid in toggle1 it will another display tag which will have the reservation details of the person with same occid. Commented Jun 10, 2013 at 15:20
  • @AndrewThompson any advices?? Commented Jun 10, 2013 at 15:34

1 Answer 1

1

add id with display:table as this

<display:table name="sessionScope.List" pagesize="2" export="true" sort="list" id="itemName">

and within display:column use varialbe itemName.occid as this

<a href="javascript:toggle1('${itemName.occid}')">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.