2010-12-13 2 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, пойдите с ответом Брайана), с кодом как это:

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

Мы предпочитаем, чтобы оставить SiteMap включен в наглухо контроля доступа кажется хорошей идеей в нашем случае.

 Смежные вопросы

  • Нет связанных вопросов^_^