answersLogoWhite

0

Java code can be embedded into HTML and also HTML code can be embedded into java code through Java Server Pages Technology (JSP).

eg: Java code inside HTML.

Hello! The time is now <%= new java.util.Date() %>

This is someHelloJavaProgram.jsp , not someHelloJavaProgram.HTML page

eg: HTML code inside Java code

import javax.servlet.*;

import java.io.*;

public class HelloServlet extends HttpServlet {

public void doGet(HttpServletRequest incoming,

HttpServletResponse outgoing)

throws ServletException, IOException {

outgoing.setContentType("text/HTML");

PrintWriter out = outgoing.getWriter();

out.println("Hello!");

out.println("

Hello Servlet World

");

out.println("");

out.close();

}

}

http://www.wellho.net/resources/ex.php4?item=j906/HelloServlet.java

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

BeauBeau
You're doing better than you think!
Chat with Beau
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
More answers

Java isn't a page description language like HTML. It's a programming language. Description languages specify content and placement; programming languages describe a process for generating a result. Where there is generally a direct mapping between an HTML description of a document and the result, the relationship between a Java program and its result is likely to be more complex. It's a little like the difference between a list of square roots of numbers from zero to 10 and a program to calculate the list.

This is the code that specifies the Java code to run:

You need a Java-aware browser

The tag specifies the class to load (the CODE= field), URL information (the CODEBASE= field) and the size of the region the applet will own. Notice that Java doesn't exactly integrate with the rest of the page. Within that region of the page Java is king: it decides background color and fonts and does all the mouse and keyboard handling.

Parameters to the applet are placed in tags between the and tags. Anything else between these tags is ignored.

(IGNOU - BCA - CS-74 - Q.2(ii) - 2009)

Visit : www.hamidraza.page.tl

User Avatar

Wiki User

15y ago
User Avatar

You don't insert the Java code directly. First you create an applet in Java, then use an HTML tag to insert the Java Applet into a webpage. The HTML tag for this should look like the following:

Java not enabled...

ClassFile.class would contain the compiled code for your applet and the width and height would define the size of the applet on the webpage. You can pass parameters to the applet using the tag. These parameters appear when calling the getParameter("parameter_name") function.

This is a very basic HTML applet tag. If you are looking for something more complex, I'd suggest that you search "HTML JAVA applet tutorial" or something of the sort in any search engine.

User Avatar

Wiki User

13y ago
User Avatar

No you cant since Java is like Flash and HTML code does not appreciete Java.

User Avatar

Wiki User

15y ago
User Avatar

HTML is a Hyper Text Markup Language. It is a static language. We can use HTML to create static web pages but we need java to make it dynamic.

User Avatar

Wiki User

16y ago
User Avatar

You have to use a third-party API to be able to execute JavaScript commands in Java code.

User Avatar

Wiki User

15y ago
User Avatar

Java Program could be embedded into a HTML code. This can be done by making the code into a JSP page.

User Avatar

Wiki User

10y ago
User Avatar

Add your answer:

Earn +20 pts
Q: What is the relationship between Java and HTML?
Write your answer...
Submit
Still have questions?
magnify glass
imp