Call JSP file using Javascript

I have an HTML file and I want to use javascript to call a JSP file.

It should not be javascript, I'm just looking for the easiest way to call a JSP file from an HTML file.

How can i do this?

Thank.

+3
source share
3 answers

HTML / CSS / JavaScript works on the client side. Java / JSP runs on the server side. Client and server are two different environments that typically run on physically different computers that are connected to each other by a network with a communication protocol that is HTTP.

URL- , Java/JSP HTML/CSS/JS . (webbrowser) HTML/CSS/JS.

, , JavaScript / Java/JSP - HTTP- . : window.location GET form.submit() GET POST XMLHttpRequest#send() (aaaxical) .

JavaScript . HTML- .

<a href="page.jsp">link</a>

<form action="page.jsp">
    <input type="submit">
</form>

JSP . - JSP, URL- <a href="page">, , , JSP,

request.getRequestDispatcher("/WEB-INF/page.jsp").forward(request, response);

Java/JSP JavaScript, .

+5

, Ajax. JSP ,

, JQuery ajax, :)

+1

- action yourPage.jsp.Something

<form action="index.jsp" method="post" accept-charset="utf-8">
+1

Source: https://habr.com/ru/post/1739958/


All Articles