ACF to LUCEE conversion - lucee

ajax CFC with can’t be found in lucee
Message:
invalid component definition, can’t find component [mycomp]
Stacktrace : The Error Occurred in<br>
/lucee/core/ajax/AjaxProxyHelper.cfc: line 26<br>
called from /AjaxProxy.cfc: line 73<br>
called from /AjaxProxy.cfc: line 45<br>
called from ..\..\daftarMohon.cfm: line 135
<cfajaxproxy cfc="mycomp" jsclassname="validation">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
PLEASE HELP

I don't bother with cfc's any longer. I send $.ajax straight to a .cfm page and have the .cfm page do a SerializeJSON(qry).
I don't use the tag based syntax any longer. I use the cfscript syntax instead.
I don't use cfquery any longer. I use stored procedures instead.
I don't use $.ajax any longer. I use fetch instead.

It might be just a mapping problem, does <cfdump var=#createObject("component","mycomp")#> show your component?

Related

Sublime Text adding additional opening tag at the beginning?

So every time I use html snippet or boiler plate with <ht + tab or enter
I get this extra opening tag? What gives?
<<!doctype html> <---- whats that additional tag at the beginning?
<html>
......
....
I got emmet installed by the way. Thanks
It's a snippet. You type html (or less), and press tab, it'll inserts all this content:
<!DOCTYPE html>
<html>
<head>
<title>$1</title>
</head>
<body>
$0
</body>
</html>
Note that if you repress tab again, it'll go to $1, and the last one is $0 (by default it's the end of the content).
So, don't type <ht, just ht, tab, and it'll insert everything for you. I really recommend you find yourself a course about Sublime Text, you're going to miss so much otherwise
That is the doctype decleration this is straight out of hte W3School docs:
The declaration must be the very first thing in your HTML
document, before the tag.
The declaration is not an HTML tag; it is an instruction to
the web browser about what version of HTML the page is written in.
In HTML 4.01, the declaration refers to a DTD, because HTML
4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly.
HTML5 is not based on SGML, and therefore does not require a reference
to a DTD.
Tip: Always add the declaration to your HTML documents, so
that the browser knows what type of document to expect.
You can read more about it here: http://www.w3schools.com/tags/tag_doctype.asp

Unable to find or serve resource, dataList.xhtml, from library, org.apache.myfaces.custom

I am trying to implement pagination in JSF and Hibernate.
I have these statements on my html page.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk">
<t:dataList value="#{med.pages}" var="page">
I have included tomahawk20-1.1.14-bin - the jar files in /build/web/WEB-INF/lib and tomahawk-examples-1.1.14-bin - all the war files in /build/web/WEB-INF/src/META-INF
But, I get this error : Unable to find or serve resource, dataList.xhtml, from library, org.apache.myfaces.custom.
What should I do ?
I think it is caused by Mojarra (it gets confused reading the .taglib.xml, even if is valid syntax to use that file for composite and normal components, it was clarified in the new 2.2 spec) Use MyFaces JSF implementation instead to get it fixed.
I believe this is a tomahawk issue.
The JSF 2.2 spec mentions this:
As specified in facelet taglibrary schema, the runtime must also
support the composite-library-name element. The runtime must
interpret the contents of this element as the name of a resource
library as described in Section 2.6.1.4 “Libraries of Localized and
Versioned Resources”. If a facelet tag library descriptor file is
encountered that contains this element, the runtime must examine the
element in that same tag library descriptor and make it
available for use in an XML namespace declaration in facelet pages.
And there's also this in the spec:
If you want to employ a cc with a namespace other than
http://java.sun.com/jsf/composite/libraryName you need to have a
taglib file that declares composite-library-name. Currently you must
not declare any tag elements in such a taglib file. All the tags in
such a library must come from the same resource library.
In the case of tomahawk, composite-library-name does not point to a resource (a directory name under META-INF/resources), hence the errors.
The simple solution here may be to remove the composite-library-name element from the tomahawk.taglib.xml file (if it's not needed for any other purpose of course). I haven't tested it however.

Custom JSF component: Using "startElement" with "script" results in a comment

I'm rendering a custom JSF component. In the method encodeBegin I want to include some java script.
public void encodeBegin(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("script", this);
writer.writeAttribute("type", "text/javascript", null);
writer.writeText("var width=400",null);
writer.endElement("script");
}
When rendering the component the content of the script tag is commented out.
<script type="text/javascript"><!--
var width=400;
//--></script>
Can anybody explain why this comment appears and how I get rid of it?
Thanks in advance!
This is specific to the MyFaces implementation, not to JSF specification. The Mojarra implementation doesn't do that.
This approach of putting JavaScript body in a HTML comment is basically a leftover of the HTML prehistory back when browsers existed which doesn't support <script> elements. Those HTML comments basically hides the JavaScript content to prevent those ancient HTML parsers from interpreting and displaying JavaScript code as plain text.
See also Mozilla Developer Network - Writing JavaScript for XHTML:
This was common practice in HTML, to hide the scripts from browsers not capable of JS. In the age of XML comments are what they were intended: comments. Before processing the file, all comments will be stripped from the document, so enclosing your script in them is like throwing your lunch in a Piranha pool. Moreover, there's really no point to commenting out your scripts -- no browser written in the last ten years will display your code on the page.
Note the last sentence, this is very true, no single browser developed in the last decade would do that anymore. MyFaces is apparently a bit overzealously assuming that one would still be using such a prehistoric browser nowadays.
It is ok
The practice is marking the javascript code as comments, so automatic tools don't try to parse it as HTML (for example, tools that check that your page is HTML 4 compliant).
The Javascript engine will ignore the HTML comment and process the code (Javascript comments are /* and //
A variation of this approach is putting the Javascript inside a CDATA tag, for the same reasons.

Default.css is not loaded for openfaces

I am getting title as error and it is asking
Did you use head instead of h:head?
I started to use OpenFaces, add JAR to library, and add namespace
xmlns:o="http://openfaces.org/"
I can see components working right but without styling.
I am using a tree, I can expand it but can not close it.
Should I add some css to somewhere?
First, I suppose that you've used <h:head> tag in your xhtml page (and not the plain <head> tag), as the error message suggests...
Other than that there's nothing that you should do to make it work without this error (if you're using JSF 2.x based version of OpenFaces).
If you're using OpenFaces 3.0 release (with JSF 2.x) then there was a bug where this error was shown in some configurations despite having the <h:head> tag in the page. Try the current nightly build where this problem is fixed.

Meta keywords before doctype declaration?

I recently was browsing a local web design firm's portfolio and found all their sites' code begins as such:
<meta name="keywords" content="a whole bunch of keywords for their site">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
...
I was able to determine that the pages were generated by dreamweaver (at least in part).
Did dreamweaver do this, or did their "developer" just paste the code at the top of the document.
It is my impulse that this is bad practice and it might work incorrectly on some platforms but it got me wondering as to whether or not their may be a reason for this?
That is a terrible practice and invalid HTML. I bet that this would throw IE directly into quirks mode.
But as for your question, either the developer is a script kiddie and shoved the <meta> tag in there with little knowledge of the outcomes, or Dreamweaver did it. I hope it was Dreamweaver...
FYI - just had this issue and Dreamweaver does not put the meta tags in the correct position automatically. Cursor must be placed beforehand into an editable region.

Resources