Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-17-2008, 06:34 PM
Member
 
Join Date: Jan 2008
Posts: 3
abcd is on a distinguished road
How Do I Embed Java Correctly To A Web Page
Can someone please help me correct both codes below so that they can display Java correctly in the browser I can make it work for the <pplet> tag but not the <object> or <embed> tags Please Help. Thanks

<object classid="java:AnimCercles.class" width="350" height="50" align="bottom">
<param name="code" value="AnimCercles.class" />
<param name="bgcolor" value="red" />
<param name="fgColor" value="green" />
<param name="bgType" value="Oval" />
<param name="text" value="JavaSITE is Fun!" />
<param name="font" value="TimesRoman" />
<param name="style" value="BOLDITALIC" />
<param name="textColor" value="blue" />
<param name="size" value="40" />
<param name="playBack" value="0" />
<param name="step" value="12" />
<param name="timeSleep" value="30" />
</object>


<embed code="java:AnimCercles.class" width="450" height="72" type="application/x-java-applet;version=1.6.0" pluginspage="http://www.java.sun.com/j2se/1.5.0/download.html" />
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-17-2008, 06:43 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
You can use the HTML converter tool as mentioned on Deploying Applets in a Mixed-Browser Environment.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 06:48 PM
Member
 
Join Date: Jan 2008
Posts: 3
abcd is on a distinguished road
Thats a good idea, but my <embed> tag wont display at all in any browser and the <object> tag will only display in Firefox do you know what is wrong with my code thanks.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-17-2008, 08:52 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
The "classid" values in the examples shown in the tutorial look quite a bit different from yours.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 01-17-2008, 09:25 PM
Member
 
Join Date: Jan 2008
Posts: 3
abcd is on a distinguished road
I can get the <object> tag to work in FireFox but not Internet Explore and the <embed> tag does not work at all Thanks.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 01-27-2008, 04:12 PM
Member
 
Join Date: Jan 2008
Posts: 6
sabbirhs is on a distinguished road
did you check the options of IE. Is IE permitting applet?
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 01-27-2008, 04:13 PM
Member
 
Join Date: Jan 2008
Posts: 6
sabbirhs is on a distinguished road
hardwired is right. Take a look at the code="*.java" name.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 01-28-2008, 09:53 AM
Member
 
Join Date: Jan 2008
Posts: 4
rhlpnt is on a distinguished road
Insert values in database using hibernate
i am trying to insert the value in databases but it is fired by hibernate...i have not resolved it since one week..

Hibernate: select unwanted0_.ID as ID0_0_, unwanted0_.name as name0_0_ from UNWANTED unwanted0_ where unwanted0_.ID=?
org.hibernate.MappingException: Unknown entity: java.lang.Long
at org.hibernate.impl.SessionFactoryImpl.getEntityPer sister(SessionFactoryImpl.java:548)
at org.hibernate.impl.SessionImpl.getEntityPersister( SessionImpl.java:1338)
at org.hibernate.engine.ForeignKeys.isTransient(Forei gnKeys.java:180)
at org.hibernate.event.def.AbstractSaveEventListener. getEntityState(AbstractSaveEventListener.java:487)
at org.hibernate.event.def.DefaultPersistEventListene r.onPersist(DefaultPersistEventListener.java:70)
at org.hibernate.event.def.DefaultPersistEventListene r.onPersist(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(Session Impl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl .java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl .java:596)
at org.apache.jsp.unwanted_jsp._jspService(unwanted_j sp.java:131)
at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)

org.apache.jasper.JasperException: Exception in JSP: /unwanted.jsp:4

1: <%@ include file="protected.jsp" %>
2: <%@ include file="header.jsp" %>
3: <%
4: Long id=Long.valueOf(request.getParameter("Id"));
5: Session sess = HibernateUtil.currentSession();
6: Unwanted u= new Unwanted();
7:


Stacktrace:
my mapping looks like it..
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.ats.custFlight.pojo.Unwanted" table="unwanted" lazy="false">
<id column="ID" name="id" type="java.lang.Long"/>
<property column="name" name="name" type="java.lang.String"/>
</class>
</hibernate-mapping>



my code to upload data is--

Long id=Long.valueOf(request.getParameter("Id"));
Session sess = HibernateUtil.currentSession();
Unwanted u= new Unwanted();

Unwanted u2 = (Unwanted) sess.get (Unwanted.class,(long)77);
u.setId(id);
u.setName("RAHUL");
try{
sess.save(u);
}catch( Exception e )
{
e.printStackTrace();
}
System.out.println(" size is " + u.getId());

my hibernate.util code is--
package com.ats.custFlight.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.hibernate.*;
import org.hibernate.cfg.*;

public class HibernateUtil {

private static Log log = LogFactory.getLog(HibernateUtil.class);

private static final SessionFactory sessionFactory;

static {
try {
// Create the SessionFactory
sessionFactory = new Configuration().configure().buildSessionFactory();

} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
log.error("Initial SessionFactory creation failed.", ex);
ex.printStackTrace();
throw new ExceptionInInitializerError(ex);
}
}

public static final ThreadLocal < Session > session = new ThreadLocal < Session > ();

public static Session currentSession() throws HibernateException {
Session s = (Session) session.get();
// Open a new Session, if this Thread has none yet
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}

public static void closeSession() throws HibernateException {
Session s = (Session) session.get();
session.set(null);
if (s != null)
s.close();
}
}
and JAVA CLASS IS..

package com.ats.custFlight.pojo;

public class Unwanted {

Long id;
String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}
}
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read a Web Page through java program Java Tip java.net 0 04-04-2008 04:37 PM
Email Embed Image gui.gomes Advanced Java 3 11-19-2007 04:08 PM
How to read a Web Page through java program JavaBean Java Tips 0 10-04-2007 11:31 PM
redirect page within a java applet paul Java Applets 1 08-07-2007 07:11 AM
How to get the URL of a web page through a Java application? vissu007 Networking 3 06-28-2007 12:56 PM


All times are GMT +3. The time now is 08:06 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org