Reputation: 65
I am pretty much new to JSP and wanted to understand the possibility of doing the below functionality in JSP.
Would it be possible to do this in plain JSP without using Servlets? Any suggestions would greatly help.
Thanks in advance
Upvotes: 0
Views: 1382
Reputation: 2949
Use jQuery ajax to load the content when you loading the page.
In the JSP page we assume you've got the text box value,
$( document ).ready(function() {
var text_box_value = $("#my_text_id").val();
$.ajax({
method: "POST",
url: "Your_second_jsp",
crossDomain: true,
data: { data: text_box_value}
})
.done(function( response ) {
$("#your_div_id").html(response)
});
});
And populate your response in html (here i'm using div)
<div id="your_div_id">
<!-- Your response will be displayed here. -->
</div>
which will help you to get the HTML.
Upvotes: 1