Results 1 to 4 of 4

Thread: 500 error

  1. #1
    Join Date
    Oct 2011
    Posts
    2
    Rep Power
    0

    Unhappy 500 error

    I got error while i run my HTML file:

    Entity File

    package com;
    public class LeavePolicyEntity {
    private String leaveid;
    private String typeofleave;
    private int initialleave;

    public String getLeaveid() {
    return leaveid;
    }
    public void setLeaveid(String leaveid) {
    this.leaveid = leaveid;
    }
    public String getTypeofleave() {
    return typeofleave;
    }
    public void setTypeofleave(String typeofleave) {
    this.typeofleave = typeofleave;
    }
    public int getInitialleave() {
    return initialleave;
    }
    public void setInitialleave(int initialleave) {
    this.initialleave = initialleave;
    }}
    Test File
    package com;



    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;


    public class TestPolicy {


    public boolean addleavepolicy (LeavePolicyEntity leavepolicy) {
    // TODO Auto-generated method stub
    SessionFactory factory = new Configuration().configure().buildSessionFactory();
    Session session=factory.openSession();

    session.beginTransaction();
    session.save(leavepolicy);
    session.getTransaction().commit();
    return true;
    }}
    HBM file
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
    <hibernate-mapping package="com">

    <class name="LeavePolicyEntity" table="leavepolicy">
    <id name="leaveid" column="leave_id">
    </id>

    <property name="typeofleave" column="type_of_leave"/>
    <property name="initialleave" column="initial_leave"/>
    </class>
    </hibernate-mapping>

    HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body bgcolor=orange>
    <form action="Test.jsp">
    <table align="right">
    <tr>
    <td> <a href="url">SIGNOUT</a> </td>
    </tr>
    </table> <table cellspacing="15">
    <tr>
    <td> <font size="2"> TYPE OF LEAVE </font> </td>
    <td> <input type="text" name="typeofleave" size="12"> </td>
    </tr>
    <tr>
    <td> <font size="2"> DAYS ALLOCATED </font> </td>
    <td> <input type="text" name="daysallocated" size="12"> </td>
    </tr><tr>
    <td> <input type="submit" value="GO" size="12"> </td>
    <td> <input type="submit" value="ADD" size="12"> </td>
    <td> <input type="submit" value="MODIFY" size="12"> </td>
    <td> <input type="submit" value="DELETE" size="12"> </td>
    <td> <input type="reset" value="CLEAR" size="12"> </td> </tr>
    </table>
    </form>
    </body>
    </html>
    JSP
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <jsp:useBean id="testpolicy" class="com.TestPolicy"> </jsp:useBean>
    <jsp:setProperty property="*" name="testpolicy"/>
    <jsp:useBean id="leavepolicy" class="com.LeavePolicyEntity"></jsp:useBean>
    <jsp:setProperty property="*" name="leavepolicy"/>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <%
    out.println("<html>");
    out.println("<body>");
    out.println("<form>");
    leavepolicy.setTypeofleave(request.getParameter("t ypeofleave"));
    leavepolicy.setInitialleave(Integer.parseInt("days allocated"));
    boolean status=testpolicy.addleavepolicy(leavepolicy);
    if(status==true){

    out.println("<br>");
    out.println("<h1>Student detail Added successfully</h1>");
    out.println("<br>");
    out.println("<br>");
    }
    else{
    out.println("<h1>System Error,Sorry try again Later</h1>");
    }
    out.println("</form>");
    out.println("</body>");
    out.println("</html>");
    out.println("</form>");
    out.println("</body>");
    out.println("</html>");
    %>
    </body>
    </html>
    Please solve my problem. also i put mapping in cfg file and import jar file in lib.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: 500 error

    And?
    Where is the 500?
    Where/when does it occur?
    WHat do your server logs say?

    Don't make us guess...you have the details, we don't.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: 500 error

    I wouldn't hold your breath. This one seems to post for posting's sake -- not for advice, as witness the lack of code tags in spite of your response on yesterday's thread, to which he/she/it didn't bother to reply: 404 error

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

Similar Threads

  1. java out of memory error-heap space error
    By elsanthosh in forum NetBeans
    Replies: 4
    Last Post: 06-15-2010, 10:31 AM
  2. Replies: 1
    Last Post: 03-10-2010, 02:53 PM
  3. Replies: 1
    Last Post: 12-05-2009, 08:28 AM
  4. Replies: 1
    Last Post: 10-26-2009, 05:38 PM
  5. Replies: 3
    Last Post: 01-23-2009, 09:53 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
  •