Results 1 to 10 of 10
  1. #1
    destined is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Unhappy experiencing a problem using Hibernate featuring JSP..pl help :( :(

    i created a jsp application in hibernate using myeclipse8.6...n wen i kept it on server to access its give error as jsp cud not be compiles..Compilation of JSP File '/MyJsp.jsp' failed:
    MyJsp.jsp:4:18: The import org.hibernate cannot be resolved
    <%@ page import="org.hibernate.cfg.*" %>
    ^-----------------^
    MyJsp.jsp:5:18: The import org.hibernate cannot be resolved
    <%@ page import="org.hibernate.*" %>
    ^-------------^
    MyJsp.jsp:6:18: The import org.hibernate cannot be resolved
    <%@ page import="org.hibernate.SessionFactory" %>
    ^--------------------------^
    MyJsp.jsp:15:1: Configuration cannot be resolved to a type
    Configuration cfg=new Configuration();
    ^----------^
    MyJsp.jsp:15:23: Configuration cannot be resolved to a type
    Configuration cfg=new Configuration();
    ^----------^
    MyJsp.jsp:17:1: SessionFactory cannot be resolved to a type
    SessionFactory sf=cfg.buildSessionFactory();.......

    my jsp is as follows:


    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%@ page import="my.pack.Product"%>

    <%@ page import="org.hibernate.cfg.*" %>
    <%@ page import="org.hibernate.*" %>
    <%@ page import="org.hibernate.SessionFactory" %>
    <%
    String pid1=request.getParameter("pid");
    String pname=request.getParameter("pname");
    String price=request.getParameter("price");
    long vpid=Long.parseLong(pid1);
    float vprice=Float.parseFloat(price);
    %>
    <%
    Configuration cfg=new Configuration();
    cfg.configure();
    SessionFactory sf=cfg.buildSessionFactory();
    Session hsession = sf.openSession();
    Transaction tx=hsession.beginTransaction();
    my.pack.Product pid=new my.pack.Product();
    pid.setPid(vpid);
    pid.setPname(pname);
    pid.setPrice(vprice);
    hsession.save(pid);
    tx.commit();
    hsession.close();
    %>

    please suggest..thanx in adnvc...

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    618
    Rep Power
    4

    Default

    I advice you don't use any Java code in JSP.For this aim you can use JSTL library.
    About your problem you just forgot to set some libraries for Hibernate in classpath.
    Skype: petrarsentev
    http://TrackStudio.com

  3. #3
    destined is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Default

    k.. i'm new to hibernate can u plz elobrate about setting classpath in hibernate..i mean wic library files..i did this using myeclipse ide..pl sugest

  4. #4
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    618
    Rep Power
    4

    Default

    Ok. Have you ever made some app with use Hibernate without JSP?
    Skype: petrarsentev
    http://TrackStudio.com

  5. #5
    destined is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Default

    yeah i did jus to store data in database.. n perform all manipulations like to delete ,update etc.. setting classpath does dat mean i nead to place hibernate core libraries in lib folder of my project.. please reply soon ..wating for u answer..:(

  6. #6
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    618
    Rep Power
    4

    Default

    Ok If you know as to delete, update etc. What is problem? You can pass some information from jsp to special class, which to make these manipulations. That is all.
    Skype: petrarsentev
    http://TrackStudio.com

  7. #7
    destined is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Default

    oh no its not about spcl class.. please look at my code..

  8. #8
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    618
    Rep Power
    4

    Default

    I repeat you have mistake in classpath. Can you explain steps as you build and deploy your app?
    Skype: petrarsentev
    http://TrackStudio.com

  9. #9
    destined is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Default

    i simply created a webproject in myeclipse n den added the above jsp..n while adding hibernate capabilities all the jar files wer added to main project folder but not inside web-inf..bb4 dat created a product table in db explorer and added hibernate reverse engg later its pojo class was visible in my main project folder simply took it n run using weblogic.. pleaz gracious n elobrate.. thnkqqqq:)

  10. #10
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    618
    Rep Power
    4

    Default

    I don't want to make this task for you.
    so I want that you self to elaborate in this topic.
    Is it task from your Uni or are you really want to figure out in this subject?
    Sure I can make short example which show as you can make this, but I don't want.
    Skype: petrarsentev
    http://TrackStudio.com

Similar Threads

  1. problem in hibernate
    By jperson in forum JDBC
    Replies: 1
    Last Post: 01-11-2011, 10:10 AM
  2. display tag hibernate problem
    By rajiv in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-16-2010, 12:21 PM
  3. composite-id problem hibernate
    By javadev in forum JDBC
    Replies: 14
    Last Post: 07-27-2009, 06:30 PM
  4. Hibernate cache problem
    By jispat in forum New To Java
    Replies: 0
    Last Post: 12-29-2008, 11:18 AM
  5. problem in hibernate need help!
    By jrgahan in forum Advanced Java
    Replies: 0
    Last Post: 05-22-2008, 09:00 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
  •