Skip to content

Instantly share code, notes, and snippets.

@FreeFly19
Created April 13, 2016 18:21
Show Gist options
  • Select an option

  • Save FreeFly19/cbd472d127673f6e4f7ad557291a0fad to your computer and use it in GitHub Desktop.

Select an option

Save FreeFly19/cbd472d127673f6e4f7ad557291a0fad to your computer and use it in GitHub Desktop.
Vlad class work #12
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
@EnableAutoConfiguration
@Controller
public class Application {
String s="";
@RequestMapping("")
@ResponseBody
public String first(HttpServletRequest request) {
if("true".equals(request.getParameter("clean"))) {
s = "";
}
String message = request.getParameter("message");
if(message !=null) {
s += message + "<br>";
}
return s + "Please enter some value" +
"<form method=post action=/>" +
"<input name=message>" +
"<input type=submit value=Send>" +
"</form>" +
"<br>" +
"<a href='?clean=true'>Clean</a>";
}
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment