+4

How to insert Java code in HTML

12/3/2019 5:18:19 PM

Josie Lyobaw

20 Answers

New Answer

+6

Josie Lyobaw We cannot insert java code in Html Because Java is server side language and Html is client side language. But there is a part "Applet" in java which can be embedded with html and Applet mostly use to make desktop applications. Check this link to know how we can embedded Applet with html. https://www.google.com/amp/s/www.geeksforgeeks.org/java-applet-basics/amp/

+5

Found this article. See if it answers your question. https://stackoverflow.com/questions/10964693/java-embedding-into-html

+4

It is called "applet" in java

+3

Josie Lyobaw We can write Java code in JSP which is somehow similar to html but we need application server to run it. $hardul B Servlets use in back-end not in front-end. JSP use as front-end.

+3

Yep i know Servlet is backend... But he didn't mention his need😅

+3

$hardul B 😂😂

+3

🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! Figuratively, with applet you're inserting JAVA code in html. applet is more of <applet dir="directory.java">....... And that lives in a .html file. Josie Lyobaw , reading your question again, i got another interpretation (since you've got no description for your question). Webview in java are used to write GUI apps in HTML, CSS, JS and maybe XML.

+3

You can use it for server

+2

Applet Servlet both are useful

+1

Mirielle🐶 [Inactive] That's Why I said there is a part of Java. So definitely we are inserting Java not directly but using "Applet"

+1

We cannot insert java code in html but we can insert html code in java using applet and then just compile your code with javac compiler and after creating bytecode just get output with appletviewer filename.class

0

By using <script> tag but you have to actually type <script lang="java">, I hope that MIGHT work though.

0

you may create separate .jsp file and then import to html to load, you will need to pass parameter to the jsp file .. usually by using script easier

0

Google bro

0

0

0

Maybe you mean JavaScript? in fact, Java is used to develop applications, with the exception of the special server-side language PHP.

0

MegaMaster666 it will work if the configurations is okay and also a server is needed

0

0

JSP is java code embedded into HTML code. Use JSP. You will need a server for running it.