473,387 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to club html code in java

7
I wrote java file to send mass email. But mail contains images, text format .
Is it possible to club html code in java file?
thanks
Aug 20 '07 #1
4 1487
kreagan
153 100+
are you going to display this HTML code in an swing application? Because you can do that.

http://java.sun.com/javase/6/docs/api/
http://java.sun.com/javase/6/docs/api/

http://java.sun.com/javase/6/docs/api/

But what do you want to do with this html code? What do you mean by club? By club you mean how PHP can process HTML code, I highly doubt you will find any way to do that.
Aug 20 '07 #2
epots9
1,351 Expert 1GB
i haven't used java for awhile now but, i hope this helps.

can't u set the contentType to "text/html"? that way when it is emailed the receiver's client will receive that header info and parse the email as if it were an html document.

i know this can be done in servlets, so i hope it can be here too.

good luck
Aug 20 '07 #3
Nepomuk
3,112 Expert 2GB
I don't know, if it helps, but you can certainly print HTML by using a PrintWriter like this:

Expand|Select|Wrap|Line Numbers
  1. // Create a new PrintWriter, which writes to a file called "test.htm" in the present directory
  2. PrintWriter writer = new PrintWriter(new FileOutputStream("test.htm"));
  3. // Write HTML-Code to the file
  4. writer.print("<html>" +
  5.     "<head><title>Write to HTML-File</title></head>" +
  6.     "<body>" +
  7.     "This works!" +
  8.     "</body>" +
  9.     "</html>");
  10. // Close the file (otherwise it will be empty)
  11. writer.close();
  12.  
Of course, the PrintWriter can recieve a totally different OutputStream.
Aug 22 '07 #4
gaya3
184 100+
I wrote java file to send mass email. But mail contains images, text format .
Is it possible to club html code in java file?
thanks

Hi,
Following code may help u...

import java.io.*;
class Htmlinjava
{


public static void main (String args[])
{

FileOutputStream fout;

try
{

fout = new FileOutputStream ("myfile.html");


new PrintStream(fout).println ("<html><body>"+"Hello World!"+"</body></html>");


fout.close();
}

catch (IOException e)
{
System.err.println ("Unable to write to file");

}

}
Aug 24 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
0
by: wilson_20004 | last post by:
A Division of Cash Cards International, Ltd Saturday, February 11, 2006 The GoldLynks Club Dedicated to the Advancement and Enrichment of all our Members Man has treasured Gold and Silver...
0
by: gguan123 | last post by:
Recommend an excellent ASP program gives everyone:Webmaster club news system v5.09 demo:http://www.caifuw.com/en/new/ download:http://dow.caifuw.com/new5.09freeEn.rar Categories:asp(news system)...
0
by: shaolinman829 | last post by:
My collegue and I are at the point of pulling our hair out. I'm currently writting a little piece of Java code to send an email confirmation page that sends both html and text. Not a problem. In my...
3
tpgames
by: tpgames | last post by:
When I renamed the class file to Audiodriver.class and changed the link to Audiodriver.class, the game wouldn't load. I got this error java.lang.NoClassDefFoundError: Audiodriver (wrong name:...
5
by: ajos | last post by:
hi frnds, this is the way i ve written--> <html:text name="bdgtmastForm" property="publicity_code" size="5" maxlength="5"> but its giving me an error which seems irrelevent.. type Exception...
31
by: ajos | last post by:
hi frnds, i have a form,which has 2 input text boxes, the values are entering the text boxes,when i leave the 2 text boxes blank and hit submit a java script gives the message that the 2 fields are...
9
by: ajos | last post by:
hi all, im getting some problems in my javascript validations..... my jsp code--> 8: <head> 9: <title>Budget Master Administration</title> 10: <meta name="GENERATOR" content="Microsoft...
2
by: ramprakashjava | last post by:
This is index.jsp page code: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.