Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HtmlInputText NullPointerException  RSS feed

 
Chris Voge
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am totally stumped with a problem.

I have a Faces JSP and a corresponding backing bean

In the faces JSP I have:

h:inputText id="bodybgcolor" value="# {pc_PageProperties.bbgcolor}"
/h:inputText

h:selectOneMenu id="bodyFontType"
value="#{pc_PageProperties.selectedbodyfont}"
f:selectItemsvalue="#{pc_PageProperties.fontlist}"
/h:selectOneMenu

h:inputText id="textnumone" value="#{pc_PageProperties.btxtcolor}" size="20"
/h:inputText


There are other JSF & HTML components on the page, but I'm
mainly concerned with the above.

What I want to do is perform the setStyle method on
the h:inputText fields in the backing bean.

I first perform the get??? methods to instantiate
them in the bean. Then I'll call the setStyle method.

When I try to setStyle on inputtext field "textnumone"
for some odd reason, I am getting a null pointer exception.
I can set the style on the "bodybgcolor" just fine in
the bean.

Example of the "get" method
protected HtmlInputText getTextnumone()
{
if (textnumone == null)
{
textnumone = (HtmlInputText) findComponentInRoot("textnumone");
}
return textnumone;
}

Any help would be greatly appreciated. I hope what I have above isn't
to messy.

Chris
 
Chris Voge
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So... its only the field id="textnumone" that has the problem?

Assuming that if you take this field out does the page run ok?

If so, can you post the exception text, I'll also assume the the managed bean has got the following accessors: getBtxtcolor() and setBtxtcolor(String str)
 
Chris Voge
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your assumptions are correct. My objective on this is to read in a .css file and show the styles from the file on the JSF components( IE. for color attributes, I would show as backgound-color in the h:inputText fields ). If you know of a better way to do this, let me know.

Here is the exception I get: ( PageProperties is my backing bean )

[11/7/05 9:04:03:532 CST] 00000039 SystemErr R java.lang.NullPointerException
at pagecode.pageProperties.PageProperties.procBodyAttrib(PageProperties.java:173)
at pagecode.pageProperties.PageProperties.configureStyles(PageProperties.java:134)
at pagecode.pageProperties.PageProperties.readFile(PageProperties.java:119)
at pagecode.pageProperties.PageProperties.<init>(PageProperties.java:90)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java(Compiled Code))
at java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled Code))
at java.lang.Class.newInstance3(Class.java(Compiled Code))
at java.lang.Class.newInstance(Class.java(Compiled Code))
at java.beans.Beans.instantiate(Beans.java:219)
at java.beans.Beans.instantiate(Beans.java:63)
at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:204)
at com.sun.faces.application.ApplicationImpl.createAndMaybeStoreManagedBeans(ApplicationImpl.java:903)
at com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:84)
at com.sun.faces.el.impl.NamedValue.evaluate(NamedValue.java:125)
at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:146)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:156)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:137)
at javax.faces.component.UIOutput.getValue(UIOutput.java:147)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:84)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:204)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:171)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:762)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:604)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:527)
at com.sun.faces.taglib.html_basic.InputTextTag.doEndTag(InputTextTag.java:673)
at com.ibm._jsp._pageProperties._jspx_meth_h_inputText_0(_pageProperties.java:131)
at com.ibm._jsp._pageProperties._jspx_meth_h_form_0(_pageProperties.java:393)
at com.ibm._jsp._pageProperties._jspx_meth_hx_scriptCollector_0(_pageProperties.java:443)
at com.ibm._jsp._pageProperties._jspx_meth_f_view_0(_pageProperties.java:471)
at com.ibm._jsp._pageProperties._jspService(_pageProperties.java:101)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:670)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:178)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:265)
at com.ibm.faces.context.MultipartExternalContextImpl.dispatch(MultipartExternalContextImpl.java:320)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:254)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:201)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136)
at com.fdc.eMessenger.util.SecurityCheckFilter.doFilter(SecurityCheckFilter.java:84)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:670)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2905)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1829)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:469)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:408)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1455)

Thanks for looking.

Chris
 
Chris Voge
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it out...

I used a value binding for the style attribute:

IE
<h:inputText id="bodytxtcolor" value="#{pc_PageProperties.btxtcolor}" size="20" style="#{pc_PageProperties.btxtstyle}" />


Thanks to everyone who looked at this.

Chris
 
Chris Voge
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forgot to say I also coded the appropriate
getter and setter method for the style in
the backing bean.

Thanks

Chris
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!