• 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 tag not evaluting inside html:button tag

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try out the below code:

 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't nest a logic:equal inside of a html:button tag.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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'}" />
 
partha chaudhuri
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic