Problem in JSF tag h:selectOneMenu
i am getting an error
javax.servlet.ServletException: Value binding '#{DealerDetails.repIndicator}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dealer_Details.jsp][Class: javax.faces.component.html.HtmlForm,Id: Dealer][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _idJsp21][Class: javax.faces.component.UISelectItems,Id: _idJsp22]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
root cause
javax.faces.FacesException: Value binding '#{DealerDetails.repIndicator}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dealer_Details.jsp][Class: javax.faces.component.html.HtmlForm,Id: Dealer][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _idJsp21][Class: javax.faces.component.UISelectItems,Id: _idJsp22]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
de.mindmatters.faces.lifecycle.ProcessValidationsPhase.executePhase(ProcessValidationsPhase.java:48)
de.mindmatters.faces.lifecycle.AbstractPhase.execute(AbstractPhase.java:37)
de.mindmatters.faces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:166)
de.mindmatters.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:211)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
My code in the bean is ...
SelectItem[] repIndicator;
public SelectItem[] getRepIndicator() {
return repIndicator;
public void setRepIndicator(SelectItem[] repIndicator) {
this.repIndicator = repIndicator;
My JSP page code
<h:selectOneMenu value="#DealerDetails.dealerRecycledRepIndicator}" >
<f:selectItems value="#DealerDetails.repIndicator}"/>
</h:selectOneMenu>
nw the value in the variable repIndicator is not null... but when i press submit button... then the error above comes i dnt understand why.. the data type of repIndicator is selectType
Try the following forum (about JSF technology)
http://forum.java.sun.com/forum.jspa?forumID=427
Similar Messages
-
I am a beginner to JSF , I am getting the following error when I try to invoke using the following URL
http://localhost:8080/Loginjsf/
I have copied web.xml,faces-config.xml,index.jsp, userLogin.jsp and also the list of jars I am using.
java version I am using jdk1.5.0_14
tomcat version 5.5.25
JSF Version 1.1_01
---------------------------------------------------------------------this is the error------------------------------------------------------------------
exception
org.apache.jasper.JasperException: Exception in JSP: /index.jsp:7
4: </head>
5: <body>
6: </body>
7: <jsp:forward page="userLogin.jsp"></jsp:forward>
8: </html>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
org.apache.jasper.JasperException: Exception in JSP: /userLogin.jsp:15
12: </head>
13:
14: <body>
15: <f:view>
16: <h:form id="UserName">
17: <f:loadBundle basename ="com.demo.MessageBundle" var="bundle"/> <br>
18: <h:inputText></h:inputText>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:686)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:656)
org.apache.jsp.index_jsp._jspService(index_jsp.java:50)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: Cannot find FacesContext
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.userLogin_jsp._jspService(userLogin_jsp.java:92)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:686)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:656)
org.apache.jsp.index_jsp._jspService(index_jsp.java:50)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.jsp.JspException: Cannot find FacesContext
javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:399)
com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:105)
org.apache.jsp.userLogin_jsp._jspx_meth_f_005fview_005f0(userLogin_jsp.java:107)
org.apache.jsp.userLogin_jsp._jspService(userLogin_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:686)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:656)
org.apache.jsp.index_jsp._jspService(index_jsp.java:50)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
THE WEB.XML FILE I AM USING IS
The web.xml, faces-config.xml files which I am using ,
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
<description>
Set this flag to true if you want the JavaServer Faces
Reference Implementation to validate the XML in your
faces-config.xml resources against the DTD. Default
value is false.
</description>
</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>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--Tomcat 5 Workaround: Listener used to initialize JSF on startup-->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
</web-app>
THE FACES-CONFIG.XML I AM USING
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config >
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
<managed-bean>
<managed-bean-name>UserBean</managed-bean-name>
<managed-bean-class>com.demo.bean.UserBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>userName</property-name>
<property-class>java.lang.String</property-class>
<value></value>
</managed-property>
<managed-property>
<property-name>password</property-name>
<property-class>java.lang.String</property-class>
<value></value>
</managed-property>
</managed-bean>
<navigation-rule>
<from-view-id>/userLogin.jsp</from-view-id>
<navigation-case><from-outcome>failure</from-outcome>
<to-view-id>/loginForm.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>success</from-action>
<to-view-id>/userLoginSuccess.jsp</to-view-id>
</navigation-case></navigation-rule>
<navigation-rule>
<from-view-id>/userLoginSuccess.jsp</from-view-id>
</navigation-rule>
<navigation-rule>
<from-view-id>/loginForm.jsp</from-view-id>
</navigation-rule>
</faces-config>
THE INDEX.JSP I AM USING
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
</head>
<body>
</body>
<jsp:forward page="userLogin.jsp"></jsp:forward>
</html>
THE USERLOGIN.JSP is
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/html_basic.tld" prefix="h"%>
<%@ taglib uri="/WEB-INF/jsf_core.tld" prefix="f"%>
<html>
<head>
<title>My JSF 'userLogin' starting page</title>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<f:view>
<h:form id="UserName">
<f:loadBundle basename ="com.demo.MessageBundle" var="bundle"/> <br>
<h:inputText></h:inputText>
<h:outputLabel value="UserName"></h:outputLabel>
<h:inputText></h:inputText>
<h:outputLabel for="Password" value="Password" id="Password"></h:outputLabel>
</h:form>
</f:view>
</body>
</html>
THE JAR FILES LOCATED AT tomcat-5.5\webapps\Loginjsf\WEB-INF\lib
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-logging.jar
el-api.jar
el-ri.jar
jsf-api.jar
jsf-facelets.jar
jsf-impl.jar
jstl.jar
standard.jar
It would be great if you could help me in resolving this problem, what is that I am doing wrong?Thanks for your suggestions, I updated the web.xml and index.jsp accordingly but this time I am getting a different kind of error as below
org.apache.jasper.JasperException: Exception in JSP: /index.jsp:6
3: <head>
4: </head>
5: <body>
6: <jsp:forward page="userLogin.faces"></jsp:forward>
7: </body>
8: </html>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: Error Parsing /userLogin.jsp: Error Traced[line: 1] The markup in the document preceding the root element must be well-formed.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:202)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:686)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:656)
org.apache.jsp.index_jsp._jspService(index_jsp.java:49)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
com.sun.facelets.FaceletException: Error Parsing /userLogin.jsp: Error Traced[line: 1] The markup in the document preceding the root element must be well-formed.
com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
com.sun.facelets.compiler.Compiler.compile(Compiler.java:105)
com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:197)
com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:144)
com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:95)
com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:496)
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:546)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:686)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:656)
org.apache.jsp.index_jsp._jspService(index_jsp.java:49)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) -
JSP ${} expressions in JSF tag attributes
Does anyone know why the expert group decided not to allow ${} style expressions within JSF tag attributes? I understand that a different syntax is needed to implement the 'late binding' #{} expressions used to link input controls to form beans, but not why the JSF tags actually prevent the use of immediately evaluated ${} expressions for accessing variables in the page scope in JSP 2.0.
I know there has been a lot of discussion about this and other threads mention a security loophole that would be opened up by allowing expressions like #{blah.${someProperty}}, but I'm not sure why this sort of thing would cause a problem. Is there any way to enable this behaviour, such as editing the JSF tag library descriptors to allow runtime expressions (horrible though that sounds)? Or perhaps another JSF implementation that supports both immediately evaluated and late-binding expressions? It seems a rather unnecessary restriction that is going to cause much confusion and mistyping for all...
Thanks in advance,
Keith.Thanks Adam, I see the problem now. It's a fairly obscure loophole but serious nonetheless. Of course, this problem could also be avoided by not using request parameters within JSF tags as it doesn't affect the majority of legitimate uses for expressions.
I have to disagree with you about mixing ${} and #{} expressions though. The majority of developers will be used to writing ${} expressions in JSTL and JSP text and so will expect them to do work the same in JSF tags. Judging by the number of posts in this forum about being unable to use page scope variables in JSF tags this issue is already confusing a lot of people.
As a rule of thumb, "use ${} for expressions that are output to the page and #{} for binding controls to backing beans and invoking methods" (which perform clearly distinct functions) is a lot simpler and easier to learn IMHO than the current one, which is "use ${} for expressions that are output to the page except within a JSF tag, where you use #{} for the same thing and also to update form values and invoke action methods"! (OK, I'm exaggerating a little for effect, but you get the point... :-)
I agree that mixing both types of expression in the same attribute might be a little confusing, but this is an unlikely edge case that should probably be prevented in value binding or action attributes anyway. It's more of an issue for label values where mistyping one for the other is already very common and, although not especially difficult to debug, is just another pitfall awaiting the unwary JSP developer. I'm not sure that JSP expressions would be much more difficult to debug anyway as the value and method bindings will simply not work, which is pretty obvious as soon as you try and test the thing.
Is this something that the EG would be prepared to reconsider for the next release of JSF, or perhaps getting the security loophole addressed in the next JSP spec? In the meantime, is there any reason that developers shouldn't enable runtime expressions in the TLD file provided that they're willing to live with the consequences?
(Sorry to harp on about it, but I've already had several complaints about this after recommending JavaServer Faces for a major development project at ingenta.com.)
Many thanks,
Keith. -
Exception when running JSF Tags
Hi,
I am using MyEclipse 5.0.1 GA and jboss-4.0.3SP1. I am trying out a small JSF tag where the command button is not getting displayed and if i click the refresh button three i am getting this error. could anyone tell me what exactly the problem is.
Exception
org.apache.jasper.JasperException: /one.jsp(11,4) No tag "form" defined in tag library imported with prefix "f"
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:196)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1308)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1564)
org.apache.jasper.compiler.Parser.parseBody(Parser.java:1793)
org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1060)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1367)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1564)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
one.jsp
<%@ page contentType="text/html" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html>
<body>
This is my JSF page. <br>
<f:view>
<f:form>
<h:commandButton id="cmd" action="" value="Submit" />
</f:form>
</f:view>
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
</web-app>
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config >
<application></application></faces-config>No tag "form" defined in tag library imported with prefix "f"This error is clear and correct: the tag library defined with the prefix f does not have a tag named form. So you cannot use <f:form>. Likely you intended <h:form>.
-
Problem identified jsf component and problem of checkboxs
hello,
i have 2 questions:
- 1
I have a js function that show/don't show a tab when we chose yes/no on a SelectOneRadio:
function display(fieldRadio,tabtohide)
div = document.getElementById(tabtohide);
if(fieldradio.value=='false')
div.className='hide';
else div.className='';
I call this function in the radio component, like this:
onclick="display(this,'tabid');" and it works very well.
The problem is that i would like to replace 'this' by the id of the component (to call this function at another place).
I'v tried the document.getElementById(JsfTagId); but it doesn't work with jsf tag.
- 2
I use a selectmanycheckbox like this:
<h:selectManyCheckbox value="#{BeanDemandeur.type}" required="false">
<f:selectItem itemValue="Nouvelleinstallation" itemLabel="Nouvelle installation"/>
<f:selectItem itemValue="Mise�jour" itemLabel="Mise � jour"/>
<f:attribute name="fieldRef" value="Type de demande"/>
</h:selectManyCheckbox>
In the bean, i use the variable type like this:
private String[] type = new String[2];
public String[] getType(){return type;}
public void setType(String[] rr){type[0]=rr[0];type[1]=rr[1];}
And finally, in th faces-config.xml:
<managed-property>
<property-name>type</property-name>
<property-class>java.lang.String[]</property-class>
<value/>
</managed-property>
But an error occured: Can't set managed bean property:'type';
thx u for your helpr u getting any connversion error !
what is the error ru getting when u run the code -
JSF tags are not rendered in error page
I have configured error page for HTTP 404 error in web.xml like this
<error-page>
<error-code>404</error-code>
<location>/Common/error.jspx</location>
</error-page>
Faces Servlet is configured as follows
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
My error page (error.jspx) looks like this
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad" xmlns:c="http://java.sun.com/jsp/jstl/core">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<html>
<head>
<title>Error Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body id="b1">
<h4 style="color:red">An Error Occured. Please click Back button or Signout.</h4>
<input type="button" value="Back" onclick="history.back()"/>
<tr:commandButton id="cb1" text="SIGN OUT" action="exit" actionListener="#{Login.LogOut}"/>
</body>
</html>
</jsp:root>
When I deploy application and run into 404 error, page displays error message with only Back button. I don't see SingOut button. I have checked url and it follows /faces/* pattern. Still to double check, I made a change and configured servlet mapping in web.xml as
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
Still commandButton is not rendered. I understand that my error page don't have access to FacesContext or not going through Faces Servlet. I know this is a small issue, but couldn't figure out what can be done. I have also tried using .xhtml and .jsf as per googled suggestion. But no luck
I have tried different solutions to my problem and googled for solutions. But I couldn't get it resolved.
So can you please provide any suggestions...
Edited by: user1818355 on May 22, 2013 2:29 PMI think my faces servlet is configured to handle URLs having /faces/* pattern. I don't have any folder named with faces but I can access all my web pages which have /faces/ in their url. All jspx pages in application are configured in task flows. So I think they have access in FacesContext. But error page is configured in only web.xml and some how it is missing access to FacesContext and not rendering JSF tags. Any help?
-
Hi,
I'm trying to replace a <h:inputText> by my own tag. The used HtmlInputText component should not be replaced.
The reason is, that i want to pass permissions to the tag and map them to readonly and rendered attributes. My Problem is, that my own tag doesn't reolv bean values. If i use the <h:inputText> the bean values show up correctly. If i use my own tag, the input text shows "#{myBean.value}".
What could be the problem?
Thx in advance
Henrik
Here is my tag:
import javax.faces.component.UIComponent;
import javax.faces.component.html.HtmlInputText;
import javax.faces.context.FacesContext;
import javax.faces.webapp.UIComponentTag;
import com.arvato.jsf.security.JSFSecurity;
import com.arvato.jsf.security.Permissions;
import com.sun.faces.taglib.html_basic.InputTextTag;
public class ArvatoTextFieldTag extends InputTextTag {
private String role;
private String onkeypress;
private String id;
private String value;
public String getRole() {
return role;
public void setRole(String permissions) {
this.role = permissions;
protected void setProperties(UIComponent component) {
super.setProperties(component);
if(id != null) {
component.getAttributes().put("id", id);
if(onkeypress != null) {
component.getAttributes().put("onkeypress", onkeypress);
if(value != null) {
component.getAttributes().put("value", value);
if(role != null) {
FacesContext facesContext = FacesContext.getCurrentInstance();
Permissions p = JSFSecurity.getInstance().getPermissionsForRole(role, facesContext);
if(!p.isWritable()) {
component.getAttributes().put("readonly", true);
if(!p.isReadable()) {
component.getAttributes().put("rendered", false);
} else {
component.getAttributes().put("readonly", false);
component.getAttributes().put("rendered", true);
@Override
public String getComponentType() {
return "javax.faces.HtmlInputText";
@Override
public String getRendererType() {
return null; // no standalone renderer
@Override
public void release() {
super.release();
role = null;
public String getValue() {
return value;
public void setValue(String value) {
this.value = value;
public String getOnkeypress() {
return onkeypress;
public void setOnkeypress(String onkeypress) {
this.onkeypress = onkeypress;
public String getId() {
return id;
public void setId(String id) {
this.id = id;
}and my tld definition:
<taglib>
<tlib-version>0.03</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>arvato-jsf</short-name>
<uri>http://arvato.com/jsf/component/tags</uri>
<description>Arvato JSF tags</description>
<tag>
<name>textfield</name>
<tag-class>com.arvato.jsf.tag.ArvatoTextFieldTag</tag-class>
<attribute>
<name>id</name>
</attribute>
<attribute>
<name>role</name>
</attribute>
<attribute>
<name>value</name>
</attribute>
<attribute>
<name>onkeypress</name>
</attribute>
</tag>
</taglib>In the setProperties method, you've got to resolve the valuebinding (#{blah.whatever}) to get the actual value. But you only want to do that if the attribute is set to a valuebinding.
Here's an example:
* @see javax.faces.webapp.UIComponentTag#setProperties(UIComponent)
protected void setProperties(UIComponent component) {
super.setProperties(component);
//Set the field reference property
if (fieldRef != null) {
if (UIComponentTag.isValueReference(fieldRef)) {
ValueBinding vb = getFacesContext().getApplication().
createValueBinding(fieldRef);
component.setValueBinding("fieldRef", vb);
} else {
component.getAttributes().put("fieldRef", fieldRef);
}This example shows how to determine if the "fieldRef" attribute is a value binding, and extracts the value accordingly. But there's one more step. In your component class, or anywhere you access the attributes of your custom tag, use the following code:
public String getFieldRef() {
if (fieldRef != null)
return fieldRef;
ValueBinding vb = getValueBinding("fieldRef");
if (vb != null)
return (String)vb.getValue(getFacesContext());
else
return null;
}The above snippet is what you would put in your custom component getter method.
JSF is open source. Something I found very helpful while learning how to create custom components was looking at how the JSF developers created theirs. You should go ahead and download the JSF source code.
CowKing -
Hi, Im new to JSF and Facelets, I faced some problems in fragement tag when i was desigining my page, here is the code,
<s:fragment rendered="#{show eq 'true'}">
<ui:param name="currency" value="true"/>
</s:fragment>
<s:fragment rendered="#{show eq 'false'}">
<ui:param name="currency" value="false"/>
</s:fragment>
<h:outputText value="#{currency}}/>
Here, i can pass show value from another .xhtml page. If the first condition is satisfied it will print true, if the second condition satisfied expect to print false. But my code only print "false". Eventhoug its satisfied first condition, it will print "false". If i give <h:outputText value="#{currency}}/> within the fragment tag it works fine as I expect. I need helps.
thanks
Rajesh
Message was edited by:
rajeshkumar.b
Message was edited by:
rajeshkumar.bTrying
<description><![CDATA[About 4 PM , March 31,1917.
The salute from the Fort Christian’s Saluting Battery as
the Captain and officers leave the USS Hancock on their way to
shore to take over the Danish West
Indies.]]></description>
This fixes the
onmouseover="ShowToolTip('{dsPhotos::description}') problem,
BUT
<p>{dsPhotos::description}</p>
now appears as
'About 4 PM , March 31,1917. The salute from the Fort
Christian’s Saluting ..."
with the undesireable ’ instead of '.
So my problem requires both html translation and javascript
argument quoting/non-parsing.
Any ideas? -
Problems in JSF t:commandlink
Hello,
I am facing a problem with JSF Command link
I have three JSP pages with one backing bean in session scope.The property defined in the backing bean is an Object type which contains fields mapped to the database.
The navigation between pages is through hyperlinks.
I enter data on page 1 and move to page 2.Again due to some reasons if I come back to first page I dont see values restored on the textfields on page 1.It is again reset when page 1 loads.I have to restore values and I have to do it using command links.I do not want button to navigate between two pages.
How can I restore data
I set the data on textfields as #{BackingBean.property.property_field}
I am new to JSF.can anyone suggest how to restore values while navigating.
[email protected]
Thankyou,
Pankaj Shirkeon the commandLink tag are you using the immediate = "ture" if so remove it or set it to false
-
I have a problem with using expressions in jsf tags! I know this
topic was discussed before but it doesn`t work.
I want to use the following jsf-code:
<h:panel_data id="tab" var="vari" modelReference="Bean.varis">
<h:output_text id="Id" modelReference="vari.id"/>
<h:command_hyperlink id="hyper" href="next.jsp" label="Detail">
<f:parameter id="Param1" name="id" value="vari.id"/>
</h:command_hyperlink>
</h:panel_data>
The value of the parameter should have the value of vari.id!! Why doesn`t it work?? I also tried to use value="${vari.id}" and value=<%= vari.id %>.
I have also changed the jsf_core.tld from
<rtexprvalue>false</rtexprvalue>
to
<rtexprvalue>true</rtexprvalue>
Does anybody know what to do? Where should the .tld-files be localized when i deploy the webapplication??On May 19th, 2003 HydraD == "HD" wrote:
HD> I have a problem with using expressions in jsf tags! I
HD> know this
HD> topic was discussed before but it doesn`t work.
HD>
HD> I want to use the following jsf-code:
HD>
HD> <h:panel_data id="tab" var="vari" modelReference="Bean.varis">
HD> <h:output_text id="Id" modelReference="vari.id"/>
HD> ...
HD> <h:command_hyperlink id="hyper" href="next.jsp" label="Detail">
HD> <f:parameter id="Param1" name="id" value="vari.id"/>
HD> </h:command_hyperlink>
HD> </h:panel_data>
HD>
HD> The value of the parameter should have the value of
HD> vari.id!! Why doesn`t it work?? I also tried to use
HD> value="${vari.id}" and value=<%= vari.id %>.
HD>
HD> I have also changed the jsf_core.tld from
HD> <rtexprvalue>false</rtexprvalue>
HD> to
HD> <rtexprvalue>true</rtexprvalue>
HD>
HD> Does anybody know what to do? Where should the
HD> .tld-files be localized when i deploy the
HD> webapplication??
If you want your parameter's value to be pulled from the model, you must
use modelReference instead of value. Try that and see if it works.
Ed -
Unable to view jsp page containing jsf tags
I'm pretty new to this JSF world, so facing lot of problems. I have installed JWSDP ver 1.2 When I start tomcat and specify URL http://localhost:8080 the site goes in waiting phase for ever. So even I'm not able to view/run the samples provided for jsf.
Moreover, i have created a simple appln to test jsf tag, but it's giving following error:
javax.servlet.ServletException: This absolute uri (http://java.sun.com/jsf/core) cannot be resolved in either web.xml or the jar files deployed with this application
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:207)
I don't know where the problem is. The code for sample i have downloaded from http://www.horstmann.com/corejsf/tutorial.html
but with no success in running jsf app.
anyone know the reason, why??
Thanx in Advance,
K.K.Roger, here are the contents of log file.
Here goes the contents of launcher.server.log :
Sep 17, 2003 10:25:07 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 921
Sep 17, 2003 10:25:07 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 171
Sep 17, 2003 10:25:08 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 781
Sep 17, 2003 10:25:08 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 200
Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 190
Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 71
Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 80
Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 290
Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 110
Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 50
Sep 17, 2003 10:25:10 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 341
Sep 17, 2003 10:25:10 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 170
Sep 17, 2003 10:25:10 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
INFO: Reading descriptors ( dom ) 90
Sep 17, 2003 10:25:12 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 8080
Sep 17, 2003 10:25:12 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 6670 ms
Sep 17, 2003 10:25:14 AM org.apache.catalina.core.StandardService start
INFO: Starting service Java Web Services Developer Pack
Sep 17, 2003 10:25:14 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Java Web Services Developer Pack/1.2
Sep 17, 2003 10:25:15 AM org.apache.catalina.core.StandardHost getDeployer
INFO: Create Host deployer for direct deployment ( non-jmx )
Sep 17, 2003 10:25:46 AM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Sep 17, 2003 10:25:46 AM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Sep 17, 2003 10:26:15 AM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', returnNull=true
Sep 17, 2003 10:26:24 AM com.sun.xml.rpc.server.http.JAXRPCContextListener contextInitialized
INFO: JAX-RPC context listener initializing
Sep 17, 2003 10:26:26 AM com.sun.xml.rpc.server.http.JAXRPCServletDelegate init
INFO: JAX-RPC servlet initializing
And here the contents of jwsdp_log :
2003-09-17 10:25:14 createObjectName with StandardEngine[Catalina]
2003-09-17 10:25:14 preRegister with Catalina:type=Logger
2003-09-17 10:25:54 createObjectName with StandardEngine[Catalina].StandardHost[localhost].StandardContext[jaxrpc-HelloWorld]
2003-09-17 10:25:55 preRegister with Catalina:type=Logger,path=/jaxrpc-HelloWorld,host=localhost
2003-09-17 10:26:28 createObjectName with StandardEngine[Catalina].StandardHost[localhost].StandardContext[jsf-cardemo]
2003-09-17 10:26:28 preRegister with Catalina:type=Logger,path=/jsf-cardemo,host=localhost -
Hiding conditional logic using JSF tags
Hi
I'm trying to encapsulate some logic which, dependent on a true / false validation, outputs either one component or another containing a value.
For example...
when the validation is true, output <h:selectOneMenu... containing all available values with selected value highlighted.
when the validation is false, output <h:outputText... containing selected value.
I've tried custom tags but I'm using this to write out very basic tags and I'd prefer to use the JSF HTML tags.
The only option I can see is to write conditional logic in the JSPs to say:
if valid = true
<h:selectOneMenu...
else
<h:outputText...
endif
...but this means the developers must do this for every occurrence and the pages contain lots of conditional logic.
Is there any way to create a custom JSF tag which outputs JSF HTML tags as this seems to be what we want to do?
Thanks DThere is no tag for this, but every HTML component has a 'rendered' attribute which accepts a boolean expression. If it's outcome is true, then the component will be rendered, otherwise it will be hidden.
Here are some basic examples:
<h:someComponent rendered="#{myBean.booleanValue}" />
<h:someComponent rendered="#{myBean.intValue > 10}" />
<h:someComponent rendered="#{myBean.objectValue == null}" />
<h:someComponent rendered="#{myBean.stringValue != 'someValue'}" />
<h:someComponent rendered="#{!empty myBean.collectionValue}" />
<h:someComponent rendered="#{!myBean.booleanValue && myBean.intValue != 0}" />
<h:someComponent rendered="#{myBean.stringValue == 'oneValue' || myBean.stringValue == 'anotherValue'}" /> -
Hi all i have a question. Why do the JSF tags produce html that is laid out with tables rather than divs? I've tried to get the jsf framework adopted in my organisation and its this, and i quote 'Poor html' that is blocking the adoption.
Any one got a good answer i can take to the CTO please?
The only thing i could come up with was cross browser compatibility.The CTO is about ten years out of date if he is allergic to HTML tables. Everybody does it except wannabe HTML gurus who invented this 'issue'. It might have been a problem once. Not now.
-
Problems with JSF and included subviews
Hi everybody,
I' ve got a problem with JSF and included subviews which makes me going
crazy. I've got no clue why my web-pages are represent wrongly. The only
tip I've got is that it must be connected with the kind I do include my JSF-pages.
When I use <%@file="sub.jsp"%> my pages are are represent right. When I use <jsp:include page="Sub.jsp" /> or <c:import url="Sub.jsp" /> ( mark: the usage of flush="true" or flush="false" doesn't matter )
my pages are represent wrongly.
The usage of tags like f:facet or f:verbatim were also included but didn't point to an solution.
I searched the whole Sun Developer Forum and some other web-sites for any solution for my problem but the given hints and clues didn't help. Now I'm trying to post my problem directly in Sun's Forum in hope to get help.
My environment is the following:
JAVA JDK 1.5 Update 4
Tomcat 5.5.9
JSLT 1.1
Sun JSF 1.1
Win 2K
Here's my code:
Main.jsp
<%@ page language="java"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" href="stil.jsp" type="text/css" />
</head>
<body>
<f:view>
<h:form>
<div class="table">
<div class="tr">
<h:outputText styleClass="tdleft" value="value 1"/>
<h:outputText styleClass="tdinfo" value="value 2"/>
</div>
<div class="tr">
<h:outputText styleClass="tdleft" value="value 3"/>
<h:outputText styleClass="tdinfo" value="value 4"/>
</div>
</div>
</h:form>
<jsp:include page="Sub.jsp" />
</f:view>
</body>
</html>Sub.jsp
<%@ page language="java"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<f:subview id="subview">
<h:form>
<div class="table">
<div class="tr">
<h:outputText styleClass="tdleft" value="value 11"/>
<h:outputText styleClass="tdinfo" value="value 22"/>
</div>
<div class="tr">
<h:outputText styleClass="tdleft" value="value 33"/>
<h:outputText styleClass="tdinfo" value="value 44"/>
</div>
</div>
</h:form>
</f:subview>stil.jsp
<%@page contentType="text/css"%>
<%
String schwarz = "#000000",
grau1 = "#707070",
grau2 = "#c0c0c0",
grau3 = "#e0e0e0",
grau4 = "#e8e8e8",
grau5 = "#fdfdfd",
blau = "#0000dd",
tuerkis = "#00cfff";
String liniendicke = "1px",
linienart = "solid";
String allgemeineTextFarbe = schwarz;
String allgemeineHintergrundFarbe = grau3;
String infoTextFarbe = blau;
String fieldsetRandFarbe = blau;
String fieldsetRandDicke = liniendicke;
String fieldsetRandArt = linienart;
String hrLinienFarbe = blau;
String hrLinienDicke = liniendicke;
String hrLinienArt = linienart;
String inputAktivHintergrundFarbe = grau5;
String inputReadonlyHintergrundFarbe = grau4;
String inputPassivHintergrundFarbe = grau4;
String inputPassivFarbe = schwarz;
String inputRandFarbe1 = grau1;
String inputRandFarbe2 = grau5;
String inputRandDicke = liniendicke;
String inputRandArt = linienart;
String inputButtonHintergrundFarbe = grau3;
String legendenFarbe = blau;
String linkFarbe = blau;
String linkAktivFarbe = tuerkis;
String linkBesuchtFarbe = blau;
String linkFocusFarbe = tuerkis;
String objectGitterFarbe = grau5;
String objectGitterDicke = liniendicke;
String objectGitterArt = linienart;
String tabellenGitterFarbe = grau5;
String tabellenGitterDicke = liniendicke;
String tabellenGitterArt = linienart;
%>
<%-- ----------------------------------------------- --%>
<%-- Textdarstellung mittels der Display-Eigenschaft --%>
<%-- in den Tags div und span --%>
<%-- ----------------------------------------------- --%>
*.table {
display:table;
border-collapse:collapse;
*.tbody {
display:table-row-group;
*.tr {
display:table-row;
*.td,*.tdright,*.tdleft,*.tdinfo,*.th {
display:table-cell;
padding:3px;
vertical-align:middle;
*.td,*.th {
text-align:center;
*.tdright {
text-align:right;
*.tdleft {
text-align:left;
*.tdinfo {
color:<%=infoTextFarbe%>;
text-align:right;
*.th {
color:<%=infoTextFarbe%>;
font-weight:bold;
}thanks in advance
benjaminHello Zhong Li,
many thanks for your post, but it didn't work.
My problem is that the JSF-Components im my included or imported
JSP-Pages does not accept any kind of style or styleClass for
designing. The components take over the informations for colors
but not for alignment.
When I take a look at the generated JAVA-Source in $TOMCAT/WORK/WEBAPP for my sub.jsp ( sub.java )
it seems that the resulting HTML-page would be presented correctly.
But later when I start the application via Firefox or Mozilla the html-sourcecode is totally wrong.
In my example I create a simple grid with 2 rows and 2 columns.
Both columns contains JSF-Outtext-Components and are included with div-tags.
The generated Sub.java shows that the text would be setted in the div-tags. Unfortunately the html-sourcecode represented by my browser shows that jsf-text is not setted in the tags but in the <h:form> tags. The div-tags are neither rounded by <h:form> nor containing the JSF-OutText-Components.
Any clue?
Many thanks Benjamin
Here is the html-code from Firefox:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="http://polaris21:8080/webtest/">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" href="stil.jsp" type="text/css" />
</head>
<body>
<form id="_id0" method="post" action="/webtest/Main.faces" enctype="application/x-www-form-urlencoded">
<div class="table">
<div class="tr">
<span class="tdleft">value 1</span>
<span class="tdinfo">value 2</span>
</div>
<div class="tr">
<span class="tdleft">value 3</span>
<span class="tdinfo">value 4</span>
</div>
</div>
<input type="hidden" name="_id0" value="_id0" />
</form>
<form id="SUB:_id5" method="post" action="/webtest/Main.faces" enctype="application/x-www-form-urlencoded">
<span class="tdleft">value 11</span>
<span class="tdinfo">value 22</span>
<span class="tdleft">value 33</span>
<span class="tdinfo">value 44</span>
<input type="hidden" name="SUB:_id5" value="SUB:_id5" />
</form>
<div class="table">
<div class="tr">
</div>
<div class="tr">
</div>
</div>
</body>
</html> -
How to add raw HTML tags inside JSF tags...
Hi
I would like to use <input type = text > inside my project in some area..The following code hides the input = type html tag and forwards the click event to jsf command button...After selecting the file,it should forward the value to jsf textfield....
My code seems as below.
<h:form id="detailForm" onsubmit="printElements(detailForm,this)">
<f:verbatim>
<input id="uploadFile" type="file" style ="dispaly:none"size="100" />
</f:verbatim>
<h:inputText id="docName" style="width:650px;" maxlength="100"/>
<h:commandButton id="visibleBrowseButton" value="Select File..." onclick="'detailForm:uploadFile'.click();callClick();">
</h:commandButton>
</h:form>
<script type="text/Javascript">
function callClick()
var val = document.detailForm.uploadFile.value;
document.getElementById('detailForm:docName').value = val;
</script>
While running this page it works fine in IE but in Mozilla firefox it troubles me during detailForm:uploadFile'.click().
I suspect the jsf page cannot able to detect the raw html tag inside jsf tags...Eventhough i tried using inside<f:verbatim> it wont works..
I would like to know
1.Whether the code is right,,if the code goes wrong why it got runned in IE not in firefox....
2.How can raw html tags can be integrated inside JSF tags....First of all, why are you ignoring valuable answers about a JSF fileupload component in your previous topic?
Second, you can just nest raw HTML anywhere in your JSF page. Your problem is rather related to JavaScript. It has completely nothing to do with Java nor JSF. Learn JavaScript -there is a nice tut at w3schools.com- and look for a JavaScript forum if you still stucks. There are ones at webdeveloper.com and dynamicdrive.com.
The f:verbatim is only required if you was using JSF 1.1 or older, which is not the case. You would have occurred completely different problems.
Maybe you are looking for
-
Syncing To Dos on iCal with my iPod
I checked on my iPod and I found To Dos under calendar--unfortunately it looks like it synced every To Do I've ever had on iCal, even though most of them are completed. Is there any way to remove To Dos after they have been checked as complete?
-
Not able to set the where clause params
Hi, My version of apps is 12.1.3. I created a page with a searchRN and resultRN (LinesVO). (Not a query/view link) . I am passing the id from header to the VO to restrict the linesVO The controller correctly passes the id from searchRN to AM, but in
-
"Unable to Move Message" error in trying to delete emails
I have an Outlook email account pushed to my iPhone 3GS. Some messages that I've received and then deleted via Outlook on my laptop remain on the iPhone and when I try to manually delete them on the iPhone, I get the "Unable to Move Message: The mess
-
Sending email from a simple JSF Form
Hi, Sorry if this is a very basic question. I have a simple JSF (with ADF BC) form that collects information and I store the submitted values in the backing bean. I am even able to display the input values in a than you page. I just want a pointer on
-
In the past month or so I've been ripping CDs from discs to replace songs I've downloaded off the internet. Problem is, on a CD with say, 4 songs, it might rip 2 or 3. I haven't seen this discussed in any other threads, what should I do? Oh - I have