2

我正在尝试使用此方法在控制器类中进行路由

public static Result show(String page) {
String content = **Page**.getContentOf(page);
response().setContentType("text/html");
return ok(content);
}

但我得到一个导入错误,页面无法解析我尝试了每个导入并得到了错误

我需要导入哪个api??

我使用这个链接作为参考

Java路由

4

1 回答 1

4

I just accidentaly discovered, that you just copied a part of the documentation, right ? :)

This is a sample, hypothetical case usage of some method getContntentOf(String page) from some class Page but it doesn't exist by default in Play. You can simplify that sample (for learning purposes) to:

public static Result show(String page) {
    return ok(page);
}

or, better just put your real logic there.

于 2013-05-18T22:07:31.630 回答