Hello Friends, I am new to struts & jsp.I am developing a project in struts.I have 1 jsp page called editProfile.jsp.On submitting this page it will call 1 action class.The action class in turn will call the Plain old java class where I have written the logic for updating User Profile.
I have created context-param in web.xml for database connection information like dbURL , dbUserName , dbPassword , jdbcDriver.Now I want to use these connection information in my Business logic(Plain Old Java Class).As we can use context parameter only in jsp & servlets , I am setting the variables of my business logic class with these context param in jsp itself.
now when I am calling the updateProfile method of Business logic class from Action class it is giving error as all the connection variables which I set in jsp for my business logic class has become null again.
I am not getting.If once I have set those variables how come they are becoming null again???Please help me.Any Help will be highly appreciated.Thank you in advance. [ May 11, 2008: Message edited by: Neha k Agrawal ]
So you are saying that you are obtaining the values of the context parameters in your action, and upon passing them to the POJO they become null? Sounds like a problem in your logic. Have you debugged every step of the way to determine at what point the values are nullified?
This is the code I have written I have debugged it.I think the problem is that another instance of EditProfile.java class (My business logic class) is getting created when I am calling it from action class.But I am not getting how to avoid it.Please take a look at the code.
EditProfile.java class (My Business Logic Class)
[ May 11, 2008: Message edited by: Neha k Agrawal ]
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.
You can go back and change your post to add code tags by clicking the .
Neha k Agrawal
Joined: Mar 25, 2008
I am sorry my post was not easy to read.I was not aware of UBB code.I will make sure that I am making use of UBB code in every post.I have changed my post.Can you please help me now??
What is the server that you were using to deploy this application? Is it Tomcat?? If so I you can also configure the database info in server.xml file's context path tag. For more info, check the following site