///servlet
String get = request.getParameter("animal");
String message = "";
if(get.equals("cat")) {
message = "kata";
}
if(get.equals("dog")) {
message = "dzagli";
}
PrintWriter writer = response.getWriter();
writer.append("<head>");
writer.append("<style>");
writer.append("table, td{border:1px solid black;}");
writer.append("</style>");
writer.append("</head>");
writer.append("<body>");
writer.append("<table>");
writer.append("<tr>");
writer.append("<td>");
writer.append(message);
writer.append("</td>");
writer.append("<td>");
writer.append(message);
writer.append("</td>");
writer.append("</tr>");
writer.append("<tr>");
writer.append("<td>");
writer.append(message);
writer.append("</td>");
writer.append("<td>");
writer.append(message);
writer.append("</td>");
writer.append("</tr>");
writer.append("</table>");
writer.append("</body>");
response.getWriter();
//soap
//product.java
public interface Product {
public String getProductName(String name);
}
//productImplement
public class ProductImplementation implements Product{
@Override
public String getProductName(String name) {
// TODO Auto-generated method stub
return name;
}
//rest
import javax.*;
@path("user")
public class res {
@Get
@Path
public Response getUser(){
String result = "<h1>OK<h1>" ;
return Response.status(200).entity(result).build();
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.