If I have a URL like http://localhost/Test/edit/{id} and I would like
the {id} transform to a parameter instead of URL path part.

The problem is that if I have a template named edit.html under webapp/
Test, which is the template I use to edit an item.

And I have a Menu instance like the following:

<code>
Menu (Loc("Test", List("Test") -> true, "Test"))
</code>

It would only match URL like http://localhost/Test/edit, not anything
like http://localhost/Test/edit/1

Is it best way to do it by create a menu with RewriteRequest? Because
I found it a little boilerplate if I have lot URL pattern like this.

<code>
val menu = Menu(new Loc[Unit] {

    override def name = "Test"
    override def text = "Test"
    override def link = (List ("Test"), true)
    override def params = Nil
    override def defaultValue = Full(())


    def isTarget (path: ParsePath) = path match {
        case ParsePath (List("Test", "edit", id), _, _, _) => true

        case _ => false
    }

    override def rewrite = Full ( NamedPF("Test") {
        case RewriteRequest (path, _, _) if isTarget(path) =>
             RewriteResponse(List("Test", "edit"),
                             Map("id" -> "1024")) -> ()

    })
})
</code>
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to