• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to check if a web page is synchronized on local server ?  RSS feed

 
Lakshya Sethi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to check if a web page is synchronized on a local server in JSP ?
I have tried to make database updation synchronized in jsp but how can i check it on local web server (tomcat) ?
I have used Oracle database.

I am kinda new with JSP so explain in little detail.

Thank you

More Info:

Class.forName("oracle.jdbc.driver.OracleDriver");

Connection con=DriverManager.getConnection("jdbcracle:thin:@localhost:1521:xe","username","password");

balance=balance-1500;


String query1= "update bank set bal=? where card_no='"+cnumber+"'";
PreparedStatement st1 = con.prepareStatement(query1);

st1.setString(1,String.valueOf(balance));

int qresult1 = st1.executeUpdate();

This is some of the code in which I have not applied any synchronization.
In simple words, I want to know how to test if synchronization part is really working or not ?

My main motive is... I am trying to make an admission form and I want a limited number of seats but I want after every registration process my database updates the seat numbers accordingly and show the right information about how many seats are left to the user. (though in the given code i am just changing the balance)
If is there any other way please help me ?

Like in this example
<%!
PreparedStatement pst = con.prepareStatement("query");
%>
synchronization
<%
synchronized(pst)
{
pst.setXXX(...);
pst.setXXX(...);
pst.executeXXX(...);
}
%>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you are asking. If you are preforming database code inside a JSP, you should not be. That should be in Java classes in the model layer, a JSP should, in fact, have no Java code at all in it.

Can you explain your question in more detail?
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for database updating, I'm not sure why you would want to synchronize that. Normally database integrity issues are handled by the database, often by transactions, not by Java code.

It sounds like you are trying to learn servlets and JSP and databases all at once. That's just going to lead to confusion. So if that's the case I would suggest doing that one step at a time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!