-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Items table func #15
base: master
Are you sure you want to change the base?
Items table func #15
Conversation
8080d53
to
79c0d8a
Compare
79c0d8a
to
3b12b97
Compare
private ItemDBC itemDBC; | ||
|
||
public void init() { | ||
String jdbcURL = getServletContext().getInitParameter("jdbcURL"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Init is not needed. You can craete a default constructor of the servlet and call getConnection function
Connection con = itemDBC.getConnection();
private static String jdbcPassword; | ||
private static Connection jdbcConnection; | ||
|
||
public ItemDBC(String jdbcURL, String jdbcUsername, String jdbcPassword) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ome way to do is to create a default contsructor and create a separate properties files to define the jdbc url, username or password.
Otherwise you can directly assign values
public ItemDBC(){
this.jdbcURL = " Manually define here the url"
}
|
||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
String action = request.getServletPath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a session variable on your JSP instead and just get the value from that page.
Created Controller Servlet