xiaowl
xiaowl

Reputation: 5207

How should I use <a href> tag to access other templates in lift?

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.

Upvotes: 0

Views: 275

Answers (3)

Chris Hagan
Chris Hagan

Reputation: 2437

It is also possible to do what I think you asked, which is to make the link accessible, but not visible in the SiteMap (if you don't want the SiteMap at all, go with Brian's answer), with code like this:

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

We prefer to leave the SiteMap enabled as tightly controlling access seems like a good idea in our case.

Upvotes: 0

Alex Cruise
Alex Cruise

Reputation: 7979

When everything is declared in your SiteMap, you can have Lift generate the links for you.

Upvotes: 2

Brian Hsu
Brian Hsu

Reputation: 8821

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.

Upvotes: 1

Related Questions