Saarya Mohapatra

Greenhorn
+ Follow
since Dec 19, 2019
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Saarya Mohapatra

Hello,
this is the stored procedure in MySQL



this is the java application


but, i'm getting this exception


how do i overcome this exception ??
I’m setting my WebRowSet object to a “Select” command and emp1 table is empty.

So, at this moment my WebRowSet object is empty.

Next, i’m reading from an xml file (containing employee data which i wrote using wrs.writeXml() in another program) into this WebRowSet object. So, my WebRowSet now contains employee data which i’m able to print to console.

Since WebRowSet is updatable by default i’m expecting this data in emp1 table.

But, this ain’t happening in the first piece of code where auto commit is on by default.
When i turn off auto commit and accept changes explicitly then the data is reflecting in emp1 table.

I’m wondering why the first piece of code is not working since all rowsets are updatable by default
WebRowSet is updatable by default right ? i.e it is CONCUR_UPDATABLE.
But, the below code doesn't work.

WebRowSet is reading data from xml file and i'm able to print it to console, but, the data is not reflecting in the database.



The same code works when i turn of auto-commit and the data is reflecting in database.

I'm getting the following exception when i run the below mentioned code.
Can someone please explain why am i getting this exception even though when i i've set relaxAutoCommit=true in Url

java.sql.SQLException: Can't call commit when autocommit=true
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:67)
at com.mysql.cj.jdbc.ConnectionImpl.commit(ConnectionImpl.java:794)
at com.sun.rowset.internal.CachedRowSetWriter.commit(CachedRowSetWriter.java:1405)
at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:893)
at com.teja.programs.JdbcApp25_3.main(JdbcApp25_3.java:43)
Exception in thread "main" javax.sql.rowset.spi.SyncProviderException: Can't call commit when autocommit=true
at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:912)
at com.teja.programs.JdbcApp25_3.main(JdbcApp25_3.java:43)


Hi , i have created a simple login form using html and when i click on the login button a LoginServlet gets executed and a welcome jsp page is displayed . At this moment when i click on back button in browser i’m ending upon login page once again ?? Why ?? How do i overcome this ??
3 years ago
I'm Logging in by username="Teja" and password ="Teja123" and when i click on login, LoginServlet gets executed.
LoginServlet is dispatching the request to home.jsp. So, in home.jsp when i click on 'profile' ProfileServlet gets executed.  From profile if I wanted to go back to previous page  i'm getting a page saying "RESUBMIT THE FORM ? ".
If i'm using response.sendRedirect("home.jsp") in LoginServlet there is no "RESUBMIT THE FORM ? " page but goes back to home.jsp page

login.html


LoginServlet


home.jsp



LogoutServlet



ProfileServlet



link.html


link2.html
3 years ago
Suppose I created a servlet by extending servlet interface.
if I want an ServletConfig object I use getServletConfig() method like
ServletConfig config = getServletConfig();
How is it possible to call a method without using object reference variable ?
3 years ago
Can you please elaborate the answer. I tried researching about what actually is happening but couldn't. My head is exploding!!!
4 years ago
Suppose I added a response to the response object before forwarding to another servlet..

out.println("Forwarding the request to another servlet ");
response.addCookie(cookie);

RequestDispatcher rd = request.getRequestDispatcher("forward");
rd.forward(request,response);

So, when a response is given back to client from the second servlet I don't see the output saying "Forwarding the request to another servlet" along the responses which the second servlet generates
4 years ago
Consider the code... I got the request parameters using request.getParameter() method and created a cookie object based on the  request parameter and added the cookie object to response object.
My question is, when I forwarded the request to another servlet, isn't the response objects buffer deleted and a new response object is forwarded along with the request object ?? So, i'm guessing the cookie added to response object is also deleted. so, how all this works ??




When I click on login button the LoginServlet gets invoked.



Consider there is another servlet "ForwardServlet" to which the request is being forwarded.
4 years ago
Servlet version 1 and version 2 worked fine.
Problem started when i dispatched the request to JSP(result.jsp)

This is my JSP code


This is my BeerSelect Servlet code

4 years ago