• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logic:equal

 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Please someone help me on this... iam not able to use the logic:equal tag.
Thanks in advance
 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe just change the method to getBlnRecsFound()
 
Sunil Manheri
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • 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
  • 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()
 
Roel De Nijs
Sheriff
Posts: 10603
143
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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

 
Trevor Whitehead
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic