Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Sandy Chatterjee wrote:I have seen your previous code.
Why don't you try the below mentioned code.
Try this code:
HibernatePlugin.java
HibernateUtils.java
In struts-config.xml paste this code
while in previous code i was writting the code in single file then why we moved the code from init() function to hibernateutil.java
why we used ThreadLocal<Session> session and then ultimately again typecast it Hibernate Session
what exactly went wrong with previous code kindly tell me if it does not bother you
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
I don't find anything wrong in your code. It can be due to wrong configuration. Or due to some missing JARs.
Also, make sure that your directory structure is correct.
Can you provide me with a screenshot of the directory structure.
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Sandy Chatterjee wrote:In com.deepak.register package there is an error.
Can you show me where the exact error is.
Are you able to run a simple project.
Since when are you facing this Issue?
Before Connecting to Hibernate was it running fine?
Also in HibernatePlugIn.java there is a yellow mark. Open HibernatePlugIn.java and find the message corresponding to that yellow mark.
but still I am not able to Insert the value supplied by my Jsp file
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
See if it works. If it doesn't supply me all the details. Like struts-config.xml, hiebernate.cfg.xml.
Also use the code tag on top to mark the codes before submitting as it looks better
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
How to get ServletContext in model class that we used in Action Class
Can I write more than one action Class to handle the form and/or web application request
Is it must to use AnnotationConfiguration because I used the same AnnotationConfiguration object initially instead of Simple Configuration object but it showed the message that it has been depricrated" so please tell me what is difference between them and which one is the best practice to use the right configuration
Is there anyother way to implement the same example without HibernatePlugin
SessionFactory factory = (SessionFactory)servlet.getServletContext().getAttribute(HibernatePlugin.KEY_NAME);
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Its good that your code is running fine.
Just for testing change the package name to org.deepak.connect from sand in which the HibernatePlugin.java resides.
Change it in struts-config.xml as well and see if your program still runs or not.
Can I write more than one action Class to handle the form and/or web application request
Also I have a question for you:
How did you access the 'servlet' object from the Action class?
SessionFactory factory = (SessionFactory)servlet.getServletContext().getAttribute(HibernatePlugin.KEY_NAME);
I tried my whole day in doing the same initially there was the same error i reported earlier but I spent a lot of time in doing the research actually today i was working on different system at the end I simply used the same code as well as same package name but I am tired of same error
Suppose there is one Action Class and there suppose 3 forms then can i handle all 3 forms in same action class and can manipulate the forms data using multiple Model Classes and Forward the mapping to corresponding views
Action class inherits ActionServlet Class therefore we could use the servlet object
but when i tried the same technique in my previous model class where i pass the value of 2 variables and one ActionServlet object but I still was not able to get the ServletContext()...etc. please clear my concept
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Are you trying to start a new project or you have pasted the code in the existing project.
From the messages it seems there is a problem reading the MessagesResources. It tough to conclude just by looking the messages.
Is there anyother way to implement the same example without HibernatePlugin
Yes there is, just use the HibernateUtils.java to create the SessionFactory as well. But in that case every time you have to
create an instance of SessionFactory before using it.
The trick is declare the SessionFactory object creation in a static block.
So, when the HibernateUtils class is loaded by the JVM for the first time SessionFactory instance will
be created and its created only once.
If you have any problem in understanding just reply back I'll post the codes.
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
in our HibernateUtils.class we have a function called createSession() but when it comes to use that function in our action class we simply call the openFactory()/createFactory() function and then use that typecasted object for creating new connection/ to use openSession() menthod and that Thread safe session instance remain unused as that creatSession() is never called in action class
Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Can you shoot lasers out of your eyes? Don't look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|