2014-10-09 69 views
0

林:自定義URL中使用的外觀在Java Web應用程序

  • 的NetBeans
  • Maven的Web應用程序
  • Java服務器面臨
  • Primefaces

要導航愨網頁即時通訊使用:

  <p:menu> 
       <p:submenu label="Menu"> 
        <p:menuitem value="example 1 (google)" outcome="googlePage" /> 
        <p:menuitem value="Upload File's" outcome="uploadFiles" /> 
        <p:menuitem value="example 3 (go to START)" outcome="index" /> 
       </p:submenu> 
      </p:menu> 

首屆網址看起來像:

http://localhost:8080/projectName/ 

比,當我要到其他頁面的網址是不是看起來很不錯:

http://localhost:8080/projectName/faces/googlePage.xhtml 

與同爲索引頁:

http://localhost:8080/projectName/faces/index.xhtml 

我需要做些什麼才能讓它變得更加可愛?

+0

你能展示什麼是「友善」?舉一些你「渴望」的例子,我們會嘗試幫助。 – Cold 2014-10-09 13:46:54

+0

有點像這樣:localhost:8080/index || localhost:8080/index/somePage ||我的意思是沒有這個「面孔」和項目名稱。以及爲什麼當我開始我的項目時,網址很短,而且比我想回到開始時更長。 – DarkMisha 2014-10-09 14:12:20

+0

查看此連結:http://stackoverflow.com/questions/3008395/jsf-facelets-sometimes-i-see-the-url-is-jsf-and-sometimes-xhtml-why – Cold 2014-10-09 14:56:12

回答

0

我相信你可以使用Prettyfaces。

PrettyFaces是一個OpenSource URL重寫庫,它增強了對JavaServer Faces - JSF 1.1,1.2和2.0的支持 - 可以創建可以書籤的漂亮URL。 PrettyFaces優雅地解決了「RESTful URL」問題,包括頁面加載操作,與面部導航的無縫集成,動態視圖分配,受管參數分析以及與其他Web框架的無配置兼容等功能。

查看更多示例herehere