Results 1 to 8 of 8
  1. #1
    abcd is offline Member
    Join Date
    Jan 2008
    Posts
    3
    Rep Power
    0

    Question 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" />

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    You can use the HTML converter tool as mentioned on Deploying Applets in a Mixed-Browser Environment.

  3. #3
    abcd is offline Member
    Join Date
    Jan 2008
    Posts
    3
    Rep Power
    0

    Default

    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.

  4. #4
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    The "classid" values in the examples shown in the tutorial look quite a bit different from yours.

  5. #5
    abcd is offline Member
    Join Date
    Jan 2008
    Posts
    3
    Rep Power
    0

    Question

    I can get the <object> tag to work in FireFox but not Internet Explore and the <embed> tag does not work at all Thanks.

  6. #6
    sabbirhs is offline Member
    Join Date
    Jan 2008
    Posts
    6
    Rep Power
    0

    Default

    did you check the options of IE. Is IE permitting applet?

  7. #7
    sabbirhs is offline Member
    Join Date
    Jan 2008
    Posts
    6
    Rep Power
    0

    Default

    hardwired is right. Take a look at the code="*.java" name.

  8. #8
    rhlpnt is offline Member
    Join Date
    Jan 2008
    Posts
    4
    Rep Power
    0

    Default 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;
    }
    }

Similar Threads

  1. How to read a Web Page through java program
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-04-2008, 03:37 PM
  2. Email Embed Image
    By gui.gomes in forum Advanced Java
    Replies: 3
    Last Post: 11-19-2007, 03:08 PM
  3. How to read a Web Page through java program
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 10-04-2007, 10:31 PM
  4. redirect page within a java applet
    By paul in forum Java Applets
    Replies: 1
    Last Post: 08-07-2007, 06:11 AM
  5. Replies: 3
    Last Post: 06-28-2007, 11:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •