lift

Scala-Lift project in Eclipse Scala IDE errors

强颜欢笑 提交于 2019-12-05 21:20:32
I installed Scala IDE for Eclipse , and it seems to be working okay. So now I'm trying to import a Lift project (specifically -- autogenerated Lift project from Stax application platform ), and now I'm having four errors at my workspace: value net is not a member of package <root> Boot.scala /rss2lj/src/scala/bootstrap/liftweb line [3..6] Scala Problem At lines: import _root_.net.liftweb.util._ import _root_.net.liftweb.http._ import _root_.net.liftweb.sitemap._ import _root_.net.liftweb.sitemap.Loc._ Could anyone please help me out with it? UPD : I found a discussion with solution for maven

How to add a new page in Lift framework

心已入冬 提交于 2019-12-05 20:14:18
How can I add a new page in the webapp directory in lift that can be accessed by users? Currently only the index.html can be accessed through http://localhost:8080/ or http://localhost:8080/index.html Say I add a static file newpage.html into webapp dir, then what can I do so users can access it through http://localhost:8080/newpage.html ? It's been a long time since I've done anything with Lift, but from what I remember, the easiest way may be to add the page in the menu entries in the bootstrap.liftweb.Boot.scala class. If you've setup your project using one of Lift's maven archetypes, this

how to deserialize DateTime in Lift

▼魔方 西西 提交于 2019-12-05 15:01:41
I am having trouble deserializing a org.joda.time.DateTime field from JSON into a case class. The JSON: val ajson=parse(""" { "creationDate": "2013-01-02T10:48:41.000-05:00" }""") I also set these serialization options: implicit val formats = Serialization.formats(NoTypeHints) ++ net.liftweb.json.ext.JodaTimeSerializers.all And the deserialization: val val1=ajson.extract[Post] where Post is: case class Post( creationDate : DateTime){ ... } The exception I get is: net.liftweb.json.MappingException: No usable value for creationDate Invalid date format 2013-01-02T10:48:41.000-05:00 How can I

converting xml to Json with lift behaves strange

喜欢而已 提交于 2019-12-05 12:31:16
I'm using scala / lift for a Rest API. Under the hood I'm generating xml which will be converted to json via Xml.toJson() as output. Now i noticed some strange behavior which drives me nuts. for example i have the following xml: <data> <item> <foo>1</foo> <bar>1</bar> </item> <item> <foo>2</foo> <bar>2</bar> </item> </data> the result of xml.toJson() looks like: JObject( List( JField( data,JObject( List( JField(item, JArray( List( JObject( List( JField(foo,JString(1)), JField(bar,JString(1))) ), JObject( List( JField(foo,JString(2)), JField(bar,JString(2)) ) ) ) ) ) ) ) ) ) ) but if i add a

How to connect lift and MySQL?

折月煮酒 提交于 2019-12-05 07:56:59
问题 I want to create a simple lift web application which read input throug form and insert it into database. 回答1: You need to add mysql jdbc driver to your project (as a maven artifact, or via sbt, or just put jar in CLASSPATH) and edit properties file (props/default.props): db.driver=com.mysql.jdbc.Driver db.url=jdbc:mysql://localhost/your_db_name db.user=user db.password=password Also, you can setup db context in app container (Tomcat, etc.) instead. After that you can use Lift's ORM (Mapper).

Output a list to a template in lift

喜你入骨 提交于 2019-12-05 03:36:12
问题 How can I output a list of things in a template in Lift? Let say for example that I have List[User] and I want to output it as a table. In Django, I would use a context variable "users" and iterate through it in the template like so: //controller user = User.objects.all() context = {'users' : users} return render_to_template('results.html', context} //view <table> {% for user in users %} <tr><td>{{user.name}}</td> <td>{{user.email}}</td> </tr> {% endfor %} </table> I appreciate any help. PS:

Can snippets take parameters in lift?

谁说胖子不能爱 提交于 2019-12-05 01:38:28
Is there a way in lift to pass parameters to snippets? I am trying to write a pluraize filter for my page that will display the word "user" or "users" depending on how many there are: 1 user 2 users The way it works in Django is called filters and they are written as follows: You have {{ num_messages }} message{{ num_messages|pluralize }}. So here you can see pluralize function takes an integer num_messages and outputs and appropriate string - either empty "" or "s". EDIT: Note that the num_messages in this case is an actual context variable, passed down to the template from the view. You can

How to use logback on Cloudbees

旧巷老猫 提交于 2019-12-04 20:18:27
I would like to know if it's possible to use my own logback configuration on Cloubees, I have a default.logback.xml file that works perfectly fine in local, but once I deploy to Cloudbees its being ignored. Logging in CloudBees is via stdout and stderror - these are piped via syslog-ng to various systems (not all of which are file based) - so you can configure logging things as you want - but if you want your logs managed - it is best to ensure that things end up in stdout and stderr. 来源: https://stackoverflow.com/questions/12724599/how-to-use-logback-on-cloudbees

OAuth 2.0 provider implementation for Scala/Lift

蹲街弑〆低调 提交于 2019-12-04 17:11:34
问题 Does anyone know of a OAuth 2.0 provider (server side) implementation for Scala/Lift? I see Scala 2.0 client, but no provider. 回答1: It doesn't look like there is one readily available. So I think you have two options: Implement one yourself. Use a Java library in Scala. However this is probably not the optimal root due to the obvious impedance mismatch. But, I don't see much other choice. The project has both an OAuth client/server library and an example on how to use it. 回答2: Check this

How to highlight parent of the current page?

自闭症网瘾萝莉.ら 提交于 2019-12-04 15:07:50
How can I hightlight the parent menu item of the current page? I have a site map as follows: val siteMap = SiteMap( Menu("Home") / "index", Menu("Search") / "search" submenus ( Menu("Search Results") / "search-results") >> Hidden) and I use it as follows: <lift:Menu.builder ul:class="tabs" li_item:class="selected" /> However, when I navigate to the /search-results - the search menu item is no longer selected (i.e. the css class selected is no longer applied to it). Any tips? it's quite simple. You should use Lift built-in snippet Menu parameter li_path something from documentation: li_path -