how to access elements of included jsp  from parent jsp's save button

Posted on 2009-07-14
Last Modified: 2016-05-18
 here is the scenario .  I have a jsp page and i have inluded another jsp  by  <jsp:include page="tba_contacts_data.jsp" flush="true"/>  . i am populating data in this included jsp through ajax and display tag   and   I  am trying to access the elements from this included jsp  by save button on my parent jsp.. i am using request.getParameter() to get elements of included jsp but getting null always. What  i am doing wrong in this..?

1. parent jsp code - 

	<div id="addContactResults">	

	<jsp:include page="tba_contacts_data.jsp" flush="true"/>	


2. included jsp code - 

  	<div id="display_table_results_2" >

 	<div id="blue_table_header_1" style="width:800px" class="header_blue1"><span align="right" class="pagebanner">Collateral Statement</span></div>

    <div  align="left"  style="overflow-y:auto;<%=height%>;width:800px">






                style="<%= height %>;width:800px">


            <display:column   title="<input type='checkbox'  onclick='selectAll(this)'/>" class="centered" style="width:30px">

                <input  type="checkbox"  id="contactId" name="contactId" style="width:30px" class="centered" value="<c:out value='${row.CONTACT_ID}'/>"  >


            <display:column sortable="true" style="width:250px"   title="Contact Name" >


            	<c:out value='${row.CONTACT_NAME}'/>


            	Email : <c:out value='${row.EMAIL_ADDRESS}'/>






javascript code - 

 var arrAccountInput = document.getElementsByName("contactId");

	 var accountCheckList = new Array();

	 var j = 0;

	  var tbaCustomerForm = document.tbaCustomerForm;

	for (i=0; i<arrAccountInput.length; i++)



        if (arrAccountInput[i].checked)








     alert("jcount = "+j);

   // var tbaCustomerform = document.tbaCustomerForm;


    alert("count = "+tbaCustomerForm.count.value);

	tbaCustomerForm.toDo.value = "tba_save_contact_data"; ="edit_customer";



action class code - 

int count  =  customerForm.getCount();

for (int i = 1; i <=count; i++)


   String checkbox1 = request.getParameter("contactId");


Open in new window

Question by:sum_it_jec
  • 4
  • 3
LVL 27

Accepted Solution

mrcoffee365 earned 500 total points
ID: 24854579
Your issue is probably with Javascript, so you should add the Javascript zone for your question.

When you do an include in a JSP file, the contents are included into the page that is returned to the browser client -- the client has no concept that some lines of the resulting HTML came from a different file on the server.  So that fact is not relevant to your problem.

The ajax call is probably not working the way you want.  It might not be executed, it might not be updating the right part of the DOM.  Many things could be wrong.

You should put an alert into the javascript that you think will be executed based on clicking on a button, and go from there.

I assume that your request.getParameter() on the server is getting null because your javascript is not executing correctly to fill in the required parameter.

Author Comment

ID: 25618010
Thanks for the inputs. its really helps..
LVL 27

Expert Comment

ID: 25619063
Glad to help.  If you accept the solution, then I get points for helping you, which is a good thing.

Author Comment

ID: 29754180
thanks all for ur help.
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

LVL 27

Expert Comment

ID: 29797677
You're welcome.  To accept the solution, click the "Select As Solution" button on this page, where you see my first answer to this question.

Author Comment

ID: 32936475

Expert Comment

ID: 41602352
I've requested that this question be deleted for the following reason:

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Not enough information to confirm an answer.

If you feel this question should be closed differently, post an objection and a moderator will read all objections and then close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Auto Deleter
LVL 27

Expert Comment

ID: 41602353
The asker clearly found that the info I provided solved his problem.  In this case, there is enough information to see that the answer worked.  The asker just couldn't figure out how to use the EE system to accept the answer and kept reassuring me that my answer worked for him.

So please award points to mrcoffee365.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now