tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chen, Gin" <Gin.C...@NielsenMedia.com>
Subject RE: Logic:Equal Question.
Date Thu, 08 May 2003 17:54:23 GMT
In case what I posted wasnt very clear:
I believe the logic tag does something like:

paymentReviewForm.get("hasResults"); and that is not going to work as
hasResults in not actually in the mapping for paymentReviewForm.

Does that make sense? I'm a bit tired right now and therefore not too
articulate :P
Let me know if I should explain it a bit more.
-Tim

-----Original Message-----
From: Chen, Gin [mailto:Gin.Chen@NielsenMedia.com]
Sent: Thursday, May 08, 2003 1:51 PM
To: 'Tag Libraries Users List'
Subject: RE: Logic:Equal Question.


I don't think the error is in the way that your invoking it but rather it is
a feature of struts.
In struts. DynaForms are maps. So that a property such as hasResults etc is
actually in a map with key of hasResults and value. Therefore DynaForms
never need getters and setters.
So I wonder if the logic tag realizes that and is therefore going to the map
for hasResults rather than following the standard javabean logic.
As a way to test it. Change your logic statement (dont forget the closing
tag) to:
<c:if test="${not paymentReviewForm.hasResults}">
...
</c:if>

Since c is a jstl tag and is not part of the struts framework. it will still
try to do standard javabean conventions on your dynaform bean.
-Tim

-----Original Message-----
From: John De Lello [mailto:JohnD@DelWare.com]
Sent: Thursday, May 08, 2003 12:18 PM
To: taglibs-user@jakarta.apache.org
Subject: Logic:Equal Question.


Hi Everyone,

I extended DynaValidatorForm to a class called "VWDynaValidatorForm" and I
added a protected boolean called "hasResults" I also added a setter and
getter for this property. The getter is called "getHasResults()"

My struts config file looks like:

****************************************************************************
*********************
   <form-beans>
        <form-bean
            name="paymentReviewForm"
            type="com.vwks.ing.form.VWDynaValidatorForm">
            <form-property name="source"            type="java.lang.String"
initial="I"/>
            <form-property name="name"              type="java.lang.String"
/>
        </form-bean>
    </form-beans>

    <action-mappings>
       <action path="/PaymentReviewDispatchAction"
 
type="com.vwks.ing.action.payment.PaymentReviewDispatchAction"
                  scope="request"
                  name="paymentReviewForm"
                  validate="false"
                  parameter="dispatchTo">
                  <forward name="display"
path="/web/payment/paymentReview.jsp"/>
                  <forward name="search"
path="/web/payment/paymentReview.jsp"/>
          </action>
    </action-mappings>

In my dispatch action class I am doing this:



        	VWDynaValidatorForm vwForm = (VWDynaValidatorForm) form;
	// a whole unch of other stuff..

          	vwForm.setHasResults(false);
	
	return mapping.findForward("search");
****************************************************************************
*********************

Now, in my JSP I need to conditionally display some text based on where
"hasResults" is set to true or not. Here is what I am trying to do:

	<logic:equal value="false" name="paymentReviewForm"
property="hasResults" scope="request">
            	<tr align='center' bgcolor="#FFFFFF"><td colspan='4'
class="whiteResults"><br>No records were found matching your
criteria.</td></tr>
	</logic:equal>

This generates the following error:
	javax.servlet.ServletException: Exception accessing property
hasResults for bean paymentReviewForm: java.lang.NoSuchMethodException:
Unknown property 'hasResults' 

How do I tell the logic tag to access the "getHasResults" method that is in
my extended class??

Thank you
John


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message