File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes logic:equal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic:equal" Watch "logic:equal" New topic
Author

logic:equal

san geetha
Ranch Hand

Joined: Sep 07, 2004
Posts: 44
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

Joined: Sep 07, 2004
Posts: 44
Please someone help me on this... iam not able to use the logic:equal tag.
Thanks in advance
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Maybe just change the method to getBlnRecsFound()


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Sunil Manheri
Ranch Hand

Joined: Jul 07, 2004
Posts: 32
Struts strictly follows Java Bean specification, so the bean properties should have "set" and "get" methods to access them from struts tags.


TechMindViews - Technical Notes
san geetha
Ranch Hand

Joined: Sep 07, 2004
Posts: 44

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
Bartender

Joined: Jul 19, 2004
Posts: 5131
    
  12

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 ??


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
san geetha
Ranch Hand

Joined: Sep 07, 2004
Posts: 44
Yes, SearchFormBean the name of the form thatz mentioned in the struts-config.
It does extends the ActionForm-class.
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
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

Joined: Sep 07, 2004
Posts: 44
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

Joined: Oct 16, 2002
Posts: 16
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

Joined: Jul 07, 2004
Posts: 32

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 ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: logic:equal
 
Similar Threads
Presentation question
logic tag inside nested:iteration tag
logic equal syntax
How to replace a if(boolean) script with struts tag?
how to break from logic:iterate tag