Google Groups

Re: [Lift] Re: Param Example not working


Juan Jose Olivera May 24, 2012 9:35 AM
Posted in group: Lift
Hi Sanx, if I am not wrong you need to add Param.menu to the sitemap.



2012/5/24 Sanx <hecto...@gmail.com>
no

thanks for the reply

but it still does not work in any of the 2 ways

But as I understand the idea is to work with the url:

http://localhost:8080/param/xxx

The example is as follows:

Above, we saw how to create a Loc[ParamInfo] to capture URL
parameters. Let’s look at the /param/xxx page and see how we can
access the parameters:

param.html

<!DOCTYPE html>
<html>
 <head>
   <meta content="text/html; charset=UTF-8" http-equiv="content-
type" />
   <title>Param</title>
 </head>
 <body class="lift:content_id=main">
   <div id="main" class="lift:surround?with=default;at=content">
     <div>
       Thanks for visiting this page.  The parameter is
       <span class="lift:ShowParam">???</span>.
     </div>

     <div>
       Another way to get the param: <span class="lift:Param">???</
span>.
     </div>

   </div>
 </body>
</html>

Param.scala

package code
package snippet

import lib._

import net.liftweb._
import util.Helpers._
import common._
import http._
import sitemap._
import java.util.Date

// capture the page parameter information
case class ParamInfo(theParam: String)

// a snippet that takes the page parameter information
class ShowParam(pi: ParamInfo)  {
 def render = "*" #> pi.theParam
}

object Param {
 // Create a menu for /param/somedata
 val menu = Menu.param[ParamInfo]("Param", "Param",
                                  s => Full(ParamInfo(s)),
                                  pi => pi.theParam) / "param"
 lazy val loc = menu.toLoc

 def render = "*" #> loc.currentValue.map(_.theParam)
}

so I do not understand where my mistake



On 24 mayo, 11:00, AGYNAMIX Torsten Uhlmann <T.Uhlm...@agynamix.de>
wrote:
> Hi Sanx,
>
> I think your problem is the way you enter the parameter:
>
> http://localhost:8080/param/xxxis not a parameter, it's a URL. You can get these values also, but if you want a param, enter it like this:
>
> http://localhost:8080?param=xxx
>
> Does that help?
> Torsten.
>
> --
> AGYNAMIX(R). Passionate Software.
> Inh. Torsten Uhlmann | Buchenweg 5 | 09380 Thalheim
> Phone:       +49 3721 273445
> Fax:             +49 3721 273446
> Mobile:       +49 151 12412427
> Web:          http://www.agynamix.de
>
> Am 24.05.2012 um 17:47 schrieb Sanx:
>
>
>
>
>
>
>
> > Ok, I apologize if I did not know how to explain
> > English is not my native language
>
> > I'll try one more time
>
> > In the url:
>
> >http://localhost:8080/param/xxx
> > should show the following:
>
> > Thanks for visiting this page. The parameter is xxx
>
> > Another way to get the param: xxx
>
> > But instead of showing it, says:
> > The Requested URL / param / xxx Not Was found on this server
>
> > On 24 mayo, 10:23, Lukasz Kuczera <kuk...@gmail.com> wrote:
> >> I didn't spot problem, but can you describe what you want to achieve ?
>
> >> On Thursday, May 24, 2012 1:49:24 AM UTC+2, Sanx wrote:
>
> >>> Greetings to all
>
> >>> I'm doing some tests with the following examples:
>
> >>>http://simply.liftweb.net/index-3.4.html#sub: Param-Example
>
> >>> but I can not make it work
>
> >>> Someone can help me and tell me I'm doing wrong
>
> >>> when I put the url:
>
> >>>http://localhost:8080/param/xxx
>
> >>> I says:
>
> >>> The Requested URL / param / xxx not was found on this server
>
> >>> Thanks for your attention
>
> >>> my project is as follows:
>
> >>>https://github.com/sanxelsanto/parameters
>
> > --
> > Lift, the simply functional web framework:http://liftweb.net
> > Code:http://github.com/lift
> > Discussion:http://groups.google.com/group/liftweb
> > Stuck? Help us help you:https://www.assembla.com/wiki/show/liftweb/Posting_example_code

--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code



--
Juan Jose Olivera Rodriguez
Director General
Genso Iniciativas Web
+591.44505438