aspose file tools*
The moose likes Struts and the fly likes logic:equal tag not evaluting inside html:button tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic:equal tag not evaluting inside html:button tag" Watch "logic:equal tag not evaluting inside html:button tag" New topic
Author

logic:equal tag not evaluting inside html:button tag

partha chaudhuri
Greenhorn

Joined: Sep 21, 2004
Posts: 27
jsp:useBean id="cart" scope="page" class="com.mpa.admin.valueobject.UsrFuncRightsData"
jsp:setProperty name="cart" property="createRec" value="N"
jsp:useBean

html:button styleClass="clButton" styleId="new" property="newbtn" value="TEST111" disabled="logic:equal name='cart' property='createRec' value='Y' scope='request'

I have the abhove code. I am setting a property in the cart bean.
and in the html:button tag i am using logic:equal tag to evalute whether disabled true or false.
But whatever value i am seeting("Y" or "N" in createRec property), the button tag is always enabled.
Please help me out.
Thanks,
Partha Sarathi Chaudhuri
Vallidevi Appana
Greenhorn

Joined: Jun 30, 2006
Posts: 25
Try out the below code:

Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
You can't nest a logic:equal inside of a html:button tag.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'd suggest using the Struts-el version of the html tags and then using an EL expression to determine whether the button is disabled. Something like this:

<html:button disabled="${cart.createRec == 'Y'}" />


Merrill
Consultant, Sima Solutions
partha chaudhuri
Greenhorn

Joined: Sep 21, 2004
Posts: 27
Thanks Vallidevi for your suggestions. Your code is working perfectly.


Thanks Merrill for your time.
But i could not use your option.
I am using standard struts version 1.2.9( not Struts-el version ).

Now if i want to use your code
<html:button disabled="${cart.createRec == 'Y'}" />
what chages i have to make in my jsp page.

Please help.

Thanks for your time...
Partha

[ July 06, 2006: Message edited by: partha chaudhuri ]
[ July 06, 2006: Message edited by: partha chaudhuri ]
partha chaudhuri
Greenhorn

Joined: Sep 21, 2004
Posts: 27
Hi,
I included the struts-el.jar in my lib directory and struts-logic.tld in the tld directory.
I registered the struts-logic.tld in my web.xml file.
But when i am runing the login.jsp which gives the following error.


500 Internal Server Error
OracleJSP: oracle.jsp.parse.JspParseException: /admin/login.jsp: Line # 3, <%@ taglib uri = "/WEB-INF/lib/taglib/struts-html-el.tld" prefix = "html"%>
Error: java.io.IOException: Error in serialization

Please help me.
Thanks,
Partha Chaudhuri
[ July 06, 2006: Message edited by: partha chaudhuri ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It's the html tag library, not the logic tag library that you need to use.

Put the following in your JSP:

<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>

Make sure you remove any other taglib definitions with prefix="html".

In addition to struts-el.jar, you will also need jstl.jar and standard.jar in your WEB-INF/lib directory if you're using a J2EE 1.3 container. If you're using J2EE 1.4, these are unnecessary.

If you follow these steps, the example code I gave you in my last post should work.
partha chaudhuri
Greenhorn

Joined: Sep 21, 2004
Posts: 27
Thanks Merrill for your time.

I Put the following in my JSP:

<%@ taglib uri="/WEB-INF/lib/taglib/tags-html-el.tld" prefix="html" %>

I put the struts-html-el.tld file in the taglib directory and removed
struts-html.tld.

I registered the tld directory in web.xml file.

I also put struts-el.jar, jstl.jar and standard.jar in my lib directory.

Now I am getting following error.


OracleJSP: oracle.jsp.parse.JspParseException: /admin/login.jsp: Line # 3, <%@ taglib uri="/WEB-INF/lib/taglib/struts-html-el.tld" prefix="html" %>
Error: java.io.UTFDataFormatException


Please help me.
Thanks,

Partha Chaudhuri
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
That isn't the uri that I suggested you use. Try the one I suggested:

<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>

You do not have to remove other TLDs from your /WEB-INF/ directory. Just don't refer to them in this JSP.

The Struts-el tags are "packaged" tag libraries and as such can use "implicit Map Entries" (See JSP 1.2 spec, section 7.3.4), assuming your App Server's web container supports JSP 1.2 or above. Just as you don't have to put a TLD for JSTL tags in your /WEB-INF/ directory, you don't have to for Struts-el tags either.

I'm using WebSphere V 5.1, and I found that using this implicit method was the only way to get the Struts-el tags working. Try it and see if it works for you. Remember that in addition to struts-el.jar, you must also have standard.jar and jstl.jar in your /WEB-INF/lib directory. If you don't have them, you can download them from this link
[ July 07, 2006: Message edited by: Merrill Higginson ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: logic:equal tag not evaluting inside html:button tag