• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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("jdbc:oracle: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(...);
}
%>
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 28304
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I was born with webbed fish toes. This tiny ad is my only friend:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic