Kavitha hebbar

Greenhorn
+ Follow
since Sep 12, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kavitha hebbar

Hi,

I have a jsp page where i have given hyperlink to delete saying Delete profile.When i click that one popup window should come saying do you really want to deletea having yes and no buttons.How it is possible in jsp?
Please suggest me.
Thank you.
Thanks a lot.
Kavitha hebbar
11 years ago
Hi,

I'm attaching the file form.jsp where i get info initially and goes to servlet for validation.Then comes web.xml where i map.Now i send some uid to register.jsp.in this jsp, user is allowed to enter password and here i want this to go to same servlet and thereby the data is stored into database.Is it possible and correct?How can it be achieved?
Thank u.
Kavitha hebbar
form.jsp

After this using a servlet which overrides dopost method and there i retrieve values from form.jsp thru request.getparameter.I don't know how to pass from register.jsp to same servlet and how to retrieve values.
Please help me.
11 years ago

Chetan Dorle wrote:Hi Kavitha ,


You can use different Servlet or same servlet .
But as if you find some information about MVC it is said that Servlet should be made as controller and how it is made is by using only single servlet and giving wildcard mapping for servlet .
One of the topic may help you is https://coderanch.com/t/359118/Servlets/java/Wildcard-servlet-mappings-web-xml OR you can also search for the wildcard mapping for servlet .


- Chetan

Guys correct me if anything doesn't seems right.



Hi,

thanks for the reply.But i did not get how to retrieve the values from second jsp form in the same servlet.Also i got 405 error saying get method is not supported by the url when i gave /* in servlet mapping.
Thank u.
Kavitha Gh
11 years ago
Hi,

I have a login page where user information is collected passed to the servlet where it is connected to DAO class where it validates the email received with the database.If emails are different it will provide new userid for that user sends it to register.jsp.Now the user enters the password and all the in formation should be stored in the database.How to connect to the servlet now? Is the same servlet we have to use( if so how and what method we have to use?)If different servlet how it is?I am using MVC architecture.
Please suggest me.
KH
11 years ago
Hi,
I finally got it.In the employee.hbm.xml,I removed entity name.Then i got it.
Thank you.
I have two beans namely employee and department.This is one-to-many relationship where in one department many employees are working.department_id is the primary key.
when i run this it asks "select a java application" giving some options like SchemaUpdate,DBdialect....If i choice any one it shows so many exceptions.Wher i have gone wrong?One difference is in configuration file i have given <property name="hbm2ddl.auto">create</property>

This is Runner class which has main method


I'm right clicking on runner class and run as java application only.still it is coming like that.
Please help me.
Thanks
I have two beans namely employee and department.This is one-to-many relationship where in one department many employees are working.department_id is the primary key.


This is Runner class which has main method

package Manytoone;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

public class Runner {

static void main(String[] args) {
SessionFactory factory=FactoryOneInstance.getInstance();
Session session=factory.openSession();
Transaction trans=session.beginTransaction();
Employee employee=new Employee();
Department dept=new Department();
employee.setName("Kavitha");
dept.setName("Software");
dept.setEmployee(employee);

try
{
trans.begin();
session.save("dept",dept);
trans.commit();
}
catch(HibernateException e)
{
e.printStackTrace();
trans.rollback();
}

}

}

This is employee.hbm.xml

<?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 package="Manytoone">
<class name="Employee" table="employee" entity-name="emp">
<id name="empid" column="Id">
<generator class="increment"></generator>
</id>
<property name="name"></property>
</class>
</hibernate-mapping>
This is department.hbm.xml
<?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="Manytoone.Department" table="department" entity-name="dept">
<id name="department_id" column="deptid">
<generator class="increment"></generator>
</id>
<property name="name"></property>
<many-to-one name="employee" class="Manytoone.Employee" cascade="all" >
<column name="empid"></column>
</many-to-one>
</class>

</hibernate-mapping>
I want to create tables automatically through hibernate.for that I've written <property name="hbm2ddl.auto">create</property> in configuration.xml.When I run it will ask "select Java application" giving many options like SchemaUpdate,Dialect..etc.If I select i get many exceptions.What is mistake in my program?
Please help.
Thanks.