XML Error while building JSF project - jsf

I generated Entity Classes from database then I generated JSF pages from them but when I click on any show table this message displays 3 times:
Warning this page calls for XML namespaces http://xlmns.jsp.org/jsffacelets declared with prefix ui but no taglibrary exists for that namespace

For UI tags you need to use following tag library.
xmlns:ui="http://java.sun.com/jsf/facelets
Please check following link,
http://www.mkyong.com/jsf2/jsf-2-templating-with-facelets-example/

Related

Accessing properties across pages in AEM HTL (Sightly)

I have a carousel component, whose slide content will be the content from another page, accessed via reference component. I want to get some properties authored in the carousel to be accessible inside the referenced page. i.e. I have Page A- with a Carousel accessing PageB through reference component. I want to get proeprties from PageA in PageB. Can this be achieved?
Sure it can, you will need to lookup/query the content and find pages where PageB is included, then get the properties of those pages (there might be more than one) and merge them. It will have to be custom code though as this is not available out-of-the-box as of AEM 6.3.
The solution could be adding a query parameter or setting a request parameter. But then again, this depends on the requirement. For me, this worked!!

Cannot use attribute forms in page template?

I am using JDeveloper 11.1.2.3.0
I have to show a popup by clicking a link that is located in the page template. For this I created a popup within the pageTemplate then inserted a dialogBox and within the dialog box I dragged and dropped my VO from the DataControl panel and inserted it as an ADF form. The problem is that when I run and click the link (that contains the "ShowPopupBehavior") I am getting this error:
//C:/Oracle/Middleware/jdeveloper/jdev/system11.1.2.3.39.62.76.1/MyNew/ViewControllerWebApp.war/WEB-INF/templates/myTemplates.jsf #58,118 value="#{bindings.TypeName.inputValue}": Target Unreachable, 'TypeName' returned null
ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #2
This happens for every View that I can insert here. Is this comming because I am not allowed to insert ADF forms within the page template?
If so please give me a hint to achieve what I explained in the first sentence.
I just figured out the solution to this problem. Each page has its own bindings, so a page that uses the templates (or if want to use bindings from other pages) has to declare that page in the Executables section of the page Bindings. The new executable should have the ID of the page (of the template in this case) and the path of the page. Then the bindings of the template can be accessed as explained here:
public String cb1_action() {
BindingContext bctx = BindingContext.getCurrent();
DCBindingContainer bindings =
(DCBindingContainer)bctx.getCurrentBindingsEntry();
//access the page template Pagedef file reference in the
//Executable section of the consumer page's Pagedef file
DCBindingContainer templateBinding =
(DCBindingContainer)bindings.get("ptb1");
//get the MethodBinding
OperationBinding printMethod =
(OperationBinding)templateBinding .get("printThis");
//invoke the print method exposed on the template's PageDef file
printMethod.getParamsMap().put("message","Hello World");
printMethod.execute();
return null;
}
https://blogs.oracle.com/jdevotnharvest/entry/how_to_invoke_adf_bindings
ps: Pay attention not to bind the value of the template in your page ex: value="#{bindings.ptb1}" - it is a bit strange but in this case you will not get the page bindings and will get only the template ones.
The value property containing #{bindings.ptb1} should be removed from the pageTemplate tag but the ptb1 reference has to be in the pages PageDef file.

Create JSF from Xml : is it possible?

Is it possible to create a JSF page from a XML file? For example, i make a XML file containing what components i want to be created and displayed on the jsf page, and on loading, xml is parsed and components are created and showm. Either it is not possible , is there an alternative solution (a better way) to do it?

Creating nested custom tag using jsp2 tag files

I want to create custom jsp tags.Following is my requirement.
1.The tag I have to create can always be added as a chlild tag for certain tags.So I want to validate the tag to check if it is inside a valid parent tag.
2.I want to access the attributes of the parent tag in the child tag file and vice versa.
3.I also want to set one property for each tag which can be set from the tag file and the user should not be able to set it.
I would like to know if I can accomplish these with tag files or should I go for creating custom tags using java code? If these can be done suing tag files can you please give an example?
Navigating up the tag tree, which is required for the validation in your first point, is only possible inside a custom tag (implementing SimpleTag, and using its getParent method), but not in a custom tag file.
Example for checking the type of parent and setting an attribute:
JspTag jspTag = getParent();
if (jspTag instance MyCustomTag) {
MyCustomTag myCustomTag = (MyCustomTag) jspTag;
myCustomTag.setFoo("bar");
}

add the code for a widget (widget.xhtml) once but use it twice in same webpage, possible ? How?

I have a widget in my application that I need to display at two places(once in main page body and once through dialog box). Currently its code has been added twice in the page. Now I was thinking, If there was a way I could just include it only once and show the same instance in the dialog box, as in the main page body.
Can you suggest a way for this?
I'm Using:-
JSF 2.0 with Facelets
Primefaces 3.0 M3 Snapshot
JSF 2 has exactly the feature you want: it's called composite components. I bascially allows you to write a bunch of Facelet code into a file and use it just like any other JSF component, pass parameters to it, etc.

Resources