Customising org.primefaces.component.messages.MessagesRenderer [duplicate] - jsf-2

This question already has answers here:
Overriding JSF Primefaces Message Tag
(2 answers)
Closed 6 years ago.
Background
We have an on-line application using JSF2.0 (One that comes with Web-sphere application server v8.5.5) + PrimeFaces 5.0
Requirement
For a particular requirement, we have to customise org.primefaces.component.messages.MessagesRenderer. We noticed that there is no clean way to customise org.primefaces.component.messages.MessagesRenderer .
As a work around we created a class org.primefaces.component.messages.MessagesRenderer in Web Source folder. This class ends up in WebInf/classes
Issue
Upon initial deployment prime-faces.jar loaded the version of org.primefaces.component.messages.MessagesRenderer in WebInf/classes and every thing worked as expected.
Upon further investigation it became apparent that the war class loading behaviour is inconsistent. We couldn't guarantee which version of org.primefaces.component.messages.MessagesRenderer is loaded by the Prime Faces frame work. At times the application loads the version of org.primefaces.component.messages.MessagesRenderer from WebInf/classes other times it loads the version from WebInf/lib/primefaces-5.0.jar
The Servlet3.0 clearly states
The Web application class loader must load classes from the WEB-INF/classes
Directory first, and then from library JARs in the WEB-INF/lib directory.
So not sure why we are experiencing this inconsistent behaviour.
What was tried & suggested
We tried referencing the
org.primefaces.component.messages.MessagesRenderer in servlet startup
listener.
One of my colleagues suggested to remove org.primefaces.component.messages.MessagesRenderer in primefaces jar
file. This would resolve the issue, but customising third party library is against our company policy.
Summary
In conclusion what we are really looking is for a way to customise org.primefaces.component.messages.MessagesRenderer in prime-faces without patching the primefaces jar file.

Just found an solution for this issue
Adding the following snippet of code in applications faces-config.xml allows me to override the MessageRenderer in primefaces
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.MessageRenderer</renderer-type>
<renderer-class>my.CustomRenderer</renderer-class>
</renderer>

Related

Rails 7: tailwind.config.js is not picked up or supported out of the box

In a new Rails 7 project created with the css tailwind argument, Tailwind itself works as expected. However, making changes to the tailwind.config.js file are not picked up. No explanation is given in the documentation, and it's also difficult to Google as you mostly get answers related to Node/React/JS frameworks.
An issue was opened that was similar to this back in 2021, but the solution it contained doesn't seem to work anymore. With all of the changes in architecture from Rails 6.x to Rails 7.x, that's often the case.
Anyone have any experience making this work? This seems like a baseline thing. It's bizarre to me that this isn't hooked up to work in the "Rails way" from project initialization.

How can I transform my iOS/Swift project to a state where I will be able to use live views?

I have been working on my first iOS/Swift application for the past month or so, and have created all of my class declaration files (i.e. my .Swift files) in my main project folder. I would really like to use live views in my app, because as of right now I cannot build/run the app at all due to errors I don't know how to fix (I'll be posting about those later today in hope of finding someone who can help me fix them).
What would be the best way to go about converting all of my views into embedded frameworks so that I could use the Live Views feature of Xcode ? I am running Xcode 7 and wrote my app in Swift 2.0
Thanks
You apparently don't need to use frameworks for that anymore. At least it works just fine in Xcode 7 for me - for classes that are part of the main project. Just mark your class as #IBDesignable.
But in order to show the preview, your code needs to be able compile, so you will need to resolve your issues first.

iOS 8 App Extension and Host App in separate project files. Is it possible in Xcode 6?

Currently we're using premake5 to generate our project files, as we develop multi-platform. Obviously we don't need premake to know anything about the extension (as it's iOS8 exclusive feature) but we're facing a problem: Every time we regenerate the main app project file (which happens sometimes) we're forced to manually add all the files and configure the extension, which is dull and error-prone.
Is there a way to add the app extension (a Today Widget) to a separate project? Pbxproj files aren't version control friendly as its contents seem to be shuffled every time you save. So, saving a patch file with all the changes needed doesn't seem like an alternative.
I know this is a broad question about a convenience issue, maybe seasoned Xcode devs know some trickery (or maybe it's just something obvious we're missing here).
Thanks all in advance.

ClassNotFoundException StrutsPrepareAndExecuteFilter in struts2 [duplicate]

This question already has answers here:
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter when starting Simple Struts2 Application
(3 answers)
Closed 6 years ago.
I got this error when starting the app.
SEVERE: Exception starting filter struts2 java.lang.ClassNotFoundException:
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
and the server gave this error twice in a row.
I have struts2-core-2.3.15.2.jar in WEB-INF/lib and imported into build path. I do not understand why StrutsPrepareAndExecuteFilter cannot be found.
The application can get started. thats no problem. the problem is because of this error, struts2 cannot redirect the action.
I use tomcat 7 and struts2 2.3.16. It's Tomcat 7, the servelet-api is not 3.0 I guess. I tried to put servelet-api-3.0 in tomcat/lib but it's not compatible.
What's the problem?
Jars used:
The following minimum jars should be on your classpath:
asm-3.3.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
commons-fileupload-1.3.jar
commons-io-2.2.jar
commons-lang3-3.1.jar
commons-logging-1.1.3.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
log4j-1.2.17.jar
ognl-3.0.6.jar
struts2-core-2.3.16.jar
xwork-core-2.3.16.jar
You can also follow How To Create A Struts 2 Web Application.
the runtime problem was solved eventually by replacing the json jars package.. i think its the versions problems. it is a whole package. i dont remember the link now..
so it seems its better get the jar files from one source but not pick different version.. and these 6 jars should be included together. of course, be careful with the versions. i dont know mine. but it works.
commons-lang.jar
commons-logging.jar
commons-beanutils.jar
commons-collections.jar
json-lib-2.2.2-jdk15.jar
ezmorph.jar
BUT this problem is still there... I have this error, but the app can run
java.lang.ClassNotFoundException:
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
If you use Intellij IDEA, the reason maybe you did not add struts-xxx.xxx.jar file to artifacts.To solve this problem you just need open Project structure >> problems >> add struts x.x.x to artifacts(righit click on the problem option)
It works for me ,may it helps you.
If you are using external JRE, it may not work.
Instead use the internal JRE (which is inside JDK)
In the project
Go to Build path
-->Configure Build path
-->Libraries
-->Add Libraries
-->Installed JRRs
--> Give path of "JDK"(and not external JRE)
-->Finish.
Refresh the project and it would work.

vaadin 7: Widgetset does not contain implementation

I am trying my hands on vaadin and would like to use gantt chat add-on in my vaading 7 project.
https://vaadin.com/directory#addon/vaadin-gantt-diagram:vaadin
since this is not compatible with vaadin 7, I am trying to fix some code from the add-on to make it compatible with vaadin 7.
I checked out source code of vaadin-6.8 from repository and vaadin-gantt (add-on) from available downloads.
I changed the code a bit in vaadin-6.8 and built. I am using this customized vaadin-6.8 jar inside vaadin-gantt add-on. Now I am able to build vaadin-gantt add-on by using customized vaadin-6.8 jar. I want to use this add-on inside vaadin-7 project.
compiling went through, but i am getting below message on console while displaying gantt chart
"Widgetset does not contain implementation for ru.bazon.vaadin.ganttdiagram.canvas.GanttDiagramCanvas. Check its component connector's #Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions."
I compiled the gantt widgetset using eclipse plugin and could see the below entry in my projects *.gwt.xml file
I would like to make use of gannt chart add-on for vaadin-7. I didn't find any other add-on for vaadin-7 apart from this which is not compatible with vaadin 7.
any pointers?
Regards,
Azhar
Please make sure You have added #Widgetset("path of *.gwt.xml") on your main UI class.I have solved by adding this
I just had this error as well and it was caused by missing source files in the addon jar. Both .java and .class files must be present in the addon jar file as GWT compiles from sources. But most likely the addons form vaadin directory should include also the sources. And ofcourse don't forget to compile the widgetset and themes after importing your addon to your project.
Just leaving this here in case someone has the same case as I had. Our project is in Vaadin 8, and we already had #Widgetset("com.company.OurWidgetSet") as annotation on our UI-extending class.
However, I still received the same error as OP when accessing a pop-up of a separated component. Although we did try to migrate this component of ours to Vaadin 8 in the past, due to lack of time to do this properly, it was still mostly using Vaadin7 imports and functionality.
Because of this I had to add the following to our OurWidgetSet.gwt.xml file (within the <module>-tag) in our main project, to fix the functionality of the used component:
<inherits name="com.vaadin.v7.Vaadin7WidgetSet" />
just had the same issue as well, another thing to make sure if you use vaadin is the web.xml inside the WEB-INF folder of deployed resources.
Make sure the widgetset is also specified there:
<init-param>
<description>AWidgetSet</description>
<param-name>widgetset</param-name>
<param-value>com.example.a.widgetset.AWidgetset</param-value>
</init-param>
When using Java Config with Annotation #VaadinServletConfiguration an additional Solution is to add this as Annotation-Parameter widgetset:
#VaadinServletConfiguration(ui = MyUI.class, productionMode = true, heartbeatInterval = 500, closeIdleSessions = true, widgetset = "com.myapp.MyWidgetset")

Resources