I have created a template which utilizes parameters that are passed into it to generate HTML conditionally based on those parameters. For example:
<s:component theme="scaTheme" templateDir="template" template="Header.jsp"> <s:param name="titleKey" value="%{'title.appNpc'}" /> <s:param name="helpPage" value="%{'Non_Premier_Contract_Home_Page.htm'}" /> </s:component> However, I do not wish to require that all the parameters be required. For example, it would be ok if the "helpPage" parameter was not specified. At runtime, everything works fine if I do not specify the "helpPage" parameter. However if I place my logging level at DEBUG, I my log is cluttered with NPEs like the one below. I cannot seem to find any kind of syntax to reference the parameter to even test if it is null without generating this NPE in DEBUG. Does anyone know if it is possible to avoid these NPEs? I make heavy use of templates with optional parameters and it is really cluttering up the logs when trying to debug. Am I doing something wrong? Should this maybe be readdressed in the Struts code base? I understand why the DEBUG statement is logged. Just not sure since it is a DEBUG statement, if the stack trace is warranted. Thanks in advance! 2008-03-14 14:30:14,364 DEBUG (http-127.0.0.1-8080-2:) [com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer] Error while retrieving generic property class for property=parameters java.lang.NullPointerException at com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer.getClass(Gener icsObjectTypeDeterminer.java:222) at com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer.getKeyClass(Ge nericsObjectTypeDeterminer.java:44) at com.opensymphony.xwork2.util.XWorkMapPropertyAccessor.getKey(XWorkMapPro pertyAccessor.java:136) at com.opensymphony.xwork2.util.XWorkMapPropertyAccessor.getProperty(XWorkM apPropertyAccessor.java:68) at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643) at ognl.ASTProperty.getValueBody(ASTProperty.java:92) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) at ognl.ASTChain.getValueBody(ASTChain.java:109) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) at ognl.ASTNotEq.getValueBody(ASTNotEq.java:49) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) at ognl.ASTAnd.getValueBody(ASTAnd.java:56) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) at ognl.Ognl.getValue(Ognl.java:333) at com.opensymphony.xwork2.util.OgnlUtil.getValue(OgnlUtil.java:194) at com.opensymphony.xwork2.util.OgnlValueStack.findValue(OgnlValueStack.jav a:238) at org.apache.struts2.components.Component.findValue(Component.java:322) at org.apache.struts2.components.If.start(If.java:85) at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTag Support.java:54) at org.apache.jsp.template.scaTheme.Header_jsp._jspx_meth_s_005fif_005f0(He ader_jsp.java:273) ----------------------------------------- ***Note:The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the Sender immediately by replying to the message and deleting it from your computer. Thank you. Premier Inc.