How to insert Java code in HTML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to insert Java code in HTML

3rd Dec 2019, 5:18 PM
Josie Lyobaw
16 Answers
+ 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/
3rd Dec 2019, 6:14 PM
A͢J
A͢J - avatar
+ 5
Found this article. See if it answers your question. https://stackoverflow.com/questions/10964693/java-embedding-into-html
3rd Dec 2019, 5:25 PM
Jella
Jella - avatar
+ 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.
3rd Dec 2019, 6:22 PM
A͢J
A͢J - avatar
+ 3
Yep i know Servlet is backend... But he didn't mention his need😅
3rd Dec 2019, 6:23 PM
$hardul B
$hardul B - avatar
+ 3
$hardul B 😂😂
3rd Dec 2019, 6:23 PM
A͢J
A͢J - avatar
+ 2
Applet Servlet both are useful
3rd Dec 2019, 6:13 PM
$hardul B
$hardul B - avatar
+ 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"
3rd Dec 2019, 7:08 PM
A͢J
A͢J - avatar
+ 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
4th Dec 2019, 9:19 AM
Ashutosh Bichare
Ashutosh Bichare - avatar
+ 1
By using <script> tag but you have to actually type <script lang="java">, I hope that MIGHT work though.
4th Dec 2019, 6:27 PM
MegaMaster666
MegaMaster666 - avatar
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
5th Dec 2019, 5:23 AM
Poobharathii Balakrishnan
Poobharathii Balakrishnan - avatar
0
Google bro
5th Dec 2019, 8:32 AM
Franklin Davis Jr
Franklin Davis Jr - avatar
0
Applet
5th Dec 2019, 8:48 AM
john Patrick Limon
john Patrick Limon - avatar
0
What?
5th Dec 2019, 8:48 AM
Franklin Davis Jr
Franklin Davis Jr - avatar
0
Maybe you mean JavaScript? in fact, Java is used to develop applications, with the exception of the special server-side language PHP.
5th Dec 2019, 9:14 AM
Ganji
Ganji - avatar
0
Brasil
5th Dec 2019, 3:31 PM
Nelson Claro Claro
Nelson Claro Claro - avatar
0
JSP is java code embedded into HTML code. Use JSP. You will need a server for running it.
5th Dec 2019, 4:35 PM
Chetali Shah
Chetali Shah - avatar