あなたが置くルートに
GET /{<[a-z]+>fanPage}/? Page.showFanPage
これであなたは得ることができます:
http://localhost:9000/facebook
また、play Frameworkが提供する方法を使用することをお勧めしslugify
ます。通常は、データベースにスラッグが存在するかどうかを確認し、スラッグを検索してデータ(ファンページのタイトル/ファンページの所有者/ビュー数)を取得します。 / etcなど)
表内:
名前:ファンページ
pageID整数またはbigint
タイトル
varcharslugvarchar一意の
所有者整数
コンテンツテキスト
コード内:
public static void showFanPage(String fanPage) {
// use models to look for the slug
// grab the data
// do what you need to do
}
作成しているアプリがわからないため、ここではURLの作成方法の例を示します。
GET /post/slug/? Page.createPage
POST /post/slug/? Page.processPage
public static void createPage() {
// remember to create the template
render();
}
public static void processPage(String slugName) {
// slugName refers to the input field
// check if the slug exists and throw error if it does
// process
}
(これは単なる例であり、どのような種類のアプリケーションを構築しているのかわかりません)これがお役に立てば幸いです。これがあなたの意図したものかどうか教えてください