class A {
public void superMethod() {}
}
class B extends A {
@Override
public void superMethod() {}
}
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<resources mapping="/images/**" location="/resources/images/" />
<resources mapping="/css/**" location="/resources/css/" />
<resources mapping="/js/**" location="/resources/js/" />
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
enctype="multipart/form-data"
используйте библиотеку Commons FileUpload. Там документация нормaction="${pageContext.request.contextPath}/do/add-product"
лучше использовать jstl core, тег <c:url/>
. Например: <c:url value="/do/add-product"/>
Dog tuzic = new Dog();
{
tuzic.age = 1;
}
class Dog extends Pet {
Dog tuzic = new Dog();
}
.....
Dog tuzic = new Dog(); // и понеслась:)
import java.io.*;
public class CharCleaner {
public static void main(String[] args) throws IOException {
try (
Reader reader = new BufferedReader(new FileReader(new File("sourceFile.txt")));
Writer writer = new BufferedWriter(new FileWriter(new File("resultFile.txt")))
) {
int ch;
while ((ch = reader.read()) != -1) {
if (Character.isAlphabetic(ch)) {
writer.write(ch);
}
}
writer.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
interface Worker {
void doWork(int[] data);
}
class Worker96 implements Worker {
public void doWork(int[] data) {
....
}
}
class Worker71 implements Worker {
public void doWork(int[] data) {
....
}
}
// потом можно создать мапу
class Main {
private Map<Integer, Worker> workers = ....;
Main (){
workers.put(96, new Worker96());
workers.put(71, new Worker71());
}
public void dataProcessing(int[] data) {
Worker w = workers.get(data.length);
if (w == null)
throw new RuntimeException("Unsupported data length!");
w.doWork(data);
}
}
// как то так...