• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

logic:equal

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the equal tag that iam using from the logic tld... but i get the following error:

<logic:equal name="SearchFormBean" property="blnRecsFound" value="true">

where SearchFormBean is the name of the form Bean( methods ublic boolean isBlnRecsFound() & public void setBlnRecsFound(boolean value) )
blnRecsFound is the name of the property, which is of the type boolean
I want to evaluate if blnRecsFound = true, then wud proceed with the block of code mentioned within the <logic:equal> tag.

This is the error iam getting

org.apache.jasper.JasperException: Exception accessing property blnRecsFound for bean SearchFormBean: java.lang.NoSuchMethodException: Unknown property 'blnRecsFound'
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
What mistake am i making?
 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please someone help me on this... iam not able to use the logic:equal tag.
Thanks in advance
 
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe just change the method to getBlnRecsFound()
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts strictly follows Java Bean specification, so the bean properties should have "set" and "get" methods to access them from struts tags.
 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Struts strictly follows Java Bean specification, so the bean properties should have "set" and "get" methods to access them from struts tags.



Can check here too, as per the Java Bean specifications, Boolean variables have their mutators as isPropertyName()
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is SearchFormBean the name of the class or the name of the form you mentioned in your struts-config?

Does your Form class extends the ActionForm-class ??
 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, SearchFormBean the name of the form thatz mentioned in the struts-config.
It does extends the ActionForm-class.
 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can check here too, as per the Java Bean specifications, Boolean variables have their mutators as isPropertyName()



I think it is not the right specification. In this context JavaBean is only simple class. So try getPropertyName() and let us know the result.
 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, its working fine... I still have it as isPropertyName() only in my form class(one that extends ActionForm)

About the specifications that i had mentioned, the same is mentioned in "Struts In Action" book by Ted Husted.
Just quoted a paragraph from the above mentioned book.(Page No: 13)


If the accessor returns a logical value, there is a variant pattern. Instead of using the lowercase token get, a logical property can use the prefix is, followed by the property name. The first character in the property name must be uppercase. The return value will always be a logical value - either boolean or Boolean. Logical accessors cannot accept parameters in their method signature.
The boolean accessor method signature for an on property would be

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your logic tag is fine. Could you post declare, setter and getter for blnRecsFound. What is the bean scope in JSP?
 
Sunil Manheri
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


No, its working fine... I still have it as isPropertyName() only in my form class(one that extends ActionForm)


Then what was wrong?

About the Java bean specification: Struts best practice of coding is making all the form properties as String. So the methods becomes get and set. It does not meant not allowed to use other data types.
[ November 03, 2004: Message edited by: Sunil Manheri ]
reply
    Bookmark Topic Watch Topic
  • New Topic