Java with HTML
Hi, just a quick question.
Im completely new to java, is it possible to use java with a HTML front end?(im also using vbscript/javascript for user registration purposes etc)
Im trying to create a secure payment system for a website im creating.
Thanks.
Try looking into Java Web Services and J2EE. There is a wealth of technology from Servlets to JSP pages to help you to do this.
-David
Similar Messages
-
Hi,
I have got following project :
an axis webcam displays an image thanks to http protocol
at the right of my image, I have to create a panel with some java controls.
I would like some hints on howto do this?
Do I need a to setup a web server or is it possible to do this using a single html file loaded in my browser ?
Best Regards
StephAt best you can load an applet in a html page (the other possibility is to use servlets and JSP's to do server side processing, which is most likely not what you want to do).
But what do you want to do with these "java controls"? -
Can' t connect Java with MySQL
My goal is to connect Java with MySQL. I found many solutions on Internet, but I always get the same mistake:
SQLException: No suitable driver
SQLState: 08001
VendorError: 0MySQL works fine alone or with php.Only thing left me to think is that the installed versions are not compatible for this mysql-connector-java-5.0.4
I don't believe that could be a reason.
Installed versions are:
Apache Tomcat 5.5.20 Server
Apache HTTP Server 2.2.4
PHP 5.2.0
MySQL 5.2
jre 1.5.0_11
jdk1.5.0_11
Apache Tomacat JK2 connector Version: 1.2.20 File Name: mod_jk-apache-2.2.3.so
mysql-connector-java-5.0.4
I also set connector in class path: C:\mysql-connector-java-5.0.4;C:\mysql-connector-java-5.0.4\mysql-connector-java-5.0.4-bin.jar;C:\mysql-connector-java-5.0.4\src\com\mysql\jdbc
For installation I used manulas from:
http://apacheguide.org/jsp.php
http://doc.51windows.net/mysql/?url=/MySQL/ch23s03.html
Here is also a test code in java:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Connect
public static void main (String[] args)
Connection conn = null;
try {
conn =
DriverManager.getConnection("jdbc:mysql://localhost/first_test" +
"user=monty&password=greatsqldb");
// Do something with the Connection
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}i'm desperate, please help or tell me someone who'll know the answer.
Thank You in advancehey buddy .. it seems yr code is wrong .. in getconnection () method u should also specify the port ,which u r not doing ...
the default port for MySQL is 3306 ... see below i am giving you a sample code ... its working fine .. and dont forget to put the MySQL driver jar path in to classpath and also copy the jar into common/lib folder of your tomcat ....
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class MySQLConnectionTest {
public static void main(String[] args) {
new MySQLConnectionTest().connTest();
public void connTest() {
String tableName = "portfolio"; //change as per setting
String hostName = "10.81.9.39"; // please change for the target database ip or hostname
String dbPort = "3306"; //change if not using the default
String dbName = "tradingsystem"; //change as per the given DB name
String username = "root"; //change as per setting
String password = "password"; //change as per setting
System.out.println("before try");
Double data=0.0;
Double data1=0.0;
try {
Class.forName("org.gjt.mm.mysql.Driver");
System.out.println("before driver manager");
Connection conn = DriverManager.getConnection("jdbc:mysql://"+hostName+":"+dbPort+"/"+dbName, username, password);
String query1 = "select * from "+tableName+" where User_id='trader1' and Stock_Type='Equity'";
System.out.println("quesry1="+query1);
Statement stmt = conn.createStatement();
ResultSet rs1 = stmt.executeQuery(query1);
while(rs1.next())
System.out.println("hiiiiii for rs1");
System.out.println(rs1);
Quantity=(Integer)rs1.getObject(5);
MarketPrice=(Double) rs1.getObject(8);
data=Quantity*MarketPrice;
data1+=data;
System.out.println("data1="+data1);
i=0;
rs1.close();
stmt.close();
conn.close();
} catch (ClassNotFoundException e) {
e.printStackTrace(System.err);
} catch (SQLException e) {
e.printStackTrace(System.err);
i hope it will work for u...
cheers, -
How to use Java with PL/SQL commands to send an email with attachment
Apologizes in advance if this is the wrong place to ask the question.
I need to use Java with PL/SQL commands to send an email with attachment. My java application runs from the command line and does some magic to gather info from an Oracle 11g db. If the DB has sendmail configured, I'd like to send the results of the data gathering as an attachment to the email addresses. I'm not sure how to do this. I've been reading up on on PL/SQL can send email with UTL_SMTP - with attachments. I'm just not sure how to translate that into being triggered by my Java application. Any suggestions or pointers on what I should read would be appreciated.
Background - I've been programming in Java for 10+ years, but this is my first time using databases. I also have been on these forums for a long time, but lost my profile when it was switched to Oracle.
Thanks for all help.user13726880 wrote:
The original requirements were put together and given to me, an Oracle newbie. They expected the Java app to use something intrinsic to Oracle and Unix sendmail. To solve my problem, I use a JDBC connection to run some SQL commands. I take that data, format it and send the results by email to the user. By default the requirement is to send it as an HTML attachment using Unix 'sendmail'. So I do that using Runtime exec. I have also added JavaMail functionality as an alternative to sendmail. It works great and as expected.Sounds like a reasonable solution.
Note however that PL/SQL itself can send email. And PL/SQL can call unix sendmail too.
However myself I would have done it in java with JavaMail. -
Send email with html and images over Sockets
Hi! I'm sending email messages through sockets with html. So far is working great. But now, I need to include images in the html code, like a web page. I don't have any idea on how to do this. Sending image apart from the html code is not big deal, but how to put it in the code. I mean how to make this html code, work:
<table border="0">
<tr>
<td>Image in code</td>
</tr>
<tr>
<img src="what to put here"/>
</tr>
</table>This is the code that I'm using to send the html mail:
StringBuffer retBuff = new StringBuffer();
//BufferedReader msg;
//msg = new BufferedReader(msgFileReader);
smtpPipe = new Socket(mailHost, SMTP_PORT);
smtpPipe.setSoTimeout(120000);
if (smtpPipe == null) {
return retBuff;
inn = smtpPipe.getInputStream();
outt = smtpPipe.getOutputStream();
in = new BufferedReader(new InputStreamReader(inn));
out = new PrintWriter(new OutputStreamWriter(outt), true);
if (inn == null || outt == null) {
retBuff.append("Failed to open streams to socket.");
return retBuff;
String initialID = in.readLine();
retBuff.append(initialID);
retBuff.append("HELO " + localhost.getHostName());
out.println("HELO " + localhost.getHostName());
String welcome = in.readLine();
retBuff.append(welcome);
retBuff.append("MAIL From:<" + from + ">");
out.println("MAIL From:<" + from + ">");
String senderOK = in.readLine();
retBuff.append(senderOK);
for (int i = 0; i < to.length; i++) {
retBuff.append("RCPT TO:<" + to[i] + ">");
out.println("RCPT TO:<" + to[i] + ">");
String recipientOK = in.readLine();
retBuff.append(recipientOK);
retBuff.append("DATA");
out.println("DATA");
out.println("From: Steren <" + from + ">");
out.println("Subject: " + subject);
out.println("Mime-Version: 1.0;");
out.println("Content-Type: text/html; charset=\"ISO-8859-1\";");
//out.println("Content-Type: multipart/mixed; charset=\"ISO-8859-1\";");
//out.println("Content-Transfer-Encoding: 7bit;");
//String line;
//while ((line = msg.readLine()) != null) {
// out.println(line);
out.println(msg);
retBuff.append(".");
out.println(".");
String acceptedOK = in.readLine();
retBuff.append(acceptedOK);
retBuff.append("QUIT");
out.println("QUIT");
return retBuff;Throw all this away and use one of the numerous existing Java mail packages, such as javax.mail for a start.
-
JLabel with HTML visible only for the first time
I've implemented a really simple applet:
public class TestApplet extends JApplet {
@Override
public void init() {
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JPanel topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
getContentPane().add(topPanel);
JLabel labelHello = new JLabel("<html>Hello World!</html>");
topPanel.add(labelHello, BorderLayout.NORTH);
JLabel labelHelloNoHTML = new JLabel("Hello World - without html!");
topPanel.add(labelHelloNoHTML, BorderLayout.SOUTH);
} catch (Exception e) {
System.err.println("Couldn't initialize GUI");
}And there are two html pages, both having the same applet and a link referring to each other:
index.html
<html>
<head><title>Applet</title></head>
<body>
<div><a href="link.html">Link</a></div>
<div>
<applet hspace="0" height="375" align="left" width="600" vspace="0" mayscript="" alt="GetJava" codebase="./"
code="com.test.TestApplet" name="TestApplet"></applet>
</div>
</body>
</html>link.html
<html>
<head><title>Applet</title></head>
<body>
<div><a href="index.html">Link</a></div>
<div>
<applet hspace="0" height="375" align="left" width="600" vspace="0" mayscript="" alt="GetJava" codebase="./"
code="com.test.TestApplet" name="TestApplet"></applet>
</div>
</body>
</html>Now when I navigate to index.html the applet shows correctly both labels but in case I jump to link.html the applet shows only the second label i.e. Hello World - without html! . This seems to be specific to Java version 1.6.0_21 and 1.6.0_22, it was working properly in 1.6.0_17. Is anyone else experiencing similar issue or am I missing something?
Edited by: user13135196 on Nov 25, 2010 4:33 AM
Edited by: Slavek Tecl on 25.11.2010 13:12I am having this exact same issue. I have a JLabel with <html> for superscript in my JApplet. The first time I run my applet it displays fine. All subsequent times (refresh the page, or close the tab then open again) the JLabel with <html> doesn't show. This issue does NOT occur in the Eclipse Applet Viewer, but does occur with Google Chrome9 and IE8.
I spent forever checking my methods and changing things trying to figure out why all the other labels show. Never would have guessed <html> in a JLabel would make it not display. This is terrible bug. Please fix ASAP. -
Hi,
Somebody can tell me how can i put a Jlabel with html in a Jtable cell. Is that possible ?
Tks.you need to implement a TreeTableCellRenderer
and add the renderer to your table.
check the Java tutorial on table
forgot the link..so you gotta google the link "java Table tutorial" -
RichText with HTML markup in PDF
Hello
I've come to the point, when I need to display rich text with html markups in output PDF.
PDF is going to be printed and I don't want anything to be editable.
I've started with xsd schema for the xdp template, where particular element looks like this:
<xs:element name="note">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute ref="xfa:contentType" fixed="text/html"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
in xdp form, I am using TextField with RichText option switched on, value type: Read Only
as a test, xml data, which I am passing into it, looks like this:
<note>
<body xmlns="http://www.w3.org/1999/xhtml">
<b>Note</b>
<a href='http://somepage.com'>homepage</a>
<img src = 'pdficon.png'/>
</body>
</note>
It comes from the html snippet, which is also displayed in java web application using the wicket framework, so no problem with that in web browser.
In general, it works, I am not getting any parsing errors or other exceptions from LC.
Now, my questions are:
1.hyperlink is displayed correctly in blue color and underlined, but it is not clickable ... is it because of the ReadOnly option?
2. Obviously, image is skipped. I don't expect that to be shown in textField, also there is not real path to that image, but I wonder, is it
possible to display it in some other way? Or, to be more precise, is it possible to interpret <img src... correctly in PDF?
3. I understand from some other thread in this forum, that it is not possible to paste html snippet into PDF directly?
Many thanks
MartinHi Abhinav
What my question your reply does apply to? Nr. 3?
Martin -
Hi,
I want to use java with oracle (java stored procedures). I am not able to compile my java class even. Is JDK not installed when oracle is insatlled ? or there is some other error? or i shall some other way to create my class?
wht shall i do to start
Thx in advance
NamrataJDK is installed with oracle.
For compiling the java class you should have <Oracle_HOme>/jdk/bin in your system path variable.
Also set the classpath to have all the jars required by your program. For example if you are using jdbc, include <Oracle_Home>/jdbc/lib/classes12.jar in classpath.
Refer this url for samples on java stored procedure.
http://otn.oracle.com/sample_code/tech/java/jsp/oracle9ijsp.html
Chandar -
How to put String with html tags as it is into xml
I am using apache dom API to create xml from java.
I have a string with html tags in it .when I add the string to xml, its replacing all the "<"; with < and ">" with > I would like the html tags to look as it is instead of the > and & lt;. How can I acheive that
this is the code snippet of what I am doing
In java class
String titleString = "<font color=red>This Is an Example of a Red Subject</font>"
Document doc = new DocumentImpl();
Element root = doc.createElement("bulletin");
Element item = doc.createElement("title");
item.appendChild(doc.createTextNode(titleString));
In Xml it looks like below
<title><font color=red>This Is an Example of a Red Subject</font></title>
but I would like to have the xml like below
<title><font color="red">This Is an Example of a Red Subject</font></title>
Can you please suggest me whats the best way to acheive this.
I appreciate all your help
Thank you
SumaOne problem is that you don't understand escaping. If you re-read what you posted you'll see that what you say you get, and what you say you want, are identical. That's because you didn't escape one of the two properly. So your first step should be to find the section about escaping in Chapter 1 of your XML book and read it carefully. Figure out what you should have done here (yes, the same rules apply).
However, to attempt to answer what I think your question is: if you have a String which contains markup, and you want to convert that String to XML elements, then you have to feed the String into an XML parser. -
I am currently working on a migration project where we need to integrate Java with existing COM components. Can someone suggest some commercially/freely available tools which helps you do that? I believe JNI is something which is specifically meant for jobs like this. Does anyone has experience using JNI for such a job?
Any insights in this regard would be highly appreciated.Hi,
Check out http://jakarta.apache.org/poi
Also, here's a handy tool to generate Java wrapper classes to any ActiveX control/DLL/exe you point it to.
http://www.alphaworks.ibm.com/tech/bridge2java
Although IBM will want ���1000 for commercial license I think.
Here's a freeware version.
But you have to specific each individual CLS_ID, instead of just pointing to a type library and letting it generate everything.
http://www.simtel.net/pub/pd/60701.html
regards,
Owen -
Importing and Exporting Data with a Clob datatype with HTML DB
I would like to know what to do and what to be aware of when Importing and Exporting data with a Clob Datatype with HTML DB?
Colin - what kind of import/export operation would that be, which pages are you referring to?
Scott -
Textarea with HTML editor is not working
Hi all,
This is producing me a real headache.
I created the simplest application in the world with one Textarea with HTML editor, and the editor control does not show the usual tool bar for fonts, color, alignment, etc. Just a ordinary textarea.
Moreover, this was working before... I moved to another location in my work (me, not the server). Yes, I thought about the Internet Explorer, but Firefox has the same issue.
So any idea I can try to make this work?
I have another applications already in production with the same issue.
Need help!!!!!!!!!
Thanks in advance.
Lukas.
Application Express 2.1.0.00.39
Oracle Database 10g Express Edition Release 10.2.0.1.0
Internet Explorer 7.0.5730.11
Firefox 1.5.0.11
Windows XP Service Pack 2
1 G Ram
Pentium D CPU 2.80GHzLukas,
I would go and integrate FCKEDITOR (http://www.fckeditor.net/ ) into your application.
Here are instructions on how to achieve this (sorry but only in German):
http://www.oracle.com/global/de/community/tipps/einbinden_fckeditor/index.html
It basically means:
1) copying the files from fckeditor under the /images directory
(you can use the instructions here: http://daust.blogspot.com/2006/03/where-are-images-of-application.html)
2) creating two shortcuts INCLUDE_EDITOR_SCRIPTS and EDITOR
3) placing the shortcut INCLUDE_EDITOR_SCRIPTS into the page html header and
4) placing the shortcut EDITOR into the post element text of your plain textarea element
That's it.
BTW, FCKEDITOR has been included in Apex 3.0 as a standard item type.
Regards,
~Dietmar. -
Replacing non-ASCII characters with HTML charcter references
Hi All,
In Oracle 10g or greater is there a built-in function that will convert a string with non-ASCII characters like this
a b č 뮼
into an ASCII string with HTML character references like this?
a b & # x 0 1 0 D ; & # x B B B C ;
(note I had to include spaces between each character in the sample code for message to prevent the forum software from converting my text)
I tried using
utl_i18n.escape_reference( val, 'us7ascii' )
but for some reason it returns
a b c & # x B B B C ;
Note how it converted the Western European character "č" to its unaccented counterpart "c", not "& # x 0 1 0 D ;" (is this a bug?).
I also tried a custom solution using regexp_replace and asciistr (which I can't include here because the forum software chokes on it) but it only returns the correct result for values <=4000 characters long. Unfortunately asciistr doesn't appear to accept CLOB values larger than 4000 characters. It returns an error message like
(ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 30251, maximum: 4000) ).
I'm looking for a solution that works on CLOB data of any size.
Thanks in advance for any insight you can provide.
Joe FudaSo with that (UTF8) in mind, let's take another look.....
As shown below, I used a AL32UTF8 database.
Note: I did not use a unicode capable tool for querying. So I set console mode code page to 1250 just to have č displayed properly (instead of posing as an è).
Also, as a result of using windows-1250 for client character set, in the val column and in the second select's ncr column (iso8859-1), è (00e8) has been replaced with e through character set conversion going from server back to client.
Running the same code on a database with a db character set such as we8mswin1252, that doesn't define the č (latin small c with caron) character, would yield results with a c in the ncr column.
C:\>chcp 1250
Aktuell teckentabell: 1250
C:\>set nls_lang=.ee8mswin1250
C:\>sqlplus test/test
SQL*Plus: Release 11.1.0.6.0 - Production on Fri May 23 21:25:29 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the OLAP option
SQL> select * from nls_database_parameters where parameter like '%CHARACTERSET';
PARAMETER VALUE
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET AL16UTF16
SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'us7ascii') NCR from dual;
VAL NCR
č e c e
SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'we8iso8859p1') NCR from dual;
VAL NCR
č e &# x10d; e <- "è"
SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'ee8iso8859p2') NCR from dual;
VAL NCR
č e č &# xe8;
SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'cl8iso8859p5') NCR from dual;
VAL NCR
č e &# x10d; &# xe8;In the US7ASCII case, where it should be possible for all non-ascii characters to be escaped, it seems as if the actual escape step is skipped over.
Hope this helps to understand whether utl_i8n is usable or not in your case.
Message was edited by:
orafad
Fixed replaced character references :) -
While downloading an eBook from internet, I found a book in a folder containing around 123 files, which is equivalent to the number of pages of the book.
My interest is to bring them together in one file so that I can read it at a time. As the interface is not comfortable with html, I also like to convert it into another more suitable file format.Hello djensen1x,
Could you please let me know what version of Acrobat are you using.
Also, tell me your workflow of combining those PDF files?
Please share the screenshot of the error message that you get.
Hope to get your response.
Regards,
Anubha
Maybe you are looking for
-
HP Photosmart 5525 problem with scanning and copying
Hello Everyone, I bought a new HP Photosmart 5525 few months ago and it was working fine with everything but suddenly it stopped scanning and copying. while copying it doesnt do anything and while scanning it gives the error message " Scanner commun
-
Mapping in Administration Tool
Hi All, I have created in AWM two simple cubes and so two cubeview with VIEW Generator plugin Cube 1: DIM A DIM B MEASURE 1 Cube 2: DIM A MEASURE 2 First cube is based on fact table Budgets and second cube is based on fact table Actuals So two Fact T
-
Out of box auto deployment fails when trying to set up first DC in new domain
Tried to configure and deploy windows server 2012 R2 essential many times. It's the most simple scenario -- PDC in first domain. However, every time it stuck at around 67% and gave me an error about not able to continue. The group policy list is empt
-
Safari Tells Me I Need to Update Flash Even Though I Just Did
Safari and Firefox were both telling me while using YouTube that I needed to upgrade my version of Flash. So I upgraded and now Firefox no longer gives me the upgrade message, but Safari still gives me the following message: "Upgrade to the latest
-
Hello, I am making a program to control two DC motors. I write a word in the program and the engines draw it on paper. Now I need to see on the screen the moves that are making the engines, for that I have two values for a graph X and Y, but i don't