Dispaly operators in JSF dropDown
Hi ,
There is a requirement in my project to add and delete a row onclick of a button.
Each row has a drop down which displays ("<",">","<=",">=") operators.
When i am using the below HTML code for displaying dropdowns ,add and delete functionalities working fine..
<select name="select13" class="TextBlackNormal">
<option>></option>
<option><</option>
<option>>=</option>
<option><=</option>
</select>
But in case of JSF dropdown tag,add and delete fucntionalites are not working onclick of a button.But it displays the dropdown List.
<h:selectOneMenu value="#{ruleBlock.priceRangeFromOperator}">
<f:selectItems value="#{PriceVarianceRuleBean.priceRangeOpeList}"/>
</h:selectOneMenu>
I configured the priceRangeOpeList as
priceRangeOpeList.add(new SelectItem("<","<","<"));
priceRangeOpeList.add(new SelectItem(">",">",">"));
Add and delete functionlaites are working fine if i use below configuration for the drop down.but the the values in the drop down are dispalyed as (>,< like this instead of < , >).So i think the problem is with the operators.Can you please tell me how to display these opearators in the dropdown.
priceRangeOpeList=new ArrayList();
priceRangeOpeList.add(new SelectItem(">",">",">"));
priceRangeOpeList.add(new SelectItem("<","<",">"));
Thanks
You should use HTML entities for reserved HTML characters. The < denotes the start of a HTML tag and the > the end, you do understand?
Instead of < use <
Instead of > use >
Instead of " use "
Instead of ' use '
Instead of & use &
Also see [http://www.w3schools.com/tags/ref_entities.asp]
You can escape them "automagically" when using <h:outputText> or <c:out>.
Similar Messages
-
Unable to show JSF dropdown with a list containing custom beans
Hi,
Please help me with my problem guys.
In the JSF Portlet application that Iam currently working, I need to show some dropdowns,so I am passing arraylist in my JSP like this:
<code]
<f:view>
<hx:scriptCollector id="scriptCollector1">
<h:form styleClass="form" id="form1"><P>Place content here.
<h:selectOneMenu styleClass="selectOneMenu" id="menu1" >
<f:selectItems value="#{gfogBean.northAmericaList.toArray}"/>
</h:selectOneMenu>
</h:form>
</hx:scriptCollector>
</f:view>
gfgoBean is my FacesManagedBean, northAmericaList has objects of type TestBean....
public class GfogBean {
private String exchangeEurope;
private String exchangeAsiaPacific;
private String exchangeNorthAmerica;
private List northAmericaList = new ArrayList();
* @return Returns the northAmericaList.
public List getNorthAmericaList() {
northAmericaList.add(new TestBean("north","north"));
return northAmericaList;
* @param northAmericaList The northAmericaList to set.
public void setNorthAmericaList(List northAmericaList) {
this.northAmericaList = northAmericaList;
* @return Returns the exchangeAsiaPacific.
public String getExchangeAsiaPacific() {
return exchangeAsiaPacific;
* @param exchangeAsiaPacific The exchangeAsiaPacific to set.
public void setExchangeAsiaPacific(String exchangeAsiaPacific) {
this.exchangeAsiaPacific = exchangeAsiaPacific;
* @return Returns the exchangeEurope.
public String getExchangeEurope() {
return exchangeEurope;
* @param exchangeEurope The exchangeEurope to set.
public void setExchangeEurope(String exchangeEurope) {
this.exchangeEurope = exchangeEurope;
* @return Returns the exchangeNorthAmerica.
public String getExchangeNorthAmerica() {
return exchangeNorthAmerica;
* @param exchangeNorthAmerica The exchangeNorthAmerica to set.
public void setExchangeNorthAmerica(String exchangeNorthAmerica) {
this.exchangeNorthAmerica = exchangeNorthAmerica;
}But I am getting this exception.
Nested Exception is javax.servlet.jsp.JspException: javax.faces.el.ReferenceSyntaxException: The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer.
at com.sun.faces.taglib.html_basic.SelectOneMenuTag.doEndTag(SelectOneMenuTag.java:483)
at org.apache.jsp._GfogWeb._jspService(_GfogWeb.java:220)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:683)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:781)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1049)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:254)
at org.apache.pluto.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:112)
at com.ibm.faces.context.PortletExternalContextImpl.dispatch(PortletExternalContextImpl.java:439)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:295)
at com.ibm.faces.application.PortletViewHandlerImpl.renderView(PortletViewHandlerImpl.java:74)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:217)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at com.ibm.faces.webapp.FacesGenericPortlet.doRender(FacesGenericPortlet.java:358)
at com.ibm.faces.webapp.FacesGenericPortlet.doView(FacesGenericPortlet.java:389)
at com.jpmorgan.gfogwebportlet.portlet.GfogInitPortlet.doView(GfogInitPortlet.java:51)
at com.ibm.faces.webapp.FacesGenericPortlet.doDispatch(FacesGenericPortlet.java:290)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
at com.ibm.wps.pe.pc.std.cmpf.impl.PortletFilterChainImpl.render(PortletFilterChainImpl.java:144)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.dispatch(PortletServlet.java:131)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.doGet(PortletServlet.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.ibm.wps.pe.pc.std.cache.CacheablePortlet.service(CacheablePortlet.java:256)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1049)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:254)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:204)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:168)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.render(PortletInvokerImpl.java:97)
at com.ibm.wps.pe.pc.std.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:110)
at com.ibm.wps.pe.pc.PortletContainerImpl.doRenderPortlet(PortletContainerImpl.java:545)
at com.ibm.wps.pe.ext.render.AbstractRenderManager.performService(AbstractRenderManager.java:251)
at com.ibm.wps.pe.pc.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:100)
at com.ibm.wps.engine.tags.PortletRenderTag.doStartTag(PortletRenderTag.java:155)
at org.apache.jsp._Control._jspService(Control.jsp :176)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:683)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:781)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1044)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:254)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:74)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:71)
at com.ibm.wps.composition.elements.Component.render(Component.java:785)
at com.ibm.wps.composition.elements.Control.render(Control.java:182)
at com.ibm.wps.composition.Composition.render(Composition.java:2880)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:204)
at com.ibm.wps.model.ModelUtil$WrappedCompositionModel.render(ModelUtil.java:832)
at org.apache.jsp._UnlayeredContainer_2D_V._jspService(UnlayeredContainer-V.jsp :11)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:683)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:781)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1044)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:254)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:74)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:71)
at com.ibm.wps.composition.elements.Component.render(Component.java:785)
at com.ibm.wps.composition.Composition.render(Composition.java:2880)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:204)
at com.ibm.wps.engine.tags2.PageRenderTag.doStartTag(PageRenderTag.java:397)
at org.apache.jsp._Home._jspService(Home.jsp :15)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:683)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:781)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1044)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:254)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
at com.ibm.wps.engine.templates.screens.Default.render(Default.java:91)
at com.ibm.wps.engine.templates.ScreenTemplate.render(ScreenTemplate.java:61)
at com.ibm.wps.engine.tags2.ScreenRenderTag.doStartTag(ScreenRenderTag.java:89)
at org.apache.jsp._Default._jspService(Default.jsp :768)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:683)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:781)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1044)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:254)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
at com.ibm.wps.engine.templates.themes.Default.render(Default.java:103)
at com.ibm.wps.engine.templates.ThemeTemplate.render(ThemeTemplate.java:67)
at com.ibm.wps.engine.phases.WPRenderPhase.processRendering(WPRenderPhase.java:312)
at com.ibm.wps.engine.phases.WPRenderPhase.execute(WPRenderPhase.java:135)
at com.ibm.wps.state.phases.AbstractRenderPhase.next(AbstractRenderPhase.java:106)
at com.ibm.wps.engine.phases.WPAbstractRenderPhase.next(WPAbstractRenderPhase.java:93)
at com.ibm.wps.engine.Servlet.callPortal(Servlet.java:713)
at com.ibm.wps.engine.Servlet.doGet(Servlet.java:562)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at com.ibm.wps.state.filter.StateCleanup.doFilter(StateCleanup.java:86)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.wps.mappingurl.impl.URLAnalyzer.doFilter(URLAnalyzer.java:216)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1040)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:201)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:624)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:458)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)Then I changed the <f:selectItems/> little bit like
<f:selectItems value="#selectItems.gfogBean.northAmericaList.toArray}"/>Then there was no error ,but the dropdown was null.
Again I modifed the <f:selectItems/> tag in this way:
<f:selectItems value="#{selectitems.gfogBean.northAmericaList.testBeanValue.testBeanValue.toArray}"/>then the dropdown appeared but the values were showing up twice.
Can anybody give me solution to this problem.Even a custom converter or a custom component could solve this problem.. \n
Because in my application, we are not populating the arraylists with SelectItem type.The perInfoAll list should be declared locally in getPerInfoAll(), otherwise it grows every time you call it.
#{e.id};Remove the semicolon, unless you want to see it on the page, which doesn't seem right. Try <h:outputText value="#{e.id}"/> instead. Only certain types of children are supported inside h:column. -
I have following dropdown
Code:
<h:panelGrid columns="3" styleClass="detail" columnClasses="label">
<h:outputText value="Manufacturer" />
<h:selectOneMenu id="manufList" value="#{manufacturerBean.selectedManufacturer}" >
<f:selectItem itemLabel="New" itemValue="New" />
<f:selectItems value="#{manufacturerBean.manufacturerList}" />
<a4j:support action="#{manufacturerBean.loadManufacturerDetails}" event="onchange" reRender="manufName,manufDescription,manufSource,btnSave,btnDelete" />
</h:selectOneMenu>
</h:panelGrid>
The perfomance issue is Whenever i pick a value from the dropdown it results in 3 database calls
Here is the sequence of method calls
- First time the method in f:selectItems gets called which results in a database call
<f:selectItems value="#{manufacturerBean.manufacturerList}" />
- Second time as expected/desired Ajax4JSF onchange event action method gets called
<a4j:support action="#{manufacturerBean.loadManufacturerDetails}" event="onchange" reRender="manufName,manufDescription,manufSource,btnSave,btnDelete" />
- Third time again the method in f:selectItems gets called which results in a database call
<f:selectItems value="#{manufacturerBean.manufacturerList}" />
I understand its due to JSF Lifcycle.
Any pointers/suggestion on how to Cache the method getManufacturerList() to avoid unnecessary database calls will be highly appreciated
Regards
Bansiu can do in one way, use IBM JSF .jar file,
<%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
and use <hx:scriptCollector preRender="#{yourBean.onPageLoadBegin}" />,
so when your page load it will call that method which load onces, and using flag, u can control the loading data again from back end .
I hope it will help,
Thanks
Srikanth -
Visual JSf: textField hide or disable, when selecting dropDown list
Hello everyone,
I am new to this forum, I am working on Visaul JSF, I have a question,
When i select a value dropDown List, i want to disable or hide textField depending on the selected item in the list.
I have put javascript for dropDown list. I am not able to do this. Can any one help me please...
<webuijsf:script>
function fun(sel){
var state = sel.options[sel.selectedIndex].value;
alert(state);
if(state == 2){ alert("if"); document.getElementById('form1:textField2').disabled='true' }else{ alert("else"); document.getElementById('form1:textField2').disabled='false'}
</webuijsf:script>for downdown, i have added this..
onChange="fun(this)"In dropdon list
name value
One 1
Two 2
Three 3
Jsp code:
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<webuijsf:page id="page1">
<webuijsf:html id="html1">
<webuijsf:script/>
<webuijsf:script>
function fun(sel){
var state = sel.options[sel.selectedIndex].value * 1;
alert(state);
if(state == 2){ alert("if"); document.getElementById('form1:textField2').disabled='true' }else{ alert("else"); document.getElementById('form1:textField2').disabled='false'}
</webuijsf:script>
<webuijsf:head id="head1">
<webuijsf:link id="link1" url="/resources/stylesheet.css"/>
</webuijsf:head>
<webuijsf:body id="body1" style="-rave-layout: grid">
<webuijsf:form id="form1">
<webuijsf:textField id="textField2" onChange="" style="height: 18px; left: 174px; top: 258px; position: absolute; width: 216px"/>
<webuijsf:button id="button1" onClick="return fun()" style="position: absolute; left: 228px; top: 324px" text="Button"/>
<webuijsf:dropDown id="dropDown1" items="#{Page3.dropDown1DefaultOptions.options}" style="position: absolute; left: 312px; top: 90px" onChange="fun(this)"/>
</webuijsf:form>
</webuijsf:body>
</webuijsf:html>
</webuijsf:page>
</f:view>
</jsp:root>Thanks in advance
Neha
Edited by: Neha_540 on Apr 5, 2009 11:02 PM
Edited by: Neha_540 on Apr 5, 2009 11:05 PMHi Neha,
Hope this helps.
function changeMarital()
var marital = document.getElementById('form1:drpMarital_list').value;
if(marital == "Others")
document.getElementById('form1:lblOtherMarital').style.display='';
document.getElementById('form1:txtOtherMarital').style.display='';
else
document.getElementById('form1:lblOtherMarital').style.display='none';
document.getElementById('form1:txtOtherMarital').style.display='none';
} -
Getting problem in binding DropDown List with table data in visual JSF
Hi All,
I am new to visual JSF.
I am getting few problems while working over components.
I have succeeded in binding data of Person table in a drop down list .
By just drag drop ..it worked.
But while connecting to external DB this drag drop mechanism didn't work for me .
1st problem that i faced was by dragging method columns are not visible when i did right click-> bind to Data -> DataProvider window .
But i am successfully printed table Data in backend ie: by putting
for(int i=0; i<xn_white_listDataProvider.getAllRows().length;i++){
System.out.println(" value :"+xn_white_listDataProvider.getValue("SUB_ID",xn_white_listDataProvider.getRowKey(Integer.toString(i))));
}I am not getting how to set Items in dropdown1
I tried putting
HelloSh.xn_white_listDataProvider.options['XNODE.XN_WHITE_LIST.SUB_ID, XNODE.XN_WHITE_LIST.SUB_ID'but it didn't work while for person data table
items="#{HelloSh.personDataProvider.options['PERSON.PERSONID,PERSON.NAME']}"it is working
when i am writting items="24,28" in dropdown1 box
& printing its value in static text Like
<webuijsf:staticText id="staticText3" style="position: absolute; left: 72px; top: 120px" text="#{HelloSh.dropDown1.items}"/> it is printing fine .
Plz help me in this regard.
Any clarification if needed plz let me know.
Thanks in advance.<h:selectOneMenu id="menu1" styleClass="selectOneMenu">
<f:selectItems value="*#{selectitems.pc_DynamicPortletEdit.regList}*" />
</h:selectOneMenu>When we bind the list to the h:selectOneMenu the code in the JSP will be as given above.
My doubts here are
1) But when i tried to bind the list to a selectonemenu the code in the JSP is looking like this one
<h:selectOneMenu id="menu1" styleClass="selectOneMenu">
<f:selectItems value="*#{selectitems.pc_DynamicPortletEdit.regList.regList.toArray}*" />
</h:selectOneMenu>2) Also in the runtime instead of displaying the values in the dropdown, i am getting the object names (javax.faces.model.SelectItem@680d0ccc) in the drop down.
What am I doing wrong? Any help here would be usefull for me.
BTW,
the code in the backing bean for setting the values is like this
List dropListValue = new ArrayList();
for (int x=0; x<result.length; x++){ //where result is array of string values
SelectItem tempSelect = new SelectItem();
tempSelect.setLabel(result[x]);
tempSelect.setValue(result[x]);
dropListValue.add(result[x]);
this.setRegList(dropListValue );The bean is in request scope only. -
Hello,
First of all thank you for your responses. I have some form with fields like name surname sex ..... and a "collector" dropdown box which will be used to collect the data. Here is what I am trying to do. The user fills the fields that I described earlier and press "Add" button so that he can add to a "collector" box do the a same process until he finished doing it. Afterwards the data form the "collector" accompined by other data will be filled to another "collecter" in the same vain. Can JSF provide me to do so.. I mean I can do it with simple Javascript but I want to use JSF with client validation...
Thank you,
addiaababa
:14:15You should implement Add actions in your backing beans whitch will add to your SelectItem[] new SelectItem with new collected value.
-
Menubar disappears over a ui:dropdown (jsf component)
Hi,
Iam working with jsf(NetBeans Visualwebpack 5.5).I have to create menus in my proj.So i downloaded js menu and included in my projec.Its working fine only for html components.If i try to include jsf
<ui:dropdown > component..Iam getting tomcat error.
Can u give me a solution.that is a very tough nut to crack you have there. The one thing that immediately prevents me from giving suggestions is this major heach ache: how do you control which components will get a certain state under the circumstances you give?
My initial advice is to just use JSF as it is intended; yes you'll get pages littered with rendered and required attributes. This removes one major flaw in the requirement you propose; it keeps everything visible in stead of things happening automatically and invisibly in the background. This will make it so much easier to debug your authentication logic.
The one thing you should centralize is the business logic behind the decisions when a component is required/rendered - you should prevent that pages are littered with EL expressions like "not user.admin and state.page='x'". Me personally I would create visible access rules that are tightly coupled to an application function, like 'auth.userCanEditUserDetails'. -
Dynamically Refresh Dropdown in JSF
I wanna dynamically refresh dropdown values. Here is my requirement
The user creates new record by selecting "New" value from the dropdown. Then user enters values on form fields and clicks the Submit button. The result is record gets created in the database and also gets populated in the dropdown. Now i wanna show this record as selected value in the dropdown instead of New to faciltate update/delete operations.
Note: The reason i am doing this is subsequent save results in detached object hibernate exception. To resolve this exception if i create a new instance then i will loose the original object so i cant do update/delete on the original object. My backing bean is in session scope
Any pointers/suggestions will be highly appreciated
Regards
BansiWhat do you mean by preset it by property because the new value is allready set in the backedbean but its not reflected on the page as the drop down doesn't get refreshed.
-
What am I missing? I do not see the dropdown on the JSF
Hi Guys,
For some reason, JSF is not rendering "list1" in the following JSF:
***********JSF***************
<HTML>
<HEAD> <title>Hello</title> </HEAD>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<body bgcolor="white">
<h2>Hi. My name is Krishna. I'm thinking of a number from 0 to 10.
Can you guess it?</h2>
<jsp:useBean id="UserNumberBean" class="guessNumber.UserNumberBean" scope="session" />
<f:use_faces>
<h:form id="helloForm" formName="helloForm" >
<h:graphic_image id="wave_img" url="/wave.med.gif" />
<h:input_number id="userNo" numberStyle="NUMBER"
valueRef="UserNumberBean.userNumber">
<f:validate_longrange minimum="0" maximum="10" />
</h:input_number>
<h:command_button id="submit" action="success" label="Press Me"
commandName="submit" />
<p>
<h:command_button id="back" action="back" label="Back"
commandName="back" />
<p>
<h:output_errors id="errors1" for="userNo"/>
<p>
<h:selectone_menu id="list1"
valueRef="UserNumberBean.list1">
<f:valuechanged_listener type="guessNumber.ListValueChangedListener" />
<h:selectitems
valueRef="UserNumberBean.currentListOption"/>
</h:selectone_menu>
</h:form>
</f:use_faces>
</HTML>
*********Faces Config***********
<faces-config>
<navigation-rule>
<from-tree-id>/greeting.jsp</from-tree-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-tree-id>/response.jsp</to-tree-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-tree-id>/greeting.jsp</from-tree-id>
<navigation-case>
<from-outcome>back</from-outcome>
<to-tree-id>/response.jsp</to-tree-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-tree-id>/response.jsp</from-tree-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-tree-id>/greeting.jsp</to-tree-id>
</navigation-case>
</navigation-rule>
</faces-config>
**************ListValueChangedListener class**************
* Created on Nov 2, 2003
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
package guessNumber;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.PhaseId;
import javax.faces.event.ValueChangedEvent;
import javax.faces.event.ValueChangedListener;
* @author krishna
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
public class ListValueChangedListener implements ValueChangedListener {
/* (non-Javadoc)
* @see javax.faces.event.ValueChangedListener#processValueChanged(javax.faces.event.ValueChangedEvent)
public void processValueChanged(ValueChangedEvent vEvent) throws AbortProcessingException {
System.out.println("ValueChangedEvent processEvent");
String componentId = vEvent.getComponent().getComponentId();
// handle each valuechangedevent here
FacesContext context = FacesContext.getCurrentInstance();
System.out.println("Component Id: "+componentId);
System.out.println("vEvent.getOldValue: "+vEvent.getOldValue());
System.out.println("vEvent.getNewValue: "+vEvent.getNewValue());
/* (non-Javadoc)
* @see javax.faces.event.FacesListener#getPhaseId()
public PhaseId getPhaseId() {
return PhaseId.PROCESS_VALIDATIONS;
***************UserNumberBean**********************
package guessNumber;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Random;
public class UserNumberBean {
protected Integer userNumber = null;
protected Integer randomInt = null;
protected String response = null;
protected Collection list1;
protected Collection list2;
protected ArrayList currentListOption;
public UserNumberBean () {
Random randomGR = new Random();
randomInt = new Integer(randomGR.nextInt(10));
System.out.println("Duke's number: "+randomInt);
list1 = new ArrayList();
list1.add("List1 - Item1");
list1.add("List1 - Item2");
list1.add("List1 - Item3");
list1.add("List1 - Item4");
list2 = new ArrayList();
list2.add("List2 - Item1");
list2.add("List2 - Item2");
list2.add("List2 - Item3");
list2.add("List2 - Item4");
public void setUserNumber(Integer user_number) {
userNumber = user_number;
System.out.println("Set userNumber " + userNumber);
public Integer getUserNumber() {
System.out.println("get userNumber " + userNumber);
return userNumber;
public String getResponse() {
if(userNumber.compareTo(randomInt) == 0)
return "Yay! You got it!";
else
return "Sorry, "+userNumber+" is incorrect.";
* @return
public Collection getList1() {
return list1;
* @return
public Collection getList2() {
return list2;
* @param collection
public void setList1(Collection collection) {
list1 = collection;
* @param collection
public void setList2(Collection collection) {
list2 = collection;
* @return
public ArrayList getCurrentListOption() {
return currentListOption;
* @param list
public void setCurrentListOption(ArrayList list) {
currentListOption = list;
Cheers!
KrishI see some problems in your JSP page.
<h:selectone_menu id="list1"
valueRef="UserNumberBean.list1">This points to item that you want to appear selected when the list is rendered, so it should point to a string. So for ex, in your code below, currenListOption can be a string. Also I see that currentOption is null.
<h:selectitems
valueRef="UserNumberBean.currentListOption"/>
</h:selectone_menu>
</h:form>
</f:use_faces>
</html> This should point to list to be displayed. Say for example list1 in your code.
Hope this fixes your problem.
-Jayashri -
Dispalying date in 24 hr format in JSF
Hi
Is there way to show date in 24 Hr format.
ie if I want to display date as
MM/DD/YYYY HH24:MI:SS
01/10/2007 15:02:55
with ,
<f:convertDateTime pattern="MM/dd/yyyy" hh:mm:ss/>
its displaying as , 01/10/2007 00:00:00
Thanks
SandipHi anguquga,
Its working for displaying normal dates.
But I am using
<t:inputCalendar for date saving.
i.e I have form in which I have to save date by selecting date from <t:inputCalendar component
so while displaying saved record I am getting date as
02/17/2007 24:00:00
this 24:00:00 is coming all places though I saved date with different time.
for displaying date I am doing as,
<h:outputText id="startDate" value="#{bean.startDate}">
<f:convertDateTime pattern="MM/dd/yyyy kk:mm:ss " /> </h:outputText>
Thanks
Sandip -
How to use the feature of ajax in visual web jsf
Hello,everyone!
I want to use the feature of ajax in visual web jsf,but the program encountered a error. I want refresh the dropdownlist once the javascript captured the refresh message,they both behaved asynchronously. However, the textField1 rendered with a blank box,while the dropDown1 had no change. The code as follows:
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<webuijsf:page binding="#{Page1.page1}" id="page1">
<webuijsf:html binding="#{Page1.html1}" id="html1">
<webuijsf:head binding="#{Page1.head1}" id="head1">
<webuijsf:link binding="#{Page1.link1}" id="link1" url="/resources/stylesheet.css"/>
<webuijsf:script>
var processEvents = {
update: function(props) {
var combo=document.getElementById("form1:dropDown1");
combo.refresh();
// Subscribe to refresh event.
function refreshme(){
var dom=document.getElementById("form1:textField1");
dom.refresh();
dojo.subscribe(webui.suntheme.widget.textField.event.refresh.endTopic, processEvents, "update");
</webuijsf:script>
</webuijsf:head>
<webuijsf:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
<webuijsf:form binding="#{Page1.form1}" id="form1">
<webuijsf:textField binding="#{Page1.textField1}" id="textField1" onBlur="refreshme();"
style="position: absolute; left: 168px; top: 144px" valueChangeListenerExpression="#{Page1.textField1_processValueChange}"/>
<webuijsf:textField binding="#{Page1.textField2}" id="textField2" style="left: 168px; top: 96px; position: absolute"/>
<webuijsf:dropDown binding="#{Page1.dropDown1}" id="dropDown1" items="#{Page1.dropDown1DefaultOptions.options}" style="position: absolute; left: 192px; top: 216px"/>
</webuijsf:form>
</webuijsf:body>
</webuijsf:html>
</webuijsf:page>
</f:view>
</jsp:root>
/**********************************java******************************************/
the function textField1_processValueChange didn't been invoked
public void textField1_processValueChange(ValueChangeEvent event) {
DropDown dd=getDropDown1();
Option op1=new Option();
String addText=(String)getTextField1().getText();
op1.setLabel(addText);
op1.setTooltip("tooptip");
op1.setValue(addText);
ArrayList <Option> l=null;
Iterator <Option> i = dd.getListItems();
while(i.hasNext()){
l.add(i.next());
l.add(op1);
dd.setItems(l);
thanks In advance all of your replies.Hi there,
Take a look at this, will help you
http://developers.sun.com/jscreator/learning/tutorials/2/textcompletion.html
Thanks
K -
Error while parsing JSF jspx page when including javascript loops
Hi All,
I have a jspx document which contains jsf tags including trinidad tags. I have added a javascript function in the page, which contains a for loop statement, however when I run the page I get an error
com.sun.facelets.FaceletException: Error Parsing /xAdvisorWeb/bundles/receivetask/manageinbox.jspx: Error Traced[line: 48] The content of elements must consist of well-formed character data or markup.
at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
at com.sun.facelets.compiler.Compiler.compile(Compiler.java:104)
at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:192)
at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:141)
at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:93)
at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:503)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:553)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:178)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:995)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:930)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:326)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:290)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:213)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:90)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:761)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:673)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:498)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
Please note that normal javascript code has worked in my jsf page, this problem only occurs only when I add for loop or while loop in the javascript function. Can we not add javascript loops in a jsf page? Is there something else I need to include?
This is the relevant code snippet :
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:ch="http://www.chordiant.com/jsf"
xmlns:chrd="http://chordiant.com/jsf/chrd">
<f:view locale="#{preferLocale.locale}">
<f:verbatim escape="true">
<script>
function validateInput(){
for(int i=0;i<3;i++)
alert('Hi');
return false;
</script>
</f:verbatim>
<tr:commandLink styleClass="ttmBtnCmdLink" onclick="return validateInput();"
action="#{manageInbox.executeTaskForAssignedWorkItems}">
<tr:outputText value="#{msgs.execute_btn}"
styleClass="ttmBtnOutTxt" />
</tr:commandLink>
Any help will be much appreciated.
Thanks in advance,
DebajyotiM-Y wrote:
replace "<" with "& l t ;"
remove spaces in "& l t ;" when u paste it in ur code
in my previous 2 replies i entered it with out spaces and it was getting converted to "<"The forum engine parses HTML entities. So just replace the & by its HTML entity & and it will work: <.
But no, this is not going to work. JavaScript doesn't recognize HTML entities as operators.
Follow the suggestion rlubke gave. Or, even better, put all Javascripts in its own .js file and include this file in the HTML head. -
Hi,
In my sample project the UI is powered by JSF, overall application architecture is J2EE.
In a scenario,we have a page where we toggle between radio buttons and page reloads everytime we toggle, with different forms.
In specific we have three radion buttons namely x ,y and z.
When the default page loads, x is selected and when i shift my selection to y the page reloads with different forms and no error is seen.
Next when i select z page reloads with different forms but error is displayed on the top of the page as below
"Validation error:Value is not valid."
Once the error is dispalyed on the page the error continues to remain eventhough we revert back the radio selection.
In the above case jsp calls the js and the snippet of the same is as below
JSP snippet:
<TD><h:selectOneRadio styleClass="selectOneRadio" id="radio1"
value="#{sessionScope.sameJam}"
onclick=return jump_onclick(this,event);>
<f:select itemValue="x"
itemLabel="#{labels.label_x}" />
<f:select itemValue="y"
itemLabel="#{labels.label_y}" />
<f:select itemValue="z"
itemLabel="#{labels.label_z}" />
</h:selectOneRadio></TD>
JS snippet:
function jump_onclick(thisObj,thisEvent){
thisObj.form.submit();
Java code:
protected HtmlSelectOneRadio getRadio1() {
if (radio1 == null) {
radio1 = (HtmlSelectOneRadio) findComponentInRoot("radio1");
return radio1;
Thanks in advance.Re-wrote the below code in jsp
<h:form rendered="#{sS.selectedItem =='x'}" styleClass="selectOneRadio" >
<h:selectOneRadio rendered="#{sS.selectedItem =='x'}" >
<f:selectItem itemValue="x" itemLabel="labelx" />
<f:selectItem itemValue="y" itemLabel="labely" />
<f:selectItem itemValue="z" itemLabel="labelz"/>
</h:selectOneRadio>
</h:form>
<h:form rendered="#{sS.selectedItem =='y'}" styleClass="selectOneRadio" >
<h:selectOneRadio rendered="#{sS.selectedItem =='y'}" >
<f:selectItem itemValue="x" itemLabel="labelx" />
<f:selectItem itemValue="y" itemLabel="labely" />
<f:selectItem itemValue="z" itemLabel="labelz"/>
</h:selectOneRadio>
</h:form>
<h:form rendered="#{sS.selectedItem =='z'}" styleClass="selectOneRadio" >
<h:selectOneRadio rendered="#{sS.selectedItem =='z'}" >
<f:selectItem itemValue="x" itemLabel="labelx" />
<f:selectItem itemValue="y" itemLabel="labely" />
<f:selectItem itemValue="z" itemLabel="labelz"/>
</h:selectOneRadio>
<h:commandButton value="submit" action="#{sS.action}" />
</h:form>Below is my java code in SS class:
package mypackage;
public class SS {
private String selectedItem;
public SS(){
String selectedItem = "x";
public void action() {
System.out.println("Selected item: " + selectedItem);
public String getSelectedItem() {
return selectedItem;
public void setSelectedItem(String selectedItem) {
this.selectedItem = selectedItem;
}Result is:
Instead of getting 3 radio buttons, i get a submit button my page.
Please correct me if I am wrong somewhere. -
Why isn't my jsf app internationalizing?
Hello all -
Using NB 6.5.1, JDK 6, Java EE 5, and Glassfish V3, so nothing but the good stuff. This should be simple for anyone who is already internationalizing their apps, so please assist.
New to i18n but badly needing to grasp it, I have developed the following mini project that should change its displayed language but only based on user choice, and not the browser's settings.
1) created a jsf web app project (called langs) with Visual Web Java Serverfaces support
2) dragged & dropped (d&d) a dropdown list object and configured it with two items: en and fr for English and French. Also, made it "Auto-submit on change" and provided it this event handler:
public void dropDown1_processValueChange(ValueChangeEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot viewRoot = context.getViewRoot();
String loc = dropDown1.getSelected().toString();
viewRoot.setLocale(new Locale(loc));
info("Locale: " + viewRoot.getLocale().toString());
}3) d&d a loadBundle object into the jsf page, so the jsp version of the page now has this tag:
<f:loadBundle basename="langs.Bundle" var="msg1"/>4) added one locale, this is the "fr_FR - French / France" as shown in the "New Locale" dialog
5) into the Bundle.properties file, I added one key: "welcome", with default language: "hello", and fr_FR - French language: "au revoir"
6) d&d a label object onto the page, and set its text as follows: #{msg1.welcome}. As soon as I do that, the text is shown rendered on the development page to "hello", so I am accessing the file OK.
7) ... and that's it. I run the program, all I ever see is the word "hello". I change the selection from the drop down list of course and the page refreshes, but all I see is "hello". I check print out the value of the viewRoot's locale and it shown me either "en" or "fr" in accordance with my selection, but the displayed string is "hello".
I have been stuck with this for (well, I am shy to say) sometime now and I really need to solve it. What am I "not" doing? I must be missing something that makes the app oblivious to the file named Bundle_fr_FR.properties (the other one of course is Bundle.properties).
And while we are it, can I pick and choose my bundle files dynamically from within the application to force the app to get the values for the keys from a certain file? For example, suppose I want to internationalize and app into 7 languages (some LTR, others RTL) and I don't want to put all the values for the keys in one "basename" file, could I do that?
Your answer and pointers are much, much appreciated. Thank you.
MohsenWhy not get sun's J2EE tutorial and follow the steps explained there.
Even if you insist on using Netbeans' drag and drop facilities, you could still view the source to make sure that it matches what's explained in the tutorial. I find that doing some things manually first helps me understand and appreciate the processes better when I later use a tool to speed up development. -
Hi All,
I am using JSF JSP pages. One such page is login.jsp I have backing object backing_login
On successful login, listUser.jsp page is displayed. In this page, I have a HTML --- Commons Hyperlink component as follows.
<tr>
<td height="17">
<a href="http://129.212.139.36:8991/GeminiLogin-ViewController-context-root/faces/listUsers.jsp">
Manage Users
</a>
<afh:script binding="#{backing_createModify.script1}"
id="script1"/>
</td>
</tr>
Now the question:---
I do get to know the UserType in the backing_login object (either 'cma' or 'ea').
Now, if it is cma I want the above link tobe dispalyed in listUser.jsp else DO NOT display the link.
How can I do that ? I dont know, how to pass UserType information available in baking_login to the listUser.jsp and
second, how can conditionally use that info to either hide or display that hyperlink ?
Your help appreaciated.
thanks in advance
ppYou can use an ADF Faces link component and condition the display attribute for it on the value of your backing bean
There are some samples of conditional display in the posts from Grant here:
http://groundside.com/blog/GrantRonald.php?m=200512
Maybe you are looking for
-
G4 Tower. 4 years old. No power to unit. It is connected to a valid power source (wall socket). I replaced the internal battery as others suggested. I pressed the reset button on the front. No power. Power button does not light. It's just dead. Any o
-
Exporting vs. printing to postscript printer
I guess I am old school, since I have been using Distiller for 13+ years. What do most designers do now?
-
The new iTunes format is horrible
What happened to iTunes? There are so many stupid animations and sub-windows, it takes forever to load the iTunes Store page. The new format to preview songs is horrible too as is the Power Search result window. After doing a Power Search for a Title
-
My mozilla firefox is succesfully installed but it is noy reopening again
ist i was using firefox succesfylly.but after 2 to 3 hrs it stopped responding.thats why i reinstall it.even then it is not working.
-
Once upon a time - I had itunes setup so that I could transfer any downloaded apps that were on my phone to itunes. But ever since I formatted my PC and installed a fresh copy - itunes just wants to delete my apps, so now I have no back up if say ALL