Solved

Help on HTML

Posted on 2016-07-22
1
87 Views
Last Modified: 2016-07-23
Hi Team,

Iam developing an application where in I need to integrate HTML with Servlets and servlets to interact with Database using JDBC and send the results back to HTML page withour refreshing it.

It would be of great help if anyone can help with an example . Iam new to Java related technologies.
0
Comment
Question by:sam_2012
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 41725130
I am not a java developer and perhaps you need to break your question down to two parts.  One for the back end and one for the front.

On the front end, you want to use an ajax request to your back end page.

You can do this in pure javascript, I like to  use jquery
http://api.jquery.com/jquery.ajax/
$.ajax({
  method: "GET",   
  url: "processpage",
  data: { first: "hello", last: "world" }
})
  .done(function( data) {
    alert( data);
  });

Open in new window


On your processpage, accept the get just as if the page was processpage?first=hello&last=world

On your main page, make a page using code similar to what I have above
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.0.3.js"></script>
  <script>
    $(function(){
    $.ajax({
  method: "GET",   
  url: "processpage",
  data: { first: "hello", last: "world" }
})
  .done(function( data) {
    //alert( data);
      $('#results').html(data);
  })
    
});
  </script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>test</title>
</head>
<body>
  <div id="results"></div>
</body>
</html>

Open in new window

When you run the code on the main page above and your other page called processpage can extract the url processpage?first=hello&last=world and output "hello world" you will see that text in the div id results.

How you connect to your database in your java page is another process.

If this makes sense you are good to go.  If not, take just one piece at a time before going on to the next.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

630 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