• Post Reply Bookmark Topic Watch Topic
  • New Topic

Value printed extra time with in jsp panel

 
Abhra Kar
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
          I am new in JSF. Below code snippet is used in my codebase. With this code I get "ABC" printed 2 times on a panel with heading TEST".But I should get only one time.If I remove <hx:jspPanel> then I will get "ABC" printed 1 time but below the panel with heading TEST, not in the panel.

<p:collapsiblePanel id="123" title="Test" collapsible="false">
                        <f:facet name="toolbar">
                             <hx:jspPanel>
<c:out value="ABC" />
                             </hx:jspPanel>
                        </f:facet>


Please Suggest how to resolve this issue.

Thanks
Abhra
 
Tim Holloway
Bartender
Posts: 18415
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure who provides the jspPanel tag or what it does, but the "jsp" in its name is troubling. JSF does not use JSPs and has not for many years now.

Also, the JSTL tags are not recommended in JSF. They are for JSPs and JSF does not use JSPs, as I said.

Try replacing the "c:out" element with a "h:outputText". It may not help, since I do suspect that the jspPanel tag is not appropriate, but it's still better than c:out.
 
Abhra Kar
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Tim,
                       I used h:outputText instead of c:out so  am getting only one ABC printed.But I am getting a separate problem.My Text is in aaa.porperties file, so I tried below options to print only ABC ---

1><h:outputText value= aaa.printValue/>
2>h:outputText value= "aaa.printValue"/>
3>h:outputText value= #{aaa.printValue}/>
4>h:outputText value= "#{aaa.printValue}"/>
5>h:outputText value= "ABC"/>

I am getting output --
ABC!!jsftagmarker!!!jsftagmarker!

If I use the blow code then I will get parse exception -

<h:outputText value= "${aaa.printValue}"/>


Please suggest what I can put against value attribute or should I use any other attribute.
Thanks
Abhra
 
Abhra Kar
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
            I have tried <h:outputText value= '#{aaa.printValue}'/> but result is same.I am usring WAS 8.5 for development.Please advise how to solve it.

Thanks
Abhra
 
Tim Holloway
Bartender
Posts: 18415
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The EL expression "#{aaa.printValue}" is the correct one. The "$" notation should work, but the difference between $ and # is that $ retrieves a value (read-only) where # establishes a reference (read/write). In JSF, we usually don't bother with $ and use # for everything, since it's a superset of the $ expression abilities.

In current versions of JEE, the EL implementation is the Unified Expression Language (UEL). It is not only for JSF but any JEE page resources. It is a therefore a good idea to become well-studied in EL.

The other stuff you are getting is probably a mis-configuration of the IBM hx tag library for the webapp, but I've never used it, so I cannot assist further.

Please note that EL cannot directly read and display values from properties files or any other file or database. EL references beans, so "aaa" should be a Resource bean that loads the properties file into itself. It would then have to present "printValue" as a readable property, which meant that it would have to contain a "getPrintValue()" method. Or, alternatively it would have to present a data resource such as a hashMap and the EL expression would be something like "#{aaa.values['printValue;']}" where the "getValues(key)" method of the aaa bean would access the map values.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!