Rogach
Rogach

Reputation: 27200

How to get page parameters in Lift snippet?

I have a simple lift page:

<html>
   <head></head>
   <body>
      <span id="content" class="lift:GetContent"></span>
   </body>
</html>

and a simple snippet:

class GetContent {
  def render = "#content" #> "someValue"
}

The question is, how can I get the parameter, which is passed in URL (like page.html?param=value)?

Upvotes: 2

Views: 870

Answers (1)

Owen
Owen

Reputation: 39366

When your snippet class is instantiated, the parameters are available in S.param:

class GetContent {
  val param = S.param("param") openOr "No parameter given"
  def render = "#content" #> param
}

Upvotes: 6

Related Questions