T:panelTabbedPane reg. in JSF
I have panelTabbedPane created thru JSF, which has 2 tabs, i want to reduce the size of the tabs not the whole area. plz find the attached code.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<HTML>
<HEAD>
<TITLE>Term - Detail</TITLE>
<LINK rel="STYLESHEET" href="./css/styles.css" type="text/css" />
</HEAD>
<BODY>
<f:view>
<h:form id="_77" >
<t:panelTabbedPane id="tab"
style="position:absolute; top:33px; left:17px; height:579.8px; width:970px; font-family:Arial; font-size:9pt"
inactiveTabStyleClass="standardInactiveTabStyleClass"
inactiveSubStyleClass="standardInactiveSubStyleClass"
disabledTabStyleClass="standardDisabledTabStyleClass"
activeTabStyleClass="standardActiveTabStyleClass"
activeSubStyleClass="standardActiveSubStyleClass"
tabContentStyleClass="standardTabContentStyleClass"
styleClass="standardPanelTabbedPaneClass">
<t:panelTab id="_302" label="Term" style="width:50px">
<h:panelGrid id="termPanel" columns="1" style="height:527px; width:970px">
<h:panelGroup>
</h:panelGroup>
</h:panelGrid>
</t:panelTab>
<t:panelTab id="_311" label="History" styleClass="standardPanelTabClass">
<h:panelGrid id="historyPanel" columns="1" style="height:527px; width:940px">
<h:panelGroup>
</h:panelGroup>
</h:panelGrid>
</t:panelTab>
</t:panelTabbedPane>
</h:form>
</f:view>
</BODY>
</HTML>
Hi,
if you see this in the CSS edior in JDeveloper 10.1.3 designtime then don't worry. This error is fixed in a not yet released version of JDeveloper 11, which has code sompletion and syntax help added. You can ignore the errors as they don't have an impact to the functionality at runtime
Frank
Similar Messages
-
Reg. JSF Spring Integration issue.
Hi All,
I am using JSF for the front end and using the Spring Core, DAO and AOP for the BO and DAO layers. When i try to inject the Objects using the DI to the JSF, i am getting the following error and the objects are not getting set from the Spring.
Error Log:*
javax.servlet.ServletException: Unable to create managed bean dataUploadControllerBean. The following problems were found:
- Bean or property class #{dataUploadVO} for managed bean dataUploadControllerBean cannot be found.
- Bean or property class #{dataUploadVO} for managed bean dataUploadControllerBean cannot be found.
- Bean or property class #{dataUploadVO} for managed bean dataUploadControllerBean cannot be found.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)
i have defined the respective entries correctly to integrate the JSF & Spring. But still the JSF&Spreing is not integrated successfully. Please find the configs defined and help to resolve the issue. i am stuck in this for 2 days...
Web.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/applicationContext.xml</param-value>
</context-param>
Faces-Config.xml
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> <!-- have used this ELResolver to injects objects from Spring-->
</application>
<managed-bean>
<managed-bean-name>dataUploadControllerBean</managed-bean-name>
<managed-bean-class>com.sgspace.model.dataupload.DataUploadControllerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>dataUploadBean</property-name>
<value>#{dataUploadBean}</value> _<!-- Already present in the faces-config.xml-->_ </managed-property>
<managed-property>
<property-name>dataUploadVO</property-name>
<property-class>#{dataUploadVO}</property-class> _<!-- Injected from Spring DI. This is currently not working.-->_
<value></value>
</managed-property>
<managed-property>
<property-name>dataUploadBO</property-name>
<property-class>#{dataUploadBO}</property-class>_<!-- Injected from Spring DI. This is currently not working.-->_ <value></value>
</managed-property>
</managed-bean>
applicationContext.xml:_
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="dataUploadDAO"
class="com.sgspace.dao.dataupload.DataUploadDAOImpl">
<property name="dataSource" ref="dataSource"></property>
</bean>
<bean id="dataUploadBO"
class="com.sgspace.bo.dataupload.DataUploadBOImpl">
<property name="dataUploadDAO" ref="dataUploadDAO"></property>
</bean>
<bean id="dataUploadVO" class="com.sgspace.vo.dataupload.DataUploadVO"></bean>
</beans>
Warm Regards,
Praveen SThe TestBean have a property for DeviceManager along with setter/getter methods as shown below. Sorry for not including in earlier posting
TestBean.java (Backing Bean)
private DeviceTypeManager deviceManager;
public DeviceTypeManager getDeviceManager() {
return deviceManager;
public void setDeviceManager(DeviceTypeManager deviceManager) {
this.deviceManager = deviceManager;
Here are the two scenarios
Scenario 1 : without <managed-property> the code works fine
Scenario 2 : with <managed-property> the code results in following error
javax.faces.FacesException: Cannot get value for expression '#{test.selectedDevice}'
Scenario 1 has only JSF whereas Scenario 2 has JSF-Spring integration
The Scenario 1 works absolutely fine as the expression '#{test.selectedDevice}' gets its value from setter/getter method in the backing bean(TestBean.java) . This is expected behaviour & wondering why it doesn't work similarly in Scenario 2 instead it complains
Cannot get value for expression '#{test.selectedDevice}'
I am willing to upload the war file. Any pointers/suggestions in resolving the error will be highly appreciated
Regards
Bansi -
hi,
when I try to run my firstjsf application it says the following error;
org.apache.jasper.JasperException: null(-1,-1) This absolute uri (http://java.sun.com/jsf/html) cannot be resolved in either web.xml or the jar files deployed with this application
I think, this error means that there is no mapping for the <tag-uri> to the "tld" file in web.xml, so
I copy the "html_basic.tld" and "jsf_core.tld" into my application path and map it in web.xml
still the same error occures... how to resolve this?
More question;
- I found that no uri mapping in web.xml file in the sample jsf pages provided by jsf-1.1 specification? Is this mapping is necessary one or not?
regards,
arun.I have resolved myself what i have asked before in this forum...
Actually the URL mapping to the TLD file is set in jsf-api.jar and jsf-impl.jar files, So no need to set the taglib mapping tags in "web.xml".
And I have tested my sample application both in Tomcat 4.1.x and Tomcat 5.0.x, it's works fine...
Any way thanks to this forum to expose various ways to identify the bugs when deploying JSF web application into the server.
- Arun. -
Reg. JSF fileUpload | issue with t:inputFileUpload tag
Hi,
i am new to JSF and i am trying a simple file upload function using the <t:inputFileUpload> tag. But iam always getting the error in JSP compilation. Please help in resolving this issue.
My project require to use to the Spring/JSF and i am using the following jar file in the WEB-INF/lib
aopalliance-1.0.jar
aopalliance-alpha1.jar
aspectjweaver-1.5.0.jar
cglib-nodep-2.2.jar
commons-beanutils-1.8.3.jar
commons-collections-2.0.20020914.020746.jar
commons-dbcp-1.2.2.jar
commons-digester-2.0.jar
commons-el.jar
commons-fileupload-1.1.1.jar
commons-lang-2.5.jar
commons-logging.jar
commons-pool-1.4.jar
javaee.jar
jsf-api.jar
jsf-impl.jar
jstl.jar
myfaces-extensions-1.0.9.jar
ojdbc14.jar
org.springframework.aop-3.0.2.RELEASE.jar
org.springframework.asm-3.0.2.RELEASE.jar
org.springframework.aspects-3.0.2.RELEASE.jar
org.springframework.beans-3.0.2.RELEASE.jar
org.springframework.context.support-3.0.2.RELEASE.jar
org.springframework.context-3.0.2.RELEASE.jar
org.springframework.core-3.0.2.RELEASE.jar
org.springframework.expression-3.0.2.RELEASE.jar
org.springframework.instrument.tomcat-3.0.2.RELEASE.jar
org.springframework.instrument-3.0.2.RELEASE.jar
org.springframework.jdbc-3.0.2.RELEASE.jar
org.springframework.jms-3.0.2.RELEASE.jar
org.springframework.orm-3.0.2.RELEASE.jar
org.springframework.oxm-3.0.2.RELEASE.jar
org.springframework.test-3.0.2.RELEASE.jar
org.springframework.transaction-3.0.2.RELEASE.jar
org.springframework.web.portlet-3.0.2.RELEASE.jar
org.springframework.web.servlet-3.0.2.RELEASE.jar
org.springframework.web.struts-3.0.2.RELEASE.jar
org.springframework.web-3.0.2.RELEASE.jar
spring-dao-2.0-rc1.jar
standard.jar
tiles-api-2.1.4.jar
tiles-core-2.1.4.jar
tiles-jsp-2.1.4.jar
tomahawk12-1.1.9.jar
Logs:
====
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 15 in the jsp file: /pages/dataupload/fileUpload.jsp
The method setValue(String) in the type UIComponentTagBase is not applicable for the arguments (JspValueExpression)
12: <body>
13: <f:view>
14: <h:form id="welcomeForm" enctype="multipart/form-data">
15: <t:inputFileUpload id="fileupload" value="#{fileUploadForm.upFile}"
16: size="20" /><p/>
17: <h:commandButton value="Load the file" action="#{fileUploadForm.upload}" />
18: <t:outputText value="File Uploaded Successfully."
An error occurred at line: 15 in the jsp file: /pages/dataupload/fileUpload.jsp
The method setSize(String) in the type HtmlInputFileUploadTag is not applicable for the arguments (JspValueExpression)
12: <body>
13: <f:view>
14: <h:form id="welcomeForm" enctype="multipart/form-data">
15: <t:inputFileUpload id="fileupload" value="#{fileUploadForm.upFile}"
16: size="20" /><p/>
17: <h:commandButton value="Load the file" action="#{fileUploadForm.upload}" />
18: <t:outputText value="File Uploaded Successfully."
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542)
org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:486)
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:337)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341)Hi,
But i have defined my upFile as a org.apache.myfaces.custom.fileupload.UploadedFile. So that i can use this object for retieving the uploaded file contents.
i am using JSF and tomahawk here to aceive that...but i am ending with the same error. please help.
Code for the File Upload:
===================
import java.io.IOException;
import java.io.InputStream;
import org.apache.myfaces.custom.fileupload.UploadedFile;
public class FileUploadForm {
private UploadedFile upFile;
boolean rendSuccess=false;
boolean rendFailure=false;
public FileUploadForm(){
public UploadedFile getUpFile(){
return upFile;
public void setUpFile(UploadedFile upFile){
this.upFile = upFile;
public boolean getRendSuccess(){
return rendSuccess;
public void setRendSuccess(boolean rendSuccess){
this.rendSuccess = rendSuccess;
public boolean getRendFailure(){
return rendFailure;
public void setRendFailure(boolean rendFailure){
this.rendFailure = rendFailure;
public String upload() throws IOException{
try {
InputStream stream = upFile.getInputStream();
long size = upFile.getSize();
byte [] buffer = new byte[(int)size];
stream.read(buffer, 0, (int)size);
stream.close();
rendSuccess=true;
rendFailure=false;
System.out.println("File Upload Successful.");
return "ok";
catch (Exception ioe) {
System.out.println("File Upload Unsuccessful.");
rendSuccess=false;
rendFailure=true;
return "no";
} -
Stange problem in deploying JSF application to weblogic 10
hi,OTN
I think this is the suitable forum for my problem,I had an ADF 10g application which I migrate to Jdeveloper 11g,I want to deploy it to A standalone weblogic server,so I made a Jar file for the model,Awar File for the viewController, and an ear file in the application Assembly of the ear File I check both the Archive and webapp,this is all the libraries which is selected for Deployment
JSF 1.2
JSTL 1.2
JSTL 1.2 Tags
BC4j Runtime
ADF Model Runtime
BC4J Tester
Oracle JDBC
BC4J Oracle Domains
MDS RunTime
MDS RunTime Dependencies
BC4J security
afc.jar
JSP RunTime
ADF Common RunTIme
ADF Faces Cache
ADF Controller RunTime
ADF Web RunTime
ADF Controller Schema
JPS Design Time
ADF Controller.jar
but when I Deploy the Ear File I got an exception
<Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'application20'
<Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: Failed to load webapp: 'Reg' at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:404)
at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:507
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41) Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: javax.faces.webapp.UIComponentTag
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:280)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:253)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
Truncated. see log file for complete stacktrace
>
there is a problem in the webapp for this class javax.faces.webapp.UIComponentTag ? How i can solve this?thanks for help,but I try and also got the same Error:
<10/10/2010 EET 08:50:26 ع> <Error> <HTTP> <BEA-101371> <There was a failure when processing annotations for application C:\Oracle\Middleware\user_projects\domains\base_domain\servers\AdminServer\tmp\_WL_user\application3\c2qh5c\webapp30.war. Please make sure that the annotations are valid. The error is >
<10/10/2010 EET 08:50:27 ع> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1286736611640' for task '0'. Error is: 'weblogic.application.ModuleException: Failed to load webapp: 'Reg''
weblogic.application.ModuleException: Failed to load webapp: 'Reg'
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:404)
Caused By: java.lang.ClassNotFoundException: javax.faces.webapp.UIComponentTag
also, I did not succeed to run it from my Integrated weblogic server see this
Re: Unable to find class oracle.adf.controller.faces.lifecycle.ADFPhaseListener
so I try to deploy it in a standalone weblogic but this different problem appear to me,I think all this problems because of migration ADF faces to Apache trinanad although I fixed all my code after migration and compile it without any problems.can I deploy my app to weblogic 10 from my Jdeveloper 10g without migrating my Application To Apache?
Edited by: Miar on Oct 10, 2010 12:12 PM -
JSF mapping missing. ExtensionsFilter not correctly configured.
I am new to JSF's and using JBoss 4.2.0 application server.
I trying to use <t:panelTabbedPane> and <t:panelTab> in my page like this:
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<t:panelTabbedPane id= "tbParticipant" selectedIndex = "0">
<t:panelTab id = "ptFirstName" label = "First Name"></t:panelTab>
<t:panelTab id = "ptLastName" label = "Last Name"></t:panelTab>
</t:panelTabbedPane>
When I open my page i get this error
ExtensionsFilter not correctly configured. JSF mapping missing. JSF pages not covered.
Please see: http://myfaces.apache.org/tomahawk/extensionsFilter.html
I have my web.xml configured exactlly as described at http://myfaces.apache.org/tomahawk/extensionsFilter.html
Actually I copied and paste the whole text word by word as shown below but still getting that error.
<filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<param-name>maxFileSize</param-name>
<param-value>20m</param-value>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
</init-param>
</filter>
<!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
Alternate mapping using a url-pattern instead of a servlet-name (you still need the /faces/myFacesExtensionResource/* mapping as well):
<!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
Please help and thank you in advance.Please post the configuration of the FacesServlet in the web.xml.
-
Dynamic tabs in Tomahawk panelTabbedPane
I want to create a t:panelTabbedPane with a dynamic number of tabs. It's quite straightforward if implemented in a backing bean:
<t:panelTabbedPane binding="#{MyBean.tabbedPane}"/>
public class MyBean {
public HtmlPanelTabbedPane getTabbedPane() {
HtmlPanelTabbedPane tabbed = new HtmlPanelTabbedPane();
//Loop as desired
HtmlPanelTab tab = new HtmlPanelTab();
tab.setLabel("My tab");
tab.setId("tab_0");
tabbed.getChildren().add(tab);
return tabbed;
}However, once I have my dynamically added tabs, I run into trouble when I want to populate them. Is there a convenient way to add JSF content to these tabs, defined using regular JSF tags? If not I guess I'll have to generate all the content using Java. I'm having a hard time finding much information about how to set values (EL expressions for example) and bindings for the components inside the tabs. Any ideas are appreciated!Once you are in the programmatic realm, I am not aware of a standard way to include components generated from a view representation like a JSP or Facelet file.
As to the EL expressions, use UIComponent.setValueExpression() along with Application.getExpressionFactory() and ExpressionFactory.createValueExpression(). For the action attribute of the command components, use UICommand.setActionExpression() and ExpressionFactory.createMethodExpression(). -
Problem in using Tomahawk 1.1.3 jar with jsf-api.jar & jsf-impl.jar
Hi All,
i am facing the problem while using <t:panelTabbedPane> in jsp.APplication has jsf-api.jar and jsf-impl.jar and Tomahawk 1.1.3 jar files in lib folder. This is a Portal Application.While deplyoing on portal server, i am getting following exception
Nested Exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/el/ELException
at org.apache.myfaces.shared_tomahawk.config.MyfacesConfig.<clinit>(MyfacesConfig.java:80).
if any faces problem previously, please help me out in debugging this issuePlease don't resurrect old topics. Start a new topic for each stand alone question. If necessary put links to the topics you found with search/google.
Back to the actual problem:java.lang.NoClassDefFoundError: javax/servlet/jsp/el/ELException The given class is missing in the classpath during runtime. Add that class, or at least the JAR file with that class, to the classpath of the runtime environment, then you're fine. -
How to determime active panelTab in t:panelTabbedPane in tomhack My faces
I have a requirement of finding out the tab which is active and set it to the hidden varaible pref Id.
To my knowledge I know I need to write a javascript fuinction onclick() in <t:panelTabbedPane>and capture the active form. As I am new to JSF I am pretty much confused how can I accompkis this task
using java script.
Any one can help me with peice of source code would be greatly helpful.
If there is any other approach also I would welcome
</f:view>
</head>
<body>
<h:form id="FilterReportOnlineForm">
<t:panelTabbedPane id="FilterPane" bgcolor="#FFFFCC" activeTabStyleClass="editorPane_activeTab" inactiveTabStyleClass="editorPane_inactiveTab" tabContentStyleClass="editorPane_tabContent">
<t:panelTab id="allResults" label="All Contacts" title="All Contacts" >
<jsp:include page="FilterAllReport.jsp"/>
</t:panelTab>
<t:panelTab id="emailResults" label="Email Contacts" title="Email Contacts" >
<jsp:include page="CzAnnmtFilterEmailReport.jsp"/>
</t:panelTab>
<t:panelTab id="faxResults" label="Fax Contacts" title="Fax Contacts" >
<jsp:include page="CzAnnmtFilterFaxReport.jsp"/>
</t:panelTab>
<t:panelTab id="hardcopyResults" label="Hardcopy Contacts" title="Hardcopy Contacts" >
<jsp:include page="CzAnnmtFilterHardcopyReport.jsp"/>
</t:panelTab>
</t:panelTabbedPane>
<h:inputHidden id="annmtId" value="#{announcementBackingBean.annmtId}"/>
<h:inputHidden id="prefId" value="ALL" />
</h:form>
</body>
</html>
</f:view>In the source pane on the left click on "faces"
You may want to watch the iphoto tutorials - https://ssl.apple.com/findouthow/photos/
LN -
Please help,
I have written a handful of custom validators and I'm having a small problem with them. For some reason the validator will not display there message in a <h:message> tag. They do however display in a <h:messages> tag as long as the globalOnly attribute is set to false. I'm guessing this is being caused by the fact that the validators are not being registered properly with their parent components. My question is how do I accomplish registering the validator correctly with its parent component.
Below is an example of one of the valiators and its use in the page.
<c:form validationType="Server">
<label>Phone Number</label>
<h:inputText id="PhoneNumber">
<c:validatePhoneNumber errorSummary="Please enter a valid Phone number" errorDetail="Blah"></c:validatePhoneNumber>
</h:inputText>
<h:message style="color: red" for="PhoneNumber" />
<h:commandButton value="Submit"></h:commandButton>
</c:form>
public class PhoneNumberValidatorTag extends ValidatorTag {
private static final long serialVersionUID = -3061371618875302020L;
private final String validatorId = "jsf.validators.PhoneNumber";
private String validationType;
private String validateAgainst = PhoneNumberValidator.US;
private String errorSummary = "";
protected String errorDetail = "";
public PhoneNumberValidatorTag() {
setValidatorId( validatorId );
public Validator createValidator() throws JspException {
PhoneNumberValidator validator = ( PhoneNumberValidator ) super
.createValidator( );
FacesContext context = FacesContext.getCurrentInstance( );
Application app = context.getApplication( );
Util.doAssert( null != validator );
UIComponentTag tag = UIComponentTag.getParentUIComponentTag( pageContext );
UIComponent component = tag.getComponentInstance( );
UIComponent parentForm = component;
while ( !( parentForm instanceof HtmlForm ) ) {
parentForm = parentForm.getParent( );
ValidationHtmlForm vhf = ( ValidationHtmlForm ) ( ( HtmlForm ) parentForm );
if ( "client".equalsIgnoreCase( vhf.getValidationType( ) ) ) {
validator.setServerValidate( false );
} else {
validator.setServerValidate( true );
if ( errorSummary != null ) {
if ( UIComponentTag.isValueReference( errorSummary ) ) {
validator.setErrorSummary( ( String ) app.createValueBinding(
errorSummary ).getValue( context ) );
} else {
validator.setErrorSummary( errorSummary );
if ( validateAgainst != null ) {
if ( UIComponentTag.isValueReference( validateAgainst ) ) {
validator.setErrorSummary( ( String ) app.createValueBinding(
validateAgainst ).getValue( context ) );
} else {
validator.setErrorSummary( validateAgainst );
return validator;
public void release()
super.release();
public int doEndTag() throws JspException {
FacesContext context = FacesContext.getCurrentInstance( );
ResponseWriter writer = context.getResponseWriter( );
try {
UIComponentTag tag = UIComponentTag.getParentUIComponentTag( pageContext );
UIComponent component = tag.getComponentInstance( );
UIComponent parentForm = component;
while ( !( parentForm instanceof HtmlForm ) ) {
parentForm = parentForm.getParent( );
ValidationHtmlForm vhf = ( ValidationHtmlForm ) parentForm;
if ( "client".equalsIgnoreCase( vhf.getValidationType( ) )
|| "both".equalsIgnoreCase( vhf.getValidationType( ) ) ) {
writer
.write( StringUtil
.format(
"<script language='JavaScript'>"
+ " formValidator.addValidator('{0}',new PhoneNumberValidator('{1}', PhoneNumberValidator.{2} ,'{3}'));"
+ "</script>", new Object[] {
parentForm.getClientId( context ),
component.getClientId( context ), validateAgainst,
errorSummary } ) );
} catch ( IOException e ) {
e.printStackTrace( );
return 1;
� Getters and Setters removed to shorten code
public class PhoneNumberValidator extends BaseValidator {
private static final long serialVersionUID = -1925668990356710828L;
public static final String US = "US";
public static final String INTERNATIONAL = "INTERNATIONAL";
public static HashMap REG = new HashMap( );
static{
REG.put( "US", "^\\(?\\d{3}\\)?(\\s|-)\\d{3}-\\d{4}$" );
REG.put( "INTERNATIONAL",
"^((\\+\\d(\\d)?)?(\\(\\d\\{3}?)))? \\d{3}?-\\d{4}$" );
public PhoneNumberValidator() {
super( );
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
if ( !serverValidate )
return;
if ( value == null )
return;
if ( context == null || component == null )
throw new NullPointerException( );
String regex;
if ( REG.containsKey( validateAgainst ) )
regex = ( String ) REG.get( validateAgainst );
else
regex = ( String ) REG.get( US );
Pattern pattern = Pattern.compile( regex );
if ( !"".equals( value.toString( ).trim( ) )
&& !pattern.matcher( value.toString( ).trim( ) ).matches( ) ) {
Object[] params = new Object[] { value };
Locale locale = context.getViewRoot( ).getLocale( );
String summary;
if ( errorSummary == null )
summary = Messages.getString(
"resource.ValidationMessages", "badPhoneNumber",
params );
else
summary = new MessageFormat( errorSummary, locale ).format( params );
String detail;
if ( errorDetail == null )
detail = Messages.getString(
"resource.ValidationMessages",
"badPhoneNumber_detail", params );
else
detail = new MessageFormat( errorDetail, locale ).format( params );
FacesMessage message = new FacesMessage( FacesMessage.SEVERITY_ERROR,
summary, detail );
throw new ValidatorException( message );
public String getJavaScript() {
� Method body removed to shorten post
}I probably should also mention I overrode the HtmlForm tag so I could add an attribute to the tag that allows the developer to specify client, server, or both when they are choosing the valiation type they want to use.
Thank you in advance for any help you can provide.
Grape ApeI do not think what you want to do is possible with the standard panelGrid. The panelGrid sees each child (of the panelGrid) as 1 component. The childrens children are considered a part of the child.
Heh, did I confuse you with that? You have probably already guessed that though.
At one time, I considered creating a custom component like yours. One that would just allow rendering of it's children or not. I decided that it was easier and better to add the rendered attribute to each of my other custom components (since the functionality is already supported by UIComponent). All you have to do is add the rendered attribute to your TLD doc for each custom component and your component can now use the "rendered" attribute. Oh, and you'll have to call super.setProperties() in the component tag.
All JSF standard components can use the rendered attribute.
Let me know if you'd like me to explain things better or post some code examples.
Hope this helps,
CowKing -
JSF layout driving me crazy!
I've been working hard on a jsf powered project manager and am running into some problems with IE compatability. I got everything aligned and positioned the way (more or less) I wanted it, but when I tested it against IE all hell broke loose (specifically with the dateInput component). I took a few screen shots to explain my problem...
What it looks like in Firefox: http://img6.imagepile.net/img6/91064firefox.png
What it looks like in IE: http://img6.imagepile.net/img6/76581ie.png
Each div outlined for refrence: http://img6.imagepile.net/img6/77815sh.png
(keep in mind the design is still in development)
CSS:
body {
padding: 1em;
font-family: georgia, times, "times new roman", serif;
color: #000;
img {
border:0px;
.container {
border: 1px solid #333;
overflow: auto;
.banner {
background-color: #666;
border-bottom: 1px solid #333;
.banner h1 {
margin: 0;
padding: .5em;
.side {
float: right;
margin-right: 2em;
padding-top: 1em;
padding-bottom: 1em;
overflow: auto;
height: 400px;
.sectionHeader {
text-align: center;
padding-bottom: 1em;
.side p {
margin-top: 0;
.content {
float: left;
margin-right: 1em;
padding-top: 1em;
padding-bottom: 1em;
margin-left: 2em;
overflow: auto;
height: 400px;
.content h2 {
margin-top: 0;
.footer {
clear: both;
background-color: #666;
text-align: center;
.pageHeader {
text-align: center;
padding-top: 1em;
}JSF Code:
<%@include file="WEB-INF/inc/imports.inc"%>
<html>
<head>
<title>LS Project Manager - Project Creation Wizard</title>
<link rel="stylesheet" href="css/master.css" type="text/css" />
<link rel="stylesheet" href="css/tabbedPane.css" type="text/css" />
</head>
<body>
<f:view>
<t:saveState value="#{pcwBacker}"/>
<t:div styleClass="container" id="container">
<%@include file="WEB-INF/inc/navigationbar.inc"%>
<t:div styleClass="pageHeader" id="pageHeader">
<t:outputText value="Project Creation Wizard"/>
</t:div>
<t:div styleClass="content">
<t:panelTabbedPane styleClass="tabbedPane"
activeTabStyleClass="activeTab"
inactiveTabStyleClass="inactiveTab"
disabledTabStyleClass="disabledTab"
activeSubStyleClass="activeSub"
inactiveSubStyleClass="inactiveSub"
tabContentStyleClass="tabContent"
serverSideTabSwitch="false"
selectedIndex="#{pcwBacker.currentIncompleteStep - 1}">
<h:form></h:form> <!-- Addresses weird bug. Do not remove! -->
<t:panelTab label="General Information">
<h:form>
<t:panelGrid columns="3">
<h:outputText value="Name: "/>
<h:inputText id="name" value="#{pcwBacker.name}" required="true" />
<t:message forceSpan="true" for="name"/>
<h:outputText value="Category:"/>
<h:selectOneMenu id="category" value="#{pcwBacker.category}" required="true">
<f:selectItems value="#{pcwBacker.categoryItems}"/>
</h:selectOneMenu>
<t:message forceSpan="true" for="category"/>
<h:outputText value="Status:"/>
<h:selectOneMenu id="status" value="#{pcwBacker.status}">
<f:selectItems value="#{pcwBacker.statusItems}"/>
</h:selectOneMenu>
<t:message forceSpan="true" for="status"/>
<h:outputText value="Phase: "/>
<h:selectOneMenu id="phase" value="#{pcwBacker.phase}">
<f:selectItems value="#{pcwBacker.phaseItems}"/>
</h:selectOneMenu>
<t:message forceSpan="true" for="phase"/>
<h:outputText value="Date Due: "/>
<t:inputDate id="date" type="full" value="#{pcwBacker.dueDate}" required="true"
popupCalendar="true"/>
<t:message forceSpan="true" for="date"/>
<t:commandButton action="#{pcwBacker.enableStepTwo}"
value="#{pcwBacker.completed ? 'Update' : 'Next Step'}"/>
</t:panelGrid>
</h:form>
</t:panelTab>
<t:panelTab rendered="#{pcwBacker.stepTwoEnabled}" label="People Involved">
<h:form>
<t:panelGrid columns="3">
<h:outputText value="Leader: "/>
<h:selectOneMenu id="leader" value="#{pcwBacker.leaderId}" required="true">
<f:selectItems value="#{pcwBacker.workerItems}"/>
</h:selectOneMenu>
<t:message for="leader" forceSpan="true"/>
<h:outputText value="Assignees: "/>
<s:selectManyPicklist id="assignees" value="#{pcwBacker.assignees}" size="5">
<f:selectItems value="#{pcwBacker.workerItems}"/>
</s:selectManyPicklist>
<t:message for="assignees" forceSpan="true"/>
<t:commandButton action="#{pcwBacker.enableStepThree}"
value="#{pcwBacker.completed ? 'Update' : 'Next Step'}"/>
</t:panelGrid>
</h:form>
</t:panelTab>
<t:panelTab rendered="#{pcwBacker.stepThreeEnabled}" label="Project Description">
<h:form>
<t:panelGrid columns="2">
<t:inputText/>
<t:commandButton action="#{pcwBacker.enableFinalStep}"
value="#{pcwBacker.completed ? 'Update' : 'Next Step'}"/>
</t:panelGrid>
</h:form>
</t:panelTab>
<t:panelTab rendered="#{pcwBacker.finalStepEnabled}" label="Final">
<h:form>
<t:panelGrid columns="2">
<t:inputText/><t:commandButton/>
</t:panelGrid>
</h:form>
</t:panelTab>
</t:panelTabbedPane>
</t:div>
<t:div styleClass="side">
<t:div styleClass="sectionHeader">
<t:outputText value="Summery"/>
</t:div>
<t:panelGrid columns="2" cellpadding="10px">
<t:outputText value="Name: #{pcwBacker.name}" rendered="#{pcwBacker.name != null}"/>
<t:outputText value="Status: #{pcwBacker.statusDesc}" rendered="#{pcwBacker.status != null}"/>
<t:outputText value="Phase: #{pcwBacker.phaseDesc}" rendered="#{pcwBacker.phase != null}"/>
<t:outputText value="Category: #{pcwBacker.categoryDesc}" rendered="#{pcwBacker.phase != null}"/>
<t:outputText value="Date Due: #{pcwBacker.dueDate}"/>
</t:panelGrid>
<h:outputText value="Assignees"/>
<t:dataList var="assignee" value="#{pcwBacker.assignees}">
<t:htmlTag value="li">
<t:outputText value="#{pcwBacker.names[assignee]}"/>
</t:htmlTag>
</t:dataList>
</t:div>
</t:div>
</f:view>
</body>
</html>The main focus: getting the inputDate working, the border around the container stretching, and not have one div fall beneath another or overlap when the window is resized.
Any help would be endlessly appreciated. Thank you!
Message was edited by:
octoberdanielThank you for the help. I got everything working with:
body {
padding: 1em;
font-family: georgia, times, "times new roman", serif;
color: #000;
img {
border:0px;
.container {
width: 1000px;
margin: 0 auto;
border: 1px solid #333;
.banner {
border-bottom: 1px solid #333;
.banner h1 {
margin: 0;
padding: .5em;
.side {
width: 400px;
float: right;
padding: 1em;
overflow: auto;
height: 400px;
.sectionHeader {
text-align: center;
padding-bottom: 1em;
.side p {
margin-top: 0;
.content {
position: absolute;
padding: 1em;
overflow: auto;
height: 400px;
.content h2 {
margin-top: 0;
.footer {
clear: both;
background-color: #666;
text-align: center;
.pageHeader {
text-align: center;
padding-top: 1em;
Forgeting a doctype also messed some stuff up...
but I am still having trouble with my calander popup... Any idea?
Message was edited by:
octoberdaniel -
I'm using JSF Tomahawk tabbedPane... to get the tabs... I have the commandbutton inside each t:panelTab whwn i click dat commandbutton, the action it is supposed to perform is done but it shows the first tab contents..
for ex if i have commandbutton in second tab wen i click it performs correctly but first tab becomes active... i want dat particular tab to be active in which user has clicked commandbutton hw shall i do it...
<t:panelTabbedPane id="editorPanel" >
<t:panelTab id="tab11" label="Tab1" >
<h:commandbutton action="" />
</t:panelTab>
<t:panelTab id="tab22" label="Tab2" >
<h:commandbutton action="" />
</t:panelTab>
</t:paneltabbedPane>Thanks BalusC . Let me re iterate my question. I am new to JSF to pardon me if my terminology is not correct.
I have a list which contains object .I have to generate tabs based on contents on list. So if list contain 3 objects I have to generate 3 tabs . Each page inside tab will have same layout but will be populated with different content.
With that said. I used jsf pane_tab and I tried different ways to iterate over the list and include the jsp which will contain the layout. More specifically I tried something like below with different variations .
<%
for (int i = 0 ; i< list.size() ; i++)
String abc = "name"+ i;
%>
<d:pane_tab id="<%= abc %>" >
<f:facet name="label">
<d:pane_tablabel label="test" commandName="third"/>
</f:facet>
<jsp:include page="addMaintenence.jsp"/>
</d:pane_tab>
<%
%>
It gives duplicate id error. Now I am not sure if my approach is right or not. Also if it not correct what should I try ??
Any pointers would be helpful.
Thanks in advance.
Priyanka -
Multiple row tabs in panelTabbedPane
Hi,
Can anyone help me how can I get multiple row tabs in <t:panelTabbedPane>. I have 10 tabs and I need to put first five tabs in first row and next 5 tabs in second row.
Thanks in advance.
-MahiYou could possibly get better replies in the JSF forum. However, you can try something similar to
<h:panelGrid columns="1">
<t:panelTabbedPane>
</t:panelTabbedPane>
<t:panelTabbedPane>
</t:panelTabbedPane>
</h:panelGrid>Use two t:panelTabbedPane for 5 tabs each within a panelgrid with a single column. This should put each of the tabbed panes in a row each. -
Tomahawk panelTabbedPane Styles
Hello
I tried specifying CSS style info for activeTabStyleClass and inactiveTabStyleClass, and strangely I could change the tab label background color but not the font/size/color of the text. I have seen in the generated html that is part of a text input, but can not find how to change the format of this. (when the tab is inactive the text appears within a gray rectangle)
Does anyone know how to change the style of this componentent?
the code is:
<t:panelTabbedPane serverSideTabSwitch="false" selectedIndex="#{menu.focusIndex}"
activeTabStyleClass="activeTab"
inactiveTabStyleClass="inactiveTab"
tabContentStyleClass="tabxwip"
>
<t:panelTab id="tab1" label="Config">
<h:panelGrid id="up" columns="2" styleClass="tabGrid">
...and the css
.activeTab {
background-color: white;
width: 120px;
font-size: 100%;
padding: 20px;
text-align: center;
font-weight: bold;
height: 20px;
.inactiveTab {
background-color: #A1045F;
width: 120px;
font-size: 100%;
padding: 20px;
height: 20px;
text-align: center;
font-weight: bold;
.tabGrid {
width: 1024px;
border: 3px;
}Posting JSF source code instead of the generated HTML code doesn't help much in solving CSS (and JS) problems. And if you do so, better use a CSS forum instead of a JSF forum.
-
Tomahawk , panelTabbedPane problem...
Hi,
i am working with tabbedpane control of tomahawk, when i am including a plain jsp page like ....
<t:panelTabbedPane serverSideTabSwitch="false">
<t:panelTab id="tab1" label="TabbedPanel1">
<f:verbatim><jsp:include page="profile.jsp"/> </f:verbatim>
</t:panelTab>it is working fine. but when i try to include a jsf page , which has taglib directives to include core and html components of jsf, it is giving error on server console as well on browser also...
stack trace ...
2007-07-27 16:15:50,421 ERROR [org.apache.myfaces.taglib.core.ViewTag] Error writing endDocument
java.io.IOException: Illegal to flush within a custom tag
at javax.servlet.jsp.tagext.BodyContent.flush(BodyContent.java:79)
at javax.faces.webapp._PageContextOutWriter.flush(_PageContextOutWriter.java:45)Help me to solve this issue....
Thanks in advance...Hi...Thanks for reply...
i tried flush attribute...but no use...
i tried removing verbatim , it is not even showing the plain jsp page also.... i think may be there is a problem with @taglib....
i had to include those files in the main file as well in profile file as i am using some members of those taglibraries in both the files....
any other suggestion....
Maybe you are looking for
-
Dunning letter print out error?
Hi anybody, I am using F150 for print dunning letters more than one customers. But I click "Sample printout" then i give printer name ,customer ID'S and click print immediately. but the dunning letters not printed. i want print more than one custome
-
Just Updated iTunes - No Longer Able to Convert Apple Lossless Format
I just installed the newest version of iTunes, version 9.1.0.79. I have a bunch of songs in the lossless .m4a format and I would like to convert them (or at least create versions of them) that are in mp3 format. The simple right click menu in the new
-
Nothing works when i try to install adobe air. :(
Whenever I install Adobe Air I always get this error. "An error occurred while installing Adobe AIR. Installation may not be allowed by your administrator. Please contact your administrator." I am the administrator and did the run as adminstrator opt
-
I accidently deleted the "All Photos" folder, and when I clicked undo it didn't come back. I searched all the menu's but I can't find out how to replace the folder. Thanks!
-
i hit the clear setting and content on my phone and now my phone is stuck on the apple sign and wont turn on or off