Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

sonalsk
Copy link
Collaborator

@sonalsk sonalsk commented Feb 1, 2020

Created Controller Servlet

private ItemDBC itemDBC;

public void init() {
String jdbcURL = getServletContext().getInitParameter("jdbcURL");
Copy link
Collaborator

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) {
Copy link
Collaborator

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();
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants