Newbie questions of Lift

10 views
Skip to first unread message

smartini

unread,
Mar 23, 2010, 1:15:45 PM3/23/10
to Lift
Hi to all,
I'm a Lift newbie, so excuse me for these (probably) stupid questions
on Lift ...

I'm creating a new basic application, with Maven, using a command like
that described here:
http://wiki.github.com/dpp/liftweb/how-to-create-a-new-lift-app
But I'm using the latest version of the artifact, the 2.0M3

1) Everything is good, but when I try to do a mvn package, i got an
error in tests (after a timeout of approx 30 seconds). Adding some
info in the test source, I've seen that the error in in the generated
web.xml, the default seems to have some parts not-so-good inside in
the filter definition (removing the display-name and description tags
then all works good).

And a side question on it:
running all on Jetty 6 and/or Tomcat 6, wouldn't it be better to
generate a Servlet 2.5 compliant webapp ? I've tried updating the
references into web.xml and all works good.

2) Running the generated war in a standalone Tomcat-6.0.26 and trying
to reload the webapp some times, I tried to see if there are some
memory leaks (using the new feature of this new release of tomcat),
and it says that there are some ThreadLocal variables that can cause
memory leaks ... anyone knows this ?

3) To avoid warnings inside pages (for example from inside Eclipse),
wouldn't it be better to include in all default pages also the
references to all lift: namespaces ?
And last, adding such references to pages containing only a
lift:surround tag, the output gives me an error ... but in this case
how can I do to to have such pages as html well-formed ?
For example, in JSF pages I can have a full html page and all the
content inside <ui:composition> ... </ui:composition> is taken for
inclusion.


If you need more info, tell me.

Thanks very much,
Sandro

David Pollak

unread,
Mar 23, 2010, 1:29:36 PM3/23/10
to lif...@googlegroups.com
On Tue, Mar 23, 2010 at 10:15 AM, smartini <sandro....@gmail.com> wrote:
Hi to all,
I'm a Lift newbie, so excuse me for these (probably) stupid questions
on Lift ...

I'm creating a new basic application, with Maven, using a command like
that described here:
http://wiki.github.com/dpp/liftweb/how-to-create-a-new-lift-app
But I'm using the latest version of the artifact, the 2.0M3

1) Everything is good, but when I try to do a mvn package, i got an
error in tests (after a timeout of approx 30 seconds). Adding some
info in the test source, I've seen that the error in in the generated
web.xml, the default seems to have some parts not-so-good inside in
the filter definition (removing the display-name and description tags
then all works good).

Ummm.... I just entered:

dpp@yak:~$ mvn archetype:generate -U             -DarchetypeGroupId=net.liftweb             -DarchetypeArtifactId=lift-archetype-basic             -DarchetypeVersion=2.0-M3             -DremoteRepositories=http://scala-tools.org/repo-releases             -DgroupId=com.liftcode.hello -DartifactId=hello-lift

Then:
dpp@yak:~$ cd hello-lift/
dpp@yak:~/hello-lift$ mvn test

And got:

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16 seconds
[INFO] Finished at: Tue Mar 23 10:23:31 PDT 2010
[INFO] Final Memory: 38M/510M
[INFO] ------------------------------------------------------------------------

What did you type and what were the results?
 

And a side question on it:
running all on Jetty 6 and/or Tomcat 6, wouldn't it be better to
generate a Servlet 2.5 compliant webapp ? I've tried updating the
references into web.xml and all works good.

The archetype has always worked fine for me in Jetty and Tomcat.  Why do you say that it's not a 2.5 compliant webapp?  What's not compliant?
 

2) Running the generated war in a standalone Tomcat-6.0.26 and trying
to reload the webapp some times, I tried to see if there are some
memory leaks (using the new feature of this new release of tomcat),
and it says that there are some ThreadLocal variables that can cause
memory leaks ... anyone knows this ?

Yes.  Lift makes heavy use of ThreadLocal variables and always cleans them up.  If you have a specific memory leak, then please let us know how to reproduce it.
 

3) To avoid warnings inside pages (for example from inside Eclipse),
wouldn't it be better to include in all default pages also the
references to all lift: namespaces ?

What do you want changed?  Please be specific with an example.
 
And last, adding such references to pages containing only a
lift:surround tag, the output gives me an error ... but in this case
how can I do to to have such pages as html well-formed ?

I can't parse this?  What do you mean?
 
For example, in JSF pages I can have a full html page and all the
content inside <ui:composition> ... </ui:composition> is taken for
inclusion.


If you need more info, tell me.

Thanks very much,
Sandro

--
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.




--
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

Timothy Perrett

unread,
Mar 23, 2010, 1:40:31 PM3/23/10
to lif...@googlegroups.com
I think he means it gives him an error in eclipse rather than an error in lift. Its a tooling issue.

Cheers, Tim

Naftoli Gugenheim

unread,
Mar 23, 2010, 2:06:40 PM3/23/10
to lif...@googlegroups.com
I think he means that there should be an xmlns declaration for the lift prefix so eclipse doesn't warn about the xml validity.
A solution for the OP I think is to remove or disable the validation builder from the project.

-------------------------------------
David Pollak<feeder.of...@gmail.com> wrote:

Ummm.... I just entered:

And got:

> And last, adding such references to pages containing only a
> lift:surround tag, the output gives me an error ... but in this case
> how can I do to to have such pages as html well-formed ?
>

I can't parse this? What do you mean?

> For example, in JSF pages I can have a full html page and all the
> content inside <ui:composition> ... </ui:composition> is taken for
> inclusion.
>
>
> If you need more info, tell me.
>
> Thanks very much,
> Sandro
>
> --
> 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<liftweb%2Bunsu...@googlegroups.com>

smartini

unread,
Mar 24, 2010, 11:12:42 AM3/24/10
to Lift
Hi,
thanks for the reply, I'll try to write more info here:

maven_tests>mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_18
Java home: C:\jdk1.6.0\jre
Default locale: it_IT, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
maven_tests>

mvn archetype:generate -U -DremoteRepositories=http://scala-tools.org/
repo-releases -DarchetypeGroupId=net.liftweb -
DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=2.0-M3 -
DgroupId=martins.lift_test -DartifactId=lift-test -Dversion=1.0.0

cd lift-test
Then, running mvn test
I get (initial stuff removed):

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running martins.lift_test.snippet.HelloWorldTestSpecsAsTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.188
sec
Running martins.lift_test.AppTest
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 21.547
sec <<< FAILURE!

Results :

Tests in error:
testXml(martins.lift_test.AppTest)

Tests run: 3, Failures: 0, Errors: 1, Skipped: 0

[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] There are test failures.

Please refer to D:\users\sandro\work\maven_tests\lift-test\target
\surefire-reports for the individual test results.
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 50 seconds
[INFO] Finished at: Wed Mar 24 12:21:38 CET 2010
[INFO] Final Memory: 19M/45M
[INFO]
------------------------------------------------------------------------

and inside the detail file I have:

-------------------------------------------------------------------------------
Test set: martins.lift_test.AppTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 21.547
sec <<< FAILURE!
testXml(martins.lift_test.AppTest) Time elapsed: 21.547 sec <<<
ERROR!
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:
195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:
860)
at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:
801)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:
726)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
1049)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:
677)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:
1315)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:
1282)
at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:
283)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1194)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
$DTDDriver.next(XMLDocumentScannerImpl.java:1090)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
$PrologDriver.next(XMLDocumentScannerImpl.java:1003)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:
648)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
511)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
808)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:
119)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:
1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at scala.xml.parsing.FactoryAdapter.loadXML(FactoryAdapter.scala:292)
at
scala.xml.parsing.NoBindingFactoryAdapter.loadXML(NoBindingFactoryAdapter.scala:
60)
at scala.xml.XML$.loadFile(XML.scala:42)
at martins.lift_test.AppTest.wellFormed$1(AppTest.scala:53)
at martins.lift_test.AppTest$$anonfun$wellFormed
$1$1.apply(AppTest.scala:49)
at martins.lift_test.AppTest$$anonfun$wellFormed
$1$1.apply(AppTest.scala:49)
at scala.Iterator$class.foreach(Iterator.scala:414)
at scala.runtime.BoxedArray$AnyIterator.foreach(BoxedArray.scala:45)
at scala.Iterable$class.foreach(Iterable.scala:256)
at scala.runtime.BoxedArray.foreach(BoxedArray.scala:24)
at martins.lift_test.AppTest.wellFormed$1(AppTest.scala:49)
at martins.lift_test.AppTest$$anonfun$wellFormed
$1$1.apply(AppTest.scala:49)
at martins.lift_test.AppTest$$anonfun$wellFormed
$1$1.apply(AppTest.scala:49)
at scala.Iterator$class.foreach(Iterator.scala:414)
at scala.runtime.BoxedArray$AnyIterator.foreach(BoxedArray.scala:45)
at scala.Iterable$class.foreach(Iterable.scala:256)
at scala.runtime.BoxedArray.foreach(BoxedArray.scala:24)
at martins.lift_test.AppTest.wellFormed$1(AppTest.scala:49)
at martins.lift_test.AppTest.testXml(AppTest.scala:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:
79)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:
62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:
140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:
127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:
345)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:
1009)


so, in AppTest.scala I've added the following statements (in two
points in the source) to better understand where is the problem:

println("Check Valid XML on \"" + file.getName() + "\"")

what do you think on adding these lines, could be useful ?

and re-running mvn test now I see that the error is in the last file,
web.xml ... but the file in valid xml, so it's Ok.

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running martins.lift_test.snippet.HelloWorldTestSpecsAsTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.453
sec
Running martins.lift_test.AppTest
Check Valid XML on "index.html"
Check Valid XML on "index.html"
Check Valid XML on "default.html"
Check Valid XML on "wizard-all.html"
Check Valid XML on "web.xml"
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 21.047
sec <<< FAILURE!

Results :

Tests in error:
testXml(martins.lift_test.AppTest)

Tests run: 3, Failures: 0, Errors: 1, Skipped: 0


So, looking at the web.xml I see that it's a Servlet 2.3 compliant
(for this my question if it makes sense for you
to have it generated by the archetype already Servlet 2.5 compliant
instead. I think that for Lift 2.0 could be a better default.

In any case, changing it for the 2.5 everything works good:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
>

and, also important, all tests now run in only some seconds ...

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running martins.lift_test.snippet.HelloWorldTestSpecsAsTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.437
sec
Running martins.lift_test.AppTest
Check Valid XML on "index.html"
Check Valid XML on "index.html"
Check Valid XML on "default.html"
Check Valid XML on "wizard-all.html"
Check Valid XML on "web.xml"
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.078
sec

Results :

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0

[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------

[INFO] Total time: 4 seconds
[INFO] Finished at: Wed Mar 24 12:36:47 CET 2010
[INFO] Final Memory: 19M/45M
[INFO]
------------------------------------------------------------------------


If you need more info, tell me, I'm happy to help.

> 2) Running the generated war in a standalone Tomcat-6.0.26 and trying
> to reload the webapp some times, I tried to see if there are some
> memory leaks (using the new feature of this new release of tomcat),
> and it says that there are some ThreadLocal variables that can cause
> memory leaks ... anyone knows this ?

Ok, just to verify with you that this wasn't a real problem ...


> > 3) To avoid warnings inside pages (for example from inside Eclipse),
> > wouldn't it be better to include in all default pages also the
> > references to all lift: namespaces ?
>
> What do you want changed? Please be specific with an example.

Warnings are generated inside IDEs, so for example adding the
following namespace declarations
inside pages, all warning go out:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:lift="http://liftweb.net/"
>

and probably also the same for the b namespace (used in b:time)
and maybe also for the wizard namespace (used in wizard-all.html)

> > And last, adding such references to pages containing only a
> > lift:surround tag, the output gives me an error ... but in this case
> > how can I do to to have such pages as html well-formed ?
>
> I can't parse this? What do you mean?

To have all page fragments be a valid HTML/XHTML pages, would be
useful to wrap the lift:surround contents
inside a well formed page, but I've seen that if I change for example
the webcontent/index.html to contains this:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:b="http://liftweb.net/"
xmlns:lift="http://liftweb.net/"
>
<head></head>
<body>

<lift:surround with="default" at="content">
<h2>Welcome to your project!</h2>
<p>
<lift:helloWorld.howdy>
<span>Welcome to lift-test at <b:time/></span>
</lift:helloWorld.howdy>
</p>
</lift:surround>

</body>
</html>

running the webapp with mvn jetty:run or mvn tomcat:run , I have two
strange situations (both on Firefox 3.6.x and IE 7):
with the (empty) header the generated pages gives me the content
twice ... strange and not the best,
and in some cases sometimes it gives me an error in the browser ...
not so good.
Moving header tags inside a comment all works good.


Note that adding this we get the useful feature to preview any
fragment also in Browsers opening the file from the file system
(not served by the webapp), and this could speedup the development
phase.

In any case, what do you think on adding the feature (like in JSF)
that in page fragments, anything outside a lift:surround tag
in discarded ? In JSF all outside ui:composition is discarded ... and
in this way all page fragments could be validated, checked, etc ...

Comments ?


Thanks for the attention and excuse me for the long post,
Sandro

David Pollak

unread,
Mar 24, 2010, 2:10:12 PM3/24/10
to lif...@googlegroups.com
On Wed, Mar 24, 2010 at 8:12 AM, smartini <sandro....@gmail.com> wrote:
Hi,
thanks for the reply, I'll try to write more info here:

maven_tests>mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_18
Java home: C:\jdk1.6.0\jre
Default locale: it_IT, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
maven_tests>

mvn archetype:generate -U  -DremoteRepositories=http://scala-tools.org/
repo-releases
-DarchetypeGroupId=net.liftweb -
DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=2.0-M3 -
DgroupId=martins.lift_test -DartifactId=lift-test -Dversion=1.0.0

cd lift-test
Then, running mvn test
I get (initial stuff removed):

[snip]


The problem is that the XML validation cannot be done because the XML validator cannot get the DTD.  Are you running disconnected?  Are you behind a proxy such that the XML validation code in the JVM cannot get the DTD from the W3C or Sun?

This is not a Lift issue.
So, looking at the web.xml I see that it's a Servlet 2.3 compliant
(for this my question if it makes sense for you
to have it generated by the archetype already Servlet 2.5 compliant
instead. I think that for Lift 2.0 could be a better default.

Is it hurting anything?  Is the DTD for Servlet 2.3 incompatible with the DTD for Servlet 2.5?
 

In any case, changing it for the 2.5 everything works good:

Cool.  Go ahead and change it in your stuff.
 



> > 3) To avoid warnings inside pages (for example from inside Eclipse),
> > wouldn't it be better to include in all default pages also the
> > references to all lift: namespaces ?
>
> What do you want changed?  Please be specific with an example.
Warnings are generated inside IDEs, so for example adding the
following namespace declarations
inside pages, all warning go out:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
     xmlns:lift="http://liftweb.net/"
>

and probably also the same for the b namespace (used in b:time)
and maybe also for the wizard namespace (used in wizard-all.html)

There are important reasons not to do this.

There is a very nasty bug in Firefox related to jQuery and namespaces.  If you have namespaces on certain elements that are manipulated by jQuery, Firefox does suboptimal things (I don't remember the specific issue off hand, but I spent a couple of days tracking it down and working with the jQuery folks on it.)  So, having the namespace declarations causes problems when they escape into the browser.
 



> > And last, adding such references to pages containing only a
> > lift:surround tag, the output gives me an error ... but in this case
> > how can I do to to have such pages as html well-formed ?
>
> I can't parse this?  What do you mean?
To have all page fragments be a valid HTML/XHTML pages, would be
useful to wrap the lift:surround contents
inside a well formed page, but I've seen that if I change for example
the webcontent/index.html to contains this:

You can manage templates any old way you want.  If you want each file to have <html>, <head> and <body> tags in them you can do that, but then you can't also have these tags in the template that you use for <lift:surround>.  If you want to have each file <lift:embed" the specifics of the header, etc.

Lift's templating is just an XML rewriter, so you can rewrite the XML any way you want and lay out the XML any way you want. 
 

I would not want to change the behavior of <lift:surround>  First, it would break compatibility with all existing Lift apps, second it would like surround to a single nested layer and third, it would break the concept that snippets are simply rewriting mechanisms for XML.
 
In JSF all outside ui:composition is discarded ... and
in this way all page fragments could be validated, checked, etc ...

Comments ?


Thanks for the attention and excuse me for the long post,
Sandro

--
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.

smartini

unread,
Mar 25, 2010, 5:36:53 AM3/25/10
to Lift
Hi David,
thanks for the info ...

> The problem is that the XML validation cannot be done because the XML
> validator cannot get the DTD.  Are you running disconnected?  Are you behind
> a proxy such that the XML validation code in the JVM cannot get the DTD from
> the W3C or Sun?

Yes, I'm behind a proxy, but the strange thing is that this problem
occurs only in this phase but I agree that could be a maven (or
plugin) issue ... in any case, I've seen that at this URL

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd

there is the right Servlet 2.5 schema, while searching there for a DTD
I found nothing (i don't know if Sun has done a DTD for this release),
so maybe this could be the problem.

> This is not a Lift issue.

Good, my fear here was to check with you is there was something
strange to fix before the final 2.0 release ...

> > In any case, changing it for the 2.5 everything works good:
>
> Cool.  Go ahead and change it in your stuff.

Ok, so in this case you think would be useful to have the archetype
for Lift 2.0 to generate (by default) a web.xml targeting Servlet
2.5 , o do you prefer to keep it as-is ? Now most application servers
are Servlet 2.5, so could be a good default (but maybe only starting
from Lift 2.0).


> > <?xml version="1.0" encoding="UTF-8"?>
> > <html xmlns="http://www.w3.org/1999/xhtml"
> >      xmlns:lift="http://liftweb.net/"
>

> There are important reasons not to do this.
>
> There is a very nasty bug in Firefox related to jQuery and namespaces.  If
> you have namespaces on certain elements that are manipulated by jQuery,
> Firefox does suboptimal things (I don't remember the specific issue off
> hand, but I spent a couple of days tracking it down and working with the
> jQuery folks on it.)  So, having the namespace declarations causes problems
> when they escape into the browser.

Oh, I wasn't aware of this ... but also with 3.5.x and 3.6.x ?


> > > > And last, adding such references to pages containing only a
> > > > lift:surround tag, the output gives me an error ... but in this case
> > > > how can I do to to have such pages as html well-formed ?
>

> > In any case, what do you think on adding the feature (like in JSF)
> > that in page fragments, anything outside a lift:surround tag
> > in discarded ?

This is useful because web page designers can work on (normal) pages
to be later converted into templates, and also visual editors doesn't
complain on page structure ... but without this the process can be
split in two phases, no problem.

> I would not want to change the behavior of <lift:surround>  First, it would
> break compatibility with all existing Lift apps, second it would like
> surround to a single nested layer and third, it would break the concept that
> snippets are simply rewriting mechanisms for XML.
>

Maybe in the future, adding an additional lift tag to handle this
behavior could be useful, but this is another story.
In any case, I agree with your point of view, and probably when I'll
have more Lift knowledge probably this will not be a problem for me.


Thanks again for your patience and help,
Sandro

David Pollak

unread,
Mar 26, 2010, 12:55:09 PM3/26/10
to lif...@googlegroups.com
On Thu, Mar 25, 2010 at 2:36 AM, smartini <sandro....@gmail.com> wrote:
Hi David,
thanks for the info ...

> The problem is that the XML validation cannot be done because the XML
> validator cannot get the DTD.  Are you running disconnected?  Are you behind
> a proxy such that the XML validation code in the JVM cannot get the DTD from
> the W3C or Sun?
Yes, I'm behind a proxy, but the strange thing is that this problem
occurs only in this phase but I agree that could be a maven (or
plugin) issue ... in any case, I've seen that at this URL
there is the right Servlet 2.5 schema, while searching there for a DTD
I found nothing (i don't know if Sun has done a DTD for this release),
so maybe this could be the problem.

> This is not a Lift issue.
Good, my fear here was to check with you is there was something
strange to fix before the final 2.0 release ...

> > In any case, changing it for the 2.5 everything works good:
>
> Cool.  Go ahead and change it in your stuff.
Ok, so in this case you think would be useful to have the archetype
for Lift 2.0 to generate (by default) a web.xml targeting Servlet
2.5 , o do you prefer to keep it as-is ? Now most application servers
are Servlet 2.5, so could be a good default (but maybe only starting
from Lift 2.0).


At this point, you're the first person to have a problem.  I prefer not to change things that have worked well for 3+ years unless there's a compelling reason.
 

> > <?xml version="1.0" encoding="UTF-8"?>
> > <html xmlns="http://www.w3.org/1999/xhtml"
> >      xmlns:lift="http://liftweb.net/"
>
> There are important reasons not to do this.
>
> There is a very nasty bug in Firefox related to jQuery and namespaces.  If
> you have namespaces on certain elements that are manipulated by jQuery,
> Firefox does suboptimal things (I don't remember the specific issue off
> hand, but I spent a couple of days tracking it down and working with the
> jQuery folks on it.)  So, having the namespace declarations causes problems
> when they escape into the browser.
Oh, I wasn't aware of this ... but also with 3.5.x and 3.6.x ?

It doesn't matter.  Lift apps have to work with a very wide variety of browser, so we're not going to introduce something into the archetypes that causes problems on even some browsers.
 


> > > > And last, adding such references to pages containing only a
> > > > lift:surround tag, the output gives me an error ... but in this case
> > > > how can I do to to have such pages as html well-formed ?
>
> > In any case, what do you think on adding the feature (like in JSF)
> > that in page fragments, anything outside a lift:surround tag
> > in discarded ?
This is useful because web page designers can work on (normal) pages
to be later converted into templates, and also visual editors doesn't
complain on page structure ... but without this the process can be
split in two phases, no problem.

> I would not want to change the behavior of <lift:surround>  First, it would
> break compatibility with all existing Lift apps, second it would like
> surround to a single nested layer and third, it would break the concept that
> snippets are simply rewriting mechanisms for XML.
>
Maybe in the future, adding an additional lift tag to handle this
behavior could be useful, but this is another story.
In any case, I agree with your point of view, and probably when I'll
have more Lift knowledge probably this will not be a problem for me.


Thanks again for your patience and help,
Sandro

--
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.

cody koeninger

unread,
Mar 26, 2010, 2:13:22 PM3/26/10
to Lift

On Mar 26, 11:55 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:


> > > > In any case, changing it for the 2.5 everything works good:
>
> > > Cool.  Go ahead and change it in your stuff.
> > Ok, so in this case you think would be useful to have the archetype
> > for Lift 2.0 to generate (by default) a web.xml targeting Servlet
> > 2.5 , o do you prefer to keep it as-is ? Now most application servers
> > are Servlet 2.5, so could be a good default (but maybe only starting
> > from Lift 2.0).
>
> At this point, you're the first person to have a problem.  I prefer not to
> change things that have worked well for 3+ years unless there's a compelling
> reason.

He's not the first person to have a problem with web.xml . . . I had
to make the change shown here:

http://github.com/koeninger/liftweb/commit/5a086b5e64080276fdf0a7a89e2b772a6bd5e5a2#diff-8

in order to get lift + jta + jndi working on glassfish. We decided
against using glassfish, and I already wasted enough time fooling with
it, but as I recall the persistence-context-ref element is unavailable
in the old schema, and the display-name + description elements from
the default web.xml are in the wrong place to be used as-is with 2.5.

David Pollak

unread,
Mar 26, 2010, 3:44:16 PM3/26/10
to lif...@googlegroups.com
On Fri, Mar 26, 2010 at 11:13 AM, cody koeninger <co...@koeninger.org> wrote:


On Mar 26, 11:55 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> > > > In any case, changing it for the 2.5 everything works good:
>
> > > Cool.  Go ahead and change it in your stuff.
> > Ok, so in this case you think would be useful to have the archetype
> > for Lift 2.0 to generate (by default) a web.xml targeting Servlet
> > 2.5 , o do you prefer to keep it as-is ? Now most application servers
> > are Servlet 2.5, so could be a good default (but maybe only starting
> > from Lift 2.0).
>
> At this point, you're the first person to have a problem.  I prefer not to
> change things that have worked well for 3+ years unless there's a compelling
> reason.

He's not the first person to have a problem with web.xml . . . I had
to make the change shown here:


Okay.  He's the first person to report such a problem on this list.

If it is a larger issue that has not surfaced in this forum, then, yeah, let's discuss it.
 
http://github.com/koeninger/liftweb/commit/5a086b5e64080276fdf0a7a89e2b772a6bd5e5a2#diff-8

in order to get lift + jta + jndi working on glassfish.  We decided
against using glassfish, and I already wasted enough time fooling with
it, but as I recall the persistence-context-ref element is unavailable
in the old schema, and the display-name + description elements from
the default web.xml are in the wrong place to be used as-is with 2.5.

--
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.

Reply all
Reply to author
Forward
0 new messages