Richfaces select element does not render drop down menu - drop-down-menu

I need an editable drop down menu with rich faces. Here is my code.
<rich:select enableManualInput="true" defaultLabel="start typing for select">
<f:selectItem itemLabel="label1" itemValue="iv1"/>
<f:selectItem itemLabel="label2" itemValue="iv2"/>
</rich:select>
The above code does not display an editable drop down menu. It only displays an input text box with items listed below it. When I start typing in the text box, the list disappears.
Screenshot:
What is causing this problem? I tried this with richfaces 4.3.2 and 4.3.4. Both gave me same problem.

Turns out I had incorrect settings in web.xml. The following configuration works:
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>classic</param-value>
</context-param>

Related

Facing myFaces error when migrating from WAS8 to WAS9?

We are currently migrating our application from WAS8 to WAS9. We use JSF 2.2 and Primefaces 4.0. In WAS8 application works fine.But in WAS9 we are getting the following error:
Uncaught service() exception root cause Faces Servlet: javax.servlet.ServletException: /pages/xyz.xhtml - No saved view state could be found for the view identifier: /pages/xyz.xhtml
Our web.xml looks like following :
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.COMPRESS_STATE_IN_CLIENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
<param-value>true</param-value>
</context-param>
Tried changing STATE_SAVING_METHOD to client.But that is not working. Can anyone kindly help me in resolving this error. Thanks in advance.
I'd prefer to comment, but I do not have enough points.
It's hard to say what could be the causing this without more information.
Web.xml seems fine. Otherwise factors that can cause this error is session expiration or an problem with the cookies.
Another possibility is that javax.faces.ViewState may be corrupted?
My idea is that org_apache_myfaces_NUMBER_OF_VIEWS_IN_SESSION may need to be increased?
http://myfaces.apache.org/core20/myfaces-impl/webconfig.html#org_apache_myfaces_NUMBER_OF_VIEWS_IN_SESSION
But please read more about the viewexpiredexception below and I hope that may help you identity the problem.
javax.faces.application.ViewExpiredException: View could not be restored

JSF 2 h:messages appears on the end of the form

I have a screen which is implemented in JSF2 and I have validations on some of the fields, and when an error appears for a field that has no
<h:message for="fieldName" />
it always appear on the end of the screen with no style
I want to hide the messages summary even if I don't handle those validations
I guess they are just warnings that you see when your project stage is set to Development.
In web.xml file, change:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
to:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
and the messages disappear.
It is a feature of JSF 2 that shows you diagnostic messages when you are on Development stage. Actually you should changed that value in web.xml only when you want to put the project in production.

Defining spring security http element in two different files?

Is it possible to define the security:intercept-url elements and security:custom-filter elements for a single security:http in two different Spring configuration files?
This is so we can cleanly reuse the security:custom-filter definitions which will be common across many applications with intercept rules that will not.
I can't simply duplicate the <security:http> element because I get BeanDefinitionParsingException: Configuration problem: Duplicate <http> element detected. I am well well aware of how to split a normal bean file with import
As requested in comment:
Spring Security versions prior to 3.1.x do not allow multiple http element definitions.
3.1 does however.
Here is the Jira issue for the feature.
This article on 3.1 changes might also be helpful.
You can define another context file in your web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-contexts/context1.xml
/WEB-INF/spring-contexts/context2.xml
</param-value>
</context-param>
Or you can define a directory where your contexts would be and name them any way you like without having to specify each context file separately:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-contexts/*
</param-value>
</context-param>
Regarding Ayusman's answer, you actually can import your security contexts into your bean contexts:
<beans>
<import resource="classpath*:/security-context-*.xml"/>
<bean><!-- blah blah --></bean>
</beans>
use the import in application context file..
custom-filter.appcontext.xml
.
.
<import resource="interceptor-url-file.xml"/>
Note that both files need to have the proper spring xml schema details and MUST be valid XML files.
I have been working on this error for 5 hours. Really stupid problem.
This error is a parse error that when you comment some lines in applicationContext-security.xml, files are not generated correctly.
Let me explain on an example code.
<port-mappings>
<port-mapping http="7001" https="7002" />
</port-mappings>
<!-- <port-mappings>
<port-mapping http="7015" https="7515" />
</port-mappings>
-->
this lines are generated as,
<port-mappings>
<port-mapping http="7001" https="7002" />
</port-mappings>
<port-mappings>
<port-mapping http="7015" https="7515" />
</port-mappings>
-->
so that, compiler tells you "duplicate element detected". Because generated file includes duplicate elements.
I hope to help you .

Vaadin configuration with BIRT

I'm useing Vaadin and BIRT reporting in my project.I have problem with accessing report with Vaadin,I think its related to my web.xml configuration.Can anyone help me to get out from this problem??
< /servlet-mapping>
<servlet-name>VaadinApplicationServlet</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VaadinApplicationServlet</servlet-name>
<url-pattern>/MyProject/*</url-pattern>
</servlet-mapping>
If i put url pattern like this.it shows index.jsp page as first page.
< /servlet-mapping>
<servlet-name>VaadinApplicationServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
If I configure the url pattern as "/*" it works fine and load the vaadin UI
but the problem is if I put 2nd configuration I can not load the report to browser,It always redirect to my current vaadin UI page (When I click the button to load the report)
If put first configuration I can access report directly ,But It does not load the vaadin UI.
Can any one help me to solve this problem??
Thank you.
Cheers
The first configuration should be ok, but you have to access your application differently:
Try
http://localhost:8080/[display-name]/MyProject
You should find the display-name right above the first context-param
<display-name>IamTheDisplayName</display-name>
<context-param>
<description>Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>

Issue re-rendering a <ui:include /> in Richfaces 4.0

I am using richfaces 4.0 final. I have a page where I am including another facelet using
<ui:include src="#{bean.selectedPage}" />
The String selectedPage is set on a button click. When button is clicked, the page is changed and panel surrounding the above code is re-rendered using "render" attribute. The facelet has a datatable. eg:
<rich:dataTable>
<f:facet name="header">
<rich:columnGroup>
<rich:column>
<h:outputText value="hello" />
</rich:column>
</rich:columnGroup>
</f:facet>
</rich:dataTable>
The css for this datatable is not included. Could someone help me resolve this issue ? I have added all required jars. This following is a snippet of my web.xml
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinningClasses</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>blueSky</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
The strange part is the skin is loaded for other components like <a4j:commandButton /> . Issues appear only for datatable.
I have faced this before. AFAIK, richfaces loads the CSS for components on demand. Since your page is loaded dynamically, Richfaces never loads the css cause it never knows. (mentioning hard coded page name,framework already knows what component's css to render,and so it does, as you mentioned in your comment).
The only solution I could find for this was to include a rich:dataTable in your parent page (i.e. the page in which you are including this facelet with <ui:include>) and set its style to display:none. This way the framework includes the rich:dataTable css before-hand.
I know its not a perfect solution, but I couldn't find a better one!

Resources