Spring MVC
Spring फ्रेमवर्क एम वी सी
हा एक हेल्लो वल्ड एक्षम्प्ल
Spring फ्रेमवर्क एम वी सी
हा एक हेल्लो वल्ड एक्षम्प्ल
<beans ...> <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/> <bean name="/welcome.htm" class="com.bunty.anil.controller.WelcomeController" /> <bean name="/college.htm" class="com.spring.bunty.controller.StudentController" /> <bean name="/x*.htm" class="a.b.c.controller.CommonController" /> </beans>
public class Counter{
long count = 0;
public synchronized void add(long value){
this.count += value;
}
}
public class CounterThread extends Thread{
protected Counter counter = null;
public CounterThread(Counter counter){
this.counter = counter;
}
public void run() {
for(int i=0; i<10; i++){
counter.add(i);
}
}
}
public class Example {
public static void main(String[] args){
Counter counter = new Counter();
Thread threadA = new CounterThread(counter);
Thread threadB = new CounterThread(counter);
threadA.start();
threadB.start();
}
}
public class Example {
public static void main(String[] args){
Counter counterA = new Counter();
Counter counterB = new Counter();
Thread threadA = new CounterThread(counterA);
Thread threadB = new CounterThread(counterB);
threadA.start();
threadB.start();
}
}
import java.awt.*;
import java.awt.event.*;
public class AnnotationOverrideDemo extends Frame {
public AnnotationOverrideDemo() {
this.addWindowListener(new WindowAdapter() {
public void windowclosing(WindowEvent e) {
System.exit(0);
}
});
setSize(200, 100);
setTitle("Annotation Override Demo");
setVisible(true);
}
public static void main(String[] args) { new AnnotationOverrideDemo(); }