Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the problem and solution of JSF development

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you what JSF development problems and solutions are like, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

1. The action in does not execute.

Most of the time, it is used in the case of including a page (for example, including a navigation page), and if the included page has a non-JSF tag (such as), it must be used extra to include it in order not to report an error. The problem is that the included content is not included in the Component Tree of the JSF tag, so the action here will not be executed. The solution is not to use it in, that is, to use all JSF tags as far as possible is less likely to cause problems.

two。 Still in, the method of the action property is executed, but cannot go to the target page defined in faces-config

Check the faces-config.xml, and if the page is included, it might be "/ *" instead of "/ navigatorbar.jspx".

3. When used with EMF, the page throws a property exception "Error getting property 'xxx' from bean of type XXXX" that cannot be found

The construction method in the XXXImpl generated by EMF is modified by protected and can be changed to public. (be careful to modify the @ generated modifier, otherwise it will be overwritten the next time it is regenerated.)

Also (not limited to the case of EMF): if there are two methods with the same name but different parameters in a Bean, for example, Customer has two methods getRecords () and getRecords (int year), then using # {customer.value} in the JSF page will throw the same exception. I am not sure whether it is a problem with EL or a problem with the JSF implementation (the trinidad I use). Some of the exceptions are as follows:

Critical: Servlet.service () for servlet faces threw exception

Javax.faces.el.PropertyNotFoundException: Error getting

Property 'xxx' from bean of type XXXX

At com.sun.faces.el.PropertyResolverImpl.getValue

(PropertyResolverImpl.java:107)

At com.sun.faces.el.impl.ArraySuffix.evaluate

(ArraySuffix.java:167)

At com.sun.faces.el.impl.ComplexValue.evaluate

(ComplexValue.java:151)

At com.sun.faces.el.impl.ExpressionEvaluatorImpl.

Evaluate (ExpressionEvaluatorImpl.java:243)

At com.sun.faces.el.ValueBindingImpl.getValue

(ValueBindingImpl.java:173)

At com.sun.faces.el.ValueBindingImpl.getValue

(ValueBindingImpl.java:154)

At org.apache.myfaces.trinidad.bean.FacesBeanImpl.

GetProperty (FacesBeanImpl.java:66)

At org.apache.myfaces.trinidad.component.UIXComponentBase.

GetProperty (UIXComponentBase.java:1100)

At org.apache.myfaces.trinidad.component.UIXIterator.

GetValue (UIXIterator.java:415)

At org.apache.myfaces.trinidad.component.UIXCollection

. _ flushCachedModel (UIXCollection.java:1127)

At org.apache.myfaces.trinidad.component.UIXCollection.

EncodeBegin (UIXCollection.java:511)

At org.apache.myfaces.trinidadinternal.uinode.UIComponent

UINode._renderComponent (UIComponentUINode.java:317)

At org.apache.myfaces.trinidadinternal.uinode.UIComponent

UINode.render (UIComponentUINode.java:279)

The solution is to rename the method with parameters.

4. Delete a bean from session

ValueBinding binding = FacesContext.getCurrentInstance ()

.getApplication () .createValueBinding ("# {MyBean}")

Binding.setValue (context, null)

The above is what JSF development problems and solutions are like. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 236

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report