ばかな質問が、イム株式です。
使用するのは簡単です良いドキュメントと例がありますが、あなたのケースを説明するために、あなたはこのような何か行うことができます:
- ダウンロードprettyfaces.jarをし、あなたのクラスパスに追加します。通常
/WEB-INF/lib
フォルダー。
- URLマッピングを含むpretty-config.xmlファイルを
/WEB-INF
フォルダに追加します。
かなり-config.xmlのファイルの例:あなたはpretty:
+ url-mapping-id
のような文字列を使用する必要があり、コントローラからこのマッピングにリダイレクトする
<?xml version="1.0" encoding="UTF-8"?>
<pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.3 http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd">
<url-mapping id="home">
<pattern value="/home" />
<view-id value="/home.xhtml" />
</url-mapping>
</pretty-config>
。コントローラ豆の
例:
@ManagedBean
@ViewScoped
public class HomeBean
{
public String goHome()
{
return "pretty:home";
}
}
それです。リクエストを発行するたびに、PrettyFacesフィルタでURLマッピングパターン/home
が見つかると、ビューIDはhome.xhtml
と表示されますが、URLは/home
となります。かなり。
また、ご提案として、welcome-file-list
にはindex.html
を追加することもできます。
のweb.xml歓迎-ファイル・リストタグの例:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
そして、あなたのアプリケーションのルートフォルダに、このようなindex.htmlファイルを追加します。 index.htmlファイルの
例:誰かがあなたのアプリケーションを要求するたびにこれを行うことにより、
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Application</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="0;url=/myapplication/home" />
</head>
<body>
<h3>Loading...</h3>
</body>
</html>
、それは高速読み込みページを取得し、/home
にリダイレクトされます。
私はそれが役に立ちそうです。