2010-12-13 68 views
0

According the Lift wiki, I know the "View First" concept of Lift. That's very different from any framework I used. Take the basic JSP things as the example, I could write
<a href="post/new"> Create a new post</a> in the page, and write the logic in a servlet. How can I do things like this with lift? I wrote the same tag in a template and when I accessed this page I got 404 error. But if I add a Menu to the SiteMap, things goes well. Is there any possible to make a link without making a new Menu? I am a beginner of Lift and Scala. Thanks in advance.我應該如何使用<a href> tag to access other templates in lift?

回答

1

Yes, it is possible.

Just don't call LiftRules.setSiteMap at your boot class, then Lift will let you access every pages under your webapp/ directory. You could test your code in this mode.

But this will also lead to no access control, so be careful.

0

也可以做我認爲你問的,這是爲了使鏈接可訪問,但在SiteMap中不可見(如果你根本不需要SiteMap,請使用Brian的答案),代碼像這樣:

SiteMap(Menu("PreClass")/"preClass" >> Hidden) 

我們寧願離開SiteMap啓用嚴密控制訪問似乎是一個好主意在我們的情況。