Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
javascript function call to fetch data and display to screen on page load

I am trying to call the javascript function to fetch the data from DB. when the page loads the other product should fetch the data on click event. But only onclick I is fetching the data and when the page loads first time it is blank page. Please guide me. please find below is my code. java and jsp page

<% for(int i=0;i<vProductLine.size();i++){
   if(i == 0) { %>              
<%--                    <td id="onglet<%= i %>" class="<% if(nOnglet.equals(""+i)) out.print("ongletActif"); else out.print("ongletInactif"); %>" onload="displayOnglet('<%= i %>')">  --%>
<td id="onglet<%= i %>" class="<% if(nOnglet.equals(""+i)) out.print("ongletActif"); else out.print("ongletInactif"); %>" onload="displayOnglet('<%= i %>')">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr><td nowrap align="center"><b><j2ee:text id="xmlFile" tag="<%= vProductLine.elementAt(i).toString() %>"/></b></td></tr>
                            <tr><td align="center"><span id="obj_<%= vProductLine.elementAt(i) %>"></span></td></tr>
                        </table>
                    </td>
<% }else{ %>
                    <td id="onglet<%= i %>" class="<% if(nOnglet.equals(""+i)) out.print("ongletActif"); else out.print("ongletInactif"); %>" onclick="displayOnglet('<%= i %>')">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr><td nowrap align="center"><b><j2ee:text id="xmlFile" tag="<%= vProductLine.elementAt(i).toString() %>"/></b></td></tr>
                            <tr><td align="center"><span id="obj_<%= vProductLine.elementAt(i) %>"></span></td></tr>
                        </table>
                    </td>
<% }} %>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If the solution in the comment doesn't help to solve your problem, another solution is to put a script tag and call your function inside the script, like this:

<% for(int i=0;i<vProductLine.size();i++){
if(i == 0) { %>              
<td id="onglet<%= i %>" ...>
  <table border="0" cellpadding="0" cellspacing="0">
     <tr><td nowrap align="center">...</td></tr>
     <tr><td align="center">...</td></tr>
   </table>
 </td>
<script>
   displayOnglet('<%= i %>'); //or wathever you want to do on td's onlaod
</script>
<% }... %> 
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!