myfaces

Difference between Mojarra and MyFaces

柔情痞子 提交于 2019-12-17 03:07:08
问题 I am starting on JSF2.0 I used a tutorial as a reference but I have the following question: The tutorial used 2 libs only: jsf-api.jar , jsf-impl.jar (but also had JSTL) from Mojarra Project. I tried to dowload them also but seems the site is not reachable. So I used Apache MyFaces but to run the example I had to add 8 jars ( commons-* , myfaces-* ). Why do I need more jars if I use MyFaces? Should I prefer Mojarra as lighter? Also the download page is indeed JSF Mojarra? Thanks 回答1: Why do I

StackoverflowError with Apache Myfaces +v2.2.0

只愿长相守 提交于 2019-12-13 18:25:49
问题 I tried updating an existing application to MyFaces 2.2.7 (from 2.1.7) by simply changing the version in maven. When I try to deploy the app, I get a StackOverflowError (below). My app is running succesfully with myfaces-core/impl v 2.1.7. > SEVERE: Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener java.lang.StackOverflowError at org.apache.catalina.core.ApplicationContext.getAttribute(ApplicationContext.java:237)

How to create conditions based on user role using JSF/MyFaces?

懵懂的女人 提交于 2019-12-13 15:12:44
问题 What options do I have to read the roles of the current user from my JSP pages? I'm aware of the visibleOnUserRole="myRole" attribute on Tomahawk components, but I need roles for a bit more complicated things than simple visibility. 回答1: The ExternalContext exposes user and role information. public class RolesAccess implements Serializable { public String getUserPrincipalName() { FacesContext context = FacesContext.getCurrentInstance(); Principal principal = context.getExternalContext()

f:ajax render referencing iterated component

萝らか妹 提交于 2019-12-13 08:56:42
问题 I have xhtml with following structure: <h:form id="frmMain2"> <f:subview id="sub1"> <ui:repeat var="vatId" value="#{someBean.suppliesKeys()}" id="rep1"> <fieldset> <legend>vatId</legend> <h:panelGroup id="panel"> <ui:repeat var="item" value="#{someBean.supplies[vatId]}" id="rep2"> <f:subview id="sub2"> <h:commandLink id="command"> ${item} <f:ajax event="click" render=":frmMain2:sub1:rep1:0:panel"> </f:ajax> </h:commandLink> </f:subview> </ui:repeat> </h:panelGroup> </fieldset> </ui:repeat> <

No saved view state could be found for the view identifier

萝らか妹 提交于 2019-12-13 05:39:09
问题 When I was running my JSF application on Jetty server it was running fine. But as I moved this to Weblogic server, it started giving me this error. javax.faces.application.ViewExpiredException: /wsListing.xhtmlNo saved view state could be found for the view identifier: /wsListing.xhtml at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:132) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170) at org.apache.myfaces.lifecycle

Tommahawk Myfaces and CDI

Deadly 提交于 2019-12-13 05:31:09
问题 I'm having some problems using CDI with Tommahawk Myfaces when trying to create a JSF page to upload a file. Referring to this question it looks as though Tommahawk MyFaces isn't compatible with CDI but is this correct? My Bean is like this: @ManagedBean @RequestScoped public class Bean { private UploadedFile uploadedFile; public void submit() throws IOException { String fileName = FilenameUtils.getName(uploadedFile.getName()); String contentType = uploadedFile.getContentType(); byte[] bytes

update fields of conditionally rendered form

南楼画角 提交于 2019-12-13 04:44:32
问题 my problem is, that I want to render form2 conditionally. This collides with a ajax update event of another form1, which should trigger the rendering of form2. <h:form id="form1"> <h:selectOneMenu id="selectedGroupId" label="#{msgs.group_group}" value="#{groupBean.selectedGroupId}"> <p:ajax event="change" listener="#{groupBean.selectGroupEvent}" update=":form1"/> <f:selectItems value="#{groupBean.availableGruppen}" /> </h:selectOneMenu> </h:form> <h:form id="form2" rendered="#{not empty

Passed argument to method inside composite component does not work on MyFaces

霸气de小男生 提交于 2019-12-13 04:36:40
问题 I have successfully able to pass in argument to method inside composite component using this technique from BalusC (Pass Argument to a composite-component action attribute), however this seems to work on Mojarra, but not on MyFaces 2.0.4-2.0.5 (packaged inside Websphere 8.5 + OpenWebBeans) . I post my code below This is my cc <cc:interface> <cc:attribute name="value" /> <cc:attribute name="bean" /> <cc:attribute name="myAction" /> <cc:attribute name="property" /> </cc:interface> <cc

How to handle ViewExpiredException by showing JavaScript alert?

此生再无相见时 提交于 2019-12-13 04:22:11
问题 I've read the question Handle ViewExireException/ajax and display a Primefaces dialog and the answer from BalusC. I'd want to handle the ViewExpiredException by showing the alert with information to refresh the page. I've taken the suggestion from BalusC to user RequestContext to put JavaScript to execute, and I've removed the JSF redirection because I'm not using it: @Override public void handle() throws FacesException { for (Iterator<ExceptionQueuedEvent> i =

MyFaces CODI and windowId request parameter issue

眉间皱痕 提交于 2019-12-13 02:16:38
问题 I have been trying to conduct some simple tests on Seam Weld and MyFaces CODI . After adding CODI jar files to my projects, I found that it adds a windowId request value to every request even if the bean scope is RequestScoped . Is it really necessary to add windowId request parameter to every request while the bean is in RequestScoped ? Is there any practical real-world scenario for this case? Is is possible to remove it if it is not necessary? For example: This is the code of bean class: