Newbie on Lift & Scala: Build in class source code?

32 ዕይታዎች
ወደ የመጀመሪያው ያልተነበበ መልዕክት ዝለል

itsjar

ያልተነበበ፣
6 ዲሴም 2009 6:54:32 ከሰዓት06/12/2009
ለ Lift
Hi,

I'm considering building a web application with my software
engineering group in Lift.
However when I started with lift I was surprised that I received a
whole log in / sign up website by
just using the MegaProtoUser.
This was at first sight fun, but I started wondering (and I'm pretty
sure my professor will say the same): "Do I really know what I just
did?".

So I decided to try and rebuild the Log in / Sign up thing from
scratch by using my own plain objects.
Ive been working on that for 2 days and It's been soooo frustrating.

I've been reading the lift book... Tutorials.. but all of them start
with the MegaProtoUser.
In 1.5 days time I only managed to make an index (signup) page with a
username/password field and a button which then redirects to a new
page.

Let me tell you in advance, I am totally new to Web developing.

Problems I have right now:
- I have no idea if my code actually created a User in my database
and I have no idea how to check it...
- I have no idea how to "log in" a user. I saw code in the sample
programs that compare the current logged in user with other users by
using a select statement. However retrieving the current user is based
upon the MegaProtoUser. I wonder how this is done behind my back since
I have no idea how to keep a variable of a 'logged in user' which
stays active across all pages..

Because of these problems I thought it might be useful to see the
source code of the classes..
Is it possible to see the scala source code of these classes?

Thanks,
itsjar


Alex Boisvert

ያልተነበበ፣
6 ዲሴም 2009 10:23:21 ከሰዓት06/12/2009
ለ lif...@googlegroups.com
Part of the source for these objects is automatically created when you generate your lift app using the Maven archetype.   For example, you'll find the source to the User class unde src/main/scala/com/liftworkshop/model/User.scala.

For classes that are part of the framework, such as MegaProtoUser etc. you'll find the source on Github at http://github.com/dpp/liftweb/ and more specifically look at ProtoUser.scala under http://github.com/dpp/liftweb/tree/master/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/. Also be sure to select the branch of Lift that you are using in order to avoid confusion.

Good luck and keep asking question ;)
alex






--

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



itsjar

ያልተነበበ፣
7 ዲሴም 2009 12:14:10 ከሰዓት07/12/2009
ለ Lift
thanks again to the guys who put their efforts in answering questions
here.
I'll try a different approach this time.

Let's hope I get somewhere since our decision whether we will use lift
or not will depends on this.

On Dec 7, 4:23 am, Alex Boisvert <alex.boisv...@gmail.com> wrote:
> Part of the source for these objects is automatically created when you
> generate your lift app using the Maven archetype.   For example, you'll find
> the source to the User class unde
> src/main/scala/com/liftworkshop/model/User.scala.
>
> For classes that are part of the framework, such as MegaProtoUser etc.
> you'll find the source on Github athttp://github.com/dpp/liftweb/and more
> specifically look at ProtoUser.scala underhttp://github.com/dpp/liftweb/tree/master/lift-persistence/lift-mappe....
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com>
> > .

David Pollak

ያልተነበበ፣
7 ዲሴም 2009 12:21:11 ከሰዓት07/12/2009
ለ lif...@googlegroups.com
On Mon, Dec 7, 2009 at 9:14 AM, itsjar <its...@gmail.com> wrote:
thanks again to the guys who put their efforts in answering questions
here.
I'll try a different approach this time.

I would suggest building the "To Do" app as a first step: http://liftweb.net/docs/getting_started/mod_master.html

You'll get a lot of exposure to Lift in bite-sized chunks.  Once you've gone through the demo, then you can move on to other things, including building your own authentication system.

Why do I suggest this?  (1) Learning Scala's syntax and some of Scala's idioms gives you better grounding for understanding ProtoUser (2) seeing how to build simple Mapper classes will give you a better understanding of the more complex ones (3) walking before you run helps you to not fall down and skin your knees.

But we are here... the whole 1,500+ member Lift community.  We take newbies very seriously and want to help them because we know that they'll help other newbies one day.

Thanks,

David
 
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.





--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

Jonathan Hoffman

ያልተነበበ፣
7 ዲሴም 2009 11:55:31 ከሰዓት07/12/2009
ለ lif...@googlegroups.com
Hi,

I've you're running against an h2 database, you can add the following to the end of your Boot.boot to launch the h2 web console when every you start up jetty.  It's a very simple web interface to the database, but super convenient (it will even launch your browser for you):

    if (Props.devMode) {
      import org.h2.server.web.WebServer
      import _root_.org.h2.tools.Server
      import _root_.org.h2.util.StartBrowser
      val webServer = new WebServer()
      val server  = new Server(webServer, "-webPort", "0")
      server.start
      DBVendor.newConnection(DefaultConnectionIdentifier).map(c=> {
        val url = webServer.addSession(c)
        Log.info("H2 WebConsole at:\n" + url)
        StartBrowser.openURL(url)
      })
    }

To start using h2, if you're not already:

add this to the <dependencies> section of your pom.xml:

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.2.121</version>
        </dependency>


And change this in Boot.scala:

from:   DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)
to:
DB.defineConnectionManager(DefaultConnectionIdentifier,
       new StandardDBVendor(Props.get("db.driver") openOr "org.h2.Driver",
 Props.get("db.url") openOr "jdbc:h2:lift_proto.db",
Props.get("db.user"), Props.get("db.password")))
ለሁሉም ምላሽ ስጥ
ለፀሃፊው መልስ ስጥ
አስተላልፍ
0 አዲስ መልዕክቶች