Problems in developing custom JSP tags

I have problems in debugging custom JSP tags. Sometimes the doStartTag is not called on tags but the doEndTag is called. I don't know why.
Thanks.

Fahr--
A word of caution -- NetUI did not ship a JSP tag SDK in 8.x, and
we're making no compatibility guarantees for custom JSP tags written on
the 8.x release and future releases.
You can accomplish the same sort of functionality with a combination
of the <netui-data:getData> tag and JSTL 1.0. This solution would
probably provide similar functionality and be more future-proof relative
to JSTL and the NetUI tags currently being developed in Beehive.
Hope that helps.
Eddie
Fahr Vegnugen wrote:
We are in the midst of creating our own JSP tags to work with datasources.
In an example where you would need to compare two different datasources how would you do this?
ie.
<prefix:isGreater dataSource="{pageflow.column1}" dataSourceToCompare="{pageFlow.column2}" />
How would I evaluate what column2 is since the tag will only resolve one data source
this.evaluateDataSource();
Any pointers you can provide would be appreciated, or if there is a library of jsp tags that evaluate objects using datasources already created, that would even be better.

Similar Messages

  • Problems with custom JSP Tag, can someone offer some advice?

    Greetings,
    I have a problem here that I am stumped on. I am trying to create a custom JSP tag, I created a simple "Hello World" JSP, however, I am coming up a bit short. I am running Apache Tomcat 6.0 on a Win XP environment.
    The code I have is as follows:
    TLDTest.tld:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
    "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
    <taglib>
         <tlibversion>1.0</tlibversion>
         <jspversion>1.2</jspversion>
         <shortname>firstTag</shortname>
         <info>My First Tag</info>
    <!-- Here goes nothing!!! -->
    <tag>
         <name>hola</name>
         <tagclass>Hola</tagclass>
         <bodycontent>empty</bodycontent>
         <info>a simple hello tag</info>
    <!-- attributes -->
    <!-- Personalize the name -->
    <attribute>
         <name>name</name>
         <required>false</required>
         <rtexpvalue>false</rtexpvalue>
    </attribute>
    </tag>
    </taglib>
    The Hola.jsp is:
    <%@ taglib uri="/Hola" prefix="test" %>
    <html>
         <head>Just a little test on tags</head>
         <body>
              <hr />
              <test:Hola name="Woot Master" />
              <hr />
         </body>
    </html>
    And the source code for the .class file (named Hola) is:
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class Hola extends TagSupport
         private String name = null;
         public void setName(String value)
              name = value;
         public String getName()
              return(name);
    /* doStartTag is called and defined below here for the java tag */
         public int doStartTag()
              try
                   JspWriter out = pageContext.getOut();
                   out.println("<table border=1>");
                        if (name != null)
                             out.println("<tr><td> Hola " + name + "!" + "</td></tr>");
                        else
                             out.println("<tr><td> Hola! Porque tu es una piquito perra? </td></tr>");
              catch (Exception ex)
                   throw new Error("Dio's Mio!, Esta No Va!, tu problema es en la StartTag!!!");
              return SKIP_BODY;
    /* doEndTag is defined here. */
         public int doEndTag()
              try
                   final JspWriter out = pageContext.getOut();
                   out.println("</table>");
              catch (final Exception ex)
                   throw new Error("Oops, it's broken, check your coding in the End tag!!!");
    What I keep getting is the following error:
    org.apache.jasper.JasperException: /Hola/Hola.jsp(6,2) No tag "Hola" defined in tag library imported with prefix "test"
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)
    I've been back and forth on this, but I am lost. Obviously I am missing something, but what is it? It wouldn't be in the web.xml file would it? I am running a vanilla tomcat install. Any help that anyone can provide would be greatly appreciated.
    Sincerely,
    - Josh

    Ok
    1 - In the JSP, your tag should be "hola" not "Hola". Yes case matters.
      <test:hola name="Woot Master" />2 - Importing the taglibrary correctly.
    Either reference its tld <%@ taglib uri="/WEB-INF/Hola.tld" prefix="test" %>
    (and have the tld file sitting in /WEB-INF/Hola.tld )
    or
    Define a uri for it in the tld...
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.2</jspversion>
    <shortname>firstTag</shortname>
    <uri>http://mytag/hola</uri>
    ...and then use that uri to import it in your JSP
    <%@ taglib uri="http://mytag/hola" prefix="test" %>
    3 - Put your tag class in a package. Classes not in packages have a way of not being found.
    package mypackage
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class Hola extends TagSupport {
    ...That will move it in your folder structure to be /mypackage/Hola.java
    You would also need to update the tagclass element in the tld to reflect the change:
    <tagclass>mypackage.Hola</tagclass>4 - Mistake in your tld: You are missing an "r" in "rtexprvalue". <rtexpvalue> should be <rtexp*r*value>
    5 - In your Tag class, you should return something from the "doEndTag()" method.
    return super.doEndTag(); or maybe return EVAL_PAGE;
    Revised code:
    WEB-INF/hola.tld
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
    "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
    <taglib>
         <tlibversion>1.0</tlibversion>
         <jspversion>1.2</jspversion>
         <shortname>firstTag</shortname>
         <uri>http://mytag/hola</uri>
         <info>My First Tag</info>
         <!-- Here goes nothing!!! -->
         <tag>
              <name>hola</name>
              <tagclass>mypackage.Hola</tagclass>
              <bodycontent>empty</bodycontent>
              <info>a simple hello tag</info>
              <!-- attributes -->
              <!-- Personalize the name -->
              <attribute>
                   <name>name</name>
                   <required>false</required>
                   <rtexprvalue>false</rtexprvalue>
              </attribute>
         </tag>
    </taglib>hola.jsp:
    <%@ taglib uri="http://mytag/hola" prefix="test"%>
    <html>
      <head>Just a little test on tags</head>
      <body>
        <hr />
        <test:hola name="Woot Master" />
        <hr />
      </body>
    </html>Hola.java. Compiles into WEB-INF/classes/mypackage/Hola.class
    package mypackage;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class Hola extends TagSupport {
         private String name = null;
         public void setName(String value) {
              name = value;
         public String getName() {
              return (name);
         /* doStartTag is called and defined below here for the java tag */
         public int doStartTag() {
              try {
                   JspWriter out = pageContext.getOut();
                   out.println("<table border=1>");
                   if (name != null)
                        out.println("<tr><td> Hola " + name + "!" + "</td></tr>");
                   else
                        out.println("<tr><td> Hola! Porque tu es una piquito perra? </td></tr>");
              } catch (Exception ex) {
                   throw new Error("Dio's Mio!, Esta No Va!, tu problema es en la StartTag!!!");
              return SKIP_BODY;
         /* doEndTag is defined here. */
         public int doEndTag() {
              try {
                   final JspWriter out = pageContext.getOut();
                   out.println("</table>");
                   return super.doEndTag();
              } catch (final Exception ex) {
                   throw new Error("Oops, it's broken, check your coding in the End tag!!!");
    }Cheers,
    evnafets

  • Custom JSP Tags for Weblogic

    Hi,
              I have several questions regarding this topic:
              1) Does Weblogic 5.1 supports Custom Tags ? If so, are there any known
              problems ?
              2) Does Weblogic come with any tag libraries (for loops, if, etc) and where
              can I get them ?
              3) Are there any tag libraries out there (JRun, for example) that have been
              successfully run on Weblogic ?
              Any help would be much appreciated.
              Thanks,
              Jamie
              

    As there seems to be general interest, a link would probably be a great
              help.
              Regards
              Daniel Hoppe
              -----Original Message-----
              From: Michael Girdley [mailto:[email protected]]
              Posted At: Friday, August 25, 2000 8:03 AM
              Posted To: jsp
              Conversation: Custom JSP Tags for Weblogic
              Subject: Re: Custom JSP Tags for Weblogic
              Please see the documentation:
              http://www.weblogic.com/docs51/resources.html
              Michael Girdley
              BEA Systems Inc
              "Jamie" <[email protected]> wrote in message
              news:[email protected]...
              > Update
              > =======
              >
              > Weblogic Portal has some Tag libraries. I've downloaded the trial
              version
              > of
              > the Weblogic Commerce Server. How do I get the tag libraries and use
              them
              > on WL 5.1 ?
              >
              > Answers to original post still wanted
              >
              > Thanks,
              >
              > Jamie
              >
              > Jamie <[email protected]> wrote in message
              > news:[email protected]...
              > > Hi,
              > >
              > > I have several questions regarding this topic:
              > >
              > > 1) Does Weblogic 5.1 supports Custom Tags ? If so, are there any
              known
              > > problems ?
              > >
              > > 2) Does Weblogic come with any tag libraries (for loops, if, etc)
              and
              > where
              > > can I get them ?
              > >
              > > 3) Are there any tag libraries out there (JRun, for example) that
              have
              > been
              > > successfully run on Weblogic ?
              > >
              > >
              > > Any help would be much appreciated.
              > >
              > > Thanks,
              > >
              > > Jamie
              > >
              > >
              >
              >
              

  • How to render custom JSP tags

    We have our own custom JSP tag libraries (some of them extend the Struts tags, but many do not) and want those to render correctly in the design view.
    Is that supported by NitroX Struts, or will it only work with built-in Struts tags?
    If it is supported, how does one get NitroX to run the custom tags?

    It is possible to customize many aspects of the rendering of a custom tag. This is done using a combination of an M7 specific metadata, and standard css rules.
    For example, you can change the label, icon and border of a custom tag by doing the following steps:
    1) Create a folder named "nitrox" where your tld file is located. For example if you have "/WEB-INF/app.tld" then create a
    folder "/WEB-INF/nitrox/".
    2) In the nitrox folder created above, create a file named "app.tlei" (for Tag Library Extra Information). The file name used here should match the name of the tld file. In this case "app".
    3) Paste the following content in the app.tlei file:
    <taglib-extrainfo>
    <css-uri>app.css</css-uri> <!-- an optional css file relative to this tlei file -->
    <tag name="myTag">
    <display-name>My Tag</display-name> <!-- The name displayed in the Tag Libraries view -->
    <rendering-label>{tag-name} ({name})</rendering-label> <!-- This will display the value of the "name" attribute in addition to the tag name in the tag view in the JSP design editor. -->
    <small-icon>images/myTag.gif</small-icon> <!-- The image uri relative to this tlei file. This is used in the Tag Libraries view and in the JSP design editor.-->
    </tag>
    </taglib-extrainfo>
    All customization tags are optional.
    4) Create the css file referenced from the tlei file above (in this example app.css in the same directory containing the tlei file).
    5) Paste the following content in the app.css file:
    myTag {border: 1 solid red; display: "inline"}
    This will render the tag as inline (i.e as one graphical object) even if the tag has nested content.
    In addition, you can use any standard css style property.
    You can customize other tags in the same fashion.
    If a custom tag inherits from a Struts tag, then the tag can inherit the full built-in tag customization as shown in the following example:
    Suppose you have a tag named "myText" that extends the Struts html:text form field tag. To inherit the NitroX html:text customization you follow the steps:
    1) insert the following in the tlei file described above:
    <tag name="myText">
    <inherit taglib-uid="http://jakarta.apache.org/struts/tags-html" tag-name="text" />
    </tag>
    2) Insert the following css rule in the css file referenced from the tlei file:
    myText {m7-inherit: "input-text"; display: inline}
    This will inherit the built-in css style for form text fields.
    Likewise, you can inherit the other Struts tags css styles by using the following rules:
    myPassword {m7-inherit: "input-password"; display: inline}
    myCancel {m7-inherit: "input-submit"; display: inline}
    myCheckbox {m7-inherit: "input-checkbox"; display: inline}
    myRadio {m7-inherit: "input-radio"; display: inline}
    mySelect {m7-inherit: "select"; display: inline}
    myTextarea {m7-inherit: "textarea"; display: inline}
    3) The inherited tag library file (in this example the struts-html.tld), must also be present under the WEB-INF directory.
    M7 Support

  • Error compiling expressions in custom JSP tags

    We had the same problem and we have found the same solution. Not to nice.
              Jan
              

    Here is what I have set up:
    custom.jsp:
    <%@ taglib uri="/WEB-INF/tlds/mytags.tld" prefix="my" %>
    <!-- <%@ taglib uri="myTags" prefix="my" %> -->
    <HTML>
    <HEAD>
    <TITLE>Custom tag example</TITLE>
    </HEAD>
    <BODY>
    <H1>Custom tag Example</H1>
    <my:wrapper style="k001">
         <b>hello!</b>
    </my:wrapper>
    </BODY>
    </HTML>
    Under WEB-INF/tlds, I placed mytags.tld:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>MyTags</short-name>
    <tag>
    <name>wrapper</name>
    <tag-class>mytaglib.WrapperTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
    <name>style</name>
    <required>true</required>
    </attribute>
    </tag>
    </taglib>
    I've seen examples for jsp-version 1.1 and 1.2. Can you suggest what should be placed in <uri>...</uri>
    Do you think I have a problem with my tomcat config or compiling the java class?
    Thanks.

  • Error with custom JSP tags

    Firstly, thanks for any assistance. The problem I'm facing is that I am using this open source tag library in WebLogic Platform v8.1.5 and it is showing an error when viewed within Workshop. The problematic custom tag was underlined in red by Workshop with the error message "ERROR: This attribute value is not valid." when hovering the mouse over it.
    I tried the other JSP tag specified in the tld file and they were ok. I suspect that there might be an error in one of the Java classes that form the JSP tag. As I hardly do much JSP tag, so my question is my hunch correct? Or should I look elsewhere? The JSP tag in question has an empty <bodycontent> and basically exposes some static variables for use in the JSP page. The tld file is as below and the problematic tag is highlighted in bold. Thank you again for any advise given!
    <?xml version="1.0"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    <taglib>
         <tlibversion>1.0</tlibversion>
         <jspversion>1.1</jspversion>
         <shortname>theme</shortname>
         <uri>http://liferay.com/tld/theme</uri>
         <tag>
              <name>box</name>
              <tagclass>com.liferay.taglib.theme.BoxTag</tagclass>
              <bodycontent>JSP</bodycontent>
              <attribute>
                   <name>top</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>
              <attribute>
                   <name>bottom</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>
         </tag>
         <tag>
              <name>defineObjects</name>
              <tagclass>com.liferay.taglib.theme.DefineObjectsTag</tagclass>
              <teiclass>com.liferay.taglib.theme.DefineObjectsTei</teiclass>
              <bodycontent>empty</bodycontent>
         </tag>
         <tag>
              <name>include</name>
              <tagclass>com.liferay.taglib.theme.IncludeTag</tagclass>
              <bodycontent>JSP</bodycontent>
              <attribute>
                   <name>page</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>
         </tag>
         <tag>
              <name>param</name>
              <tagclass>com.liferay.taglib.util.ParamTag</tagclass>
              <bodycontent>JSP</bodycontent>
              <attribute>
                   <name>name</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>
              <attribute>
                   <name>value</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>
         </tag>
    </taglib>

    nvm..i already fix the problem..

  • How to pass a server side value to an attribute of a custom jsp tag

    Hi All:
    I needed to passed an integer value from the following code:
    <%=ic.getTotalNumOfRecords()%>
    to an attribute of a custom tag
    <inquiry:tableClaimHistory numberOfRecords="5" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    The function getTotalNumOfRecords returns an int.
    The attribute numberOfRecords expects an string.
    Here are the different ways I tried in a jsp page but I get also the following errors:
    1.)
    >
    <%@ include file="../common/page_imports.jsp" %>
    <inquiry:tableClaimHistory numberOfRecords=<%=ic.getTotalNumOfRecords()%> dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    Error Message:
    claimHistoryView.jsp:190:3: Unterminated tag.
    <inquiry:tableClaimHistory numberOfRecords=<%=ic.getTotalNumOfRecords()%> dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    2.)
    >
    <%@ include file="../common/page_imports.jsp" %>
    <inquiry:tableClaimHistory numberOfRecords="<%=ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    Error Message:
    claimHistoryView.jsp:190:4: The required attribute "numberOfRecords" is missing.
    <inquiry:tableClaimHistory numberOfRecords="<%=ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    3.)
    >
    <%@ include file="../common/page_imports.jsp" %>
    <inquiry:tableClaimHistory numberOfRecords="<%ic.getTotalNumOfRecords();%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    Error Message:
    java.lang.NumberFormatException: For input string: "<%ic.getTotalNumOfRecords();%>"
    4.)
    >
    <%@ include file="../common/page_imports.jsp" %>
    <%
    int records1 = ic.getTotalNumOfRecords();
    Integer records2 = new Integer(records1);
    String numberOfRecords2 = records2.toString();
    %>
    <inquiry:tableClaimHistory numberOfRecords="<%numberOfRecords2;%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    error message:
    java.lang.NumberFormatException: For input string: "<%numberOfRecords2;%>"
         at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
         at java.lang.Double.valueOf(Double.java:447)
         at java.lang.Double.(Double.java:539)
         at com.DisplayTableClaimHistoryTag.displayTable(DisplayTableClaimHistoryTag.java:63)
    5.)
    >
    <%
                   int records1 = ic.getTotalNumOfRecords();
                   Integer records2 = new Integer(records1);
                   String numberOfRecords2 = records2.toString();
              %>
              <inquiry:tableClaimHistory numberOfRecords=<%numberOfRecords2;%> dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    error message:
    claimHistoryView.jsp:194:3: Unterminated tag.
              <inquiry:tableClaimHistory numberOfRecords=<%numberOfRecords2;%> dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    In the custom tag java code called "DisplayTableClaimHistoryTag"
    I tried to used the following code:
    >
    InquiryContext ic = InquiryContext.getContext(session);
    >
    The problem is that in order to get session I needed HttpSession object. I don't know how to passed HttpSession "session" object
    to a custom tag. Is there a way to do this?
    >
    public class DisplayTableClaimHistoryTag extends InquiryTag
         String numberOfRecords;
         public void setNumberOfRecords(String numberOfRecords)
              this.numberOfRecords = numberOfRecords;
         public String getNumberOfRecords()
              return numberOfRecords;
         public int doStartTag()throws JspException
              InquiryContext context = (InquiryContext)pageContext.getSession().getAttribute(Constrain.CONTEXT);
              if(context==null)
                   throw new JspException(TAG_EXCEPTION+ "InquriyContext is null.");
              String hasData = (String)context.getAttribute(Constrain.CONTROL_HAS_DATA);
              if(hasData==null)
                   throw new JspException(TAG_EXCEPTION + "The hasData property can not be null.");
              boolean hd = Boolean.valueOf(hasData).booleanValue();
              Debug.println("hasData="+hd);
              Debug.println("hasDataString="+hasData);
              if(hd)
                   displayTable();
              else
                   disPlayError();
              return SKIP_BODY;
         private void displayTable() throws JspException
              String outString ="";
              Debug.println("dispalyTable() ********* dataAction="+ dataAction);
              JspWriter out = pageContext.getOut();
              * Minimum height height= 103,70
              * 21.7 per row
              * First row==103+21.5=124.5
              * Second row ==103+21.5*2=146
              * Third row ==103+21.5*3=167.5
              Double numberOfRecordsBigDouble = new Double(numberOfRecords);
              double numberOfRecordsDouble = 70 + 21.8*numberOfRecordsBigDouble.intValue();
              if(order==null || order.equals("0"))
              //     outString = "<iframe src=\"" + "/inquiry/" + dataAction + "?order=0"+ "\"" + " name=\"dataFrame\" id=\"dataFrame\" height=\""+numberOfRecordsDouble+"\"" +" width=\"100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
              //     outString = "<iframe src=\"" + "/inquiry/" + dataAction + "?order=0"+ "\"" + " name=\"dataFrame\" id=\"dataFrame\" style=\"height:"+numberOfRecordsDouble+"px; width:100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
              //     outString = "<iframe src=\"" + "http://www.google.ca"+ "\"" + " name=\"dataFrame\" id=\"dataFrame\" style=\"height:"+numberOfRecordsDouble+"px; width:100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
              outString = "<iframe src=\"" + "/inquiry/" + dataAction + "?order=0"+ "\"" + " name=\"dataFrame\" id=\"dataFrame\" style=\"height:"+numberOfRecordsDouble+"px; width:100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
              else
                   String orderStr = "?order=" + order;
                   outString = "<iframe src=\"" + "/inquiry/" + dataAction + orderStr + "\"" + " name=\"dataFrame\" id=\"dataFrame\" height=\""+numberOfRecordsDouble+"\"" +" width=\"100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
                   //outString = "<iframe src=\"" + "/inquiry/" + dataAction + orderStr + "\"" + " name=\"dataFrame\" id=\"dataFrame\" height=\"161\" width=\"100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
              Debug.println("dispalyTable() ********* outString = "+ outString);
              try {
                   out.println(outString);
              } catch (IOException e) {
                   this.log.error(TAG_EXCEPTION + e.toString(), e);
                   throw new JspException(e);
    >
    Any hint would be greated appreciated.
    Yours,
    John Smith

    Ok, couple of things
    1 - ALWAYS put quotes around attributes in a custom tag. That rules out items #1 and #5 as incorrect.
    2 - You were correct using the <%= expr %> tags. <% scriptlet %> tags are not used as attributes to custom tags. That rules out #3 and #4
    #2 looks the closest:
    2.)
    <%@ include file="../common/page_imports.jsp" %>
    <inquiry:tableClaimHistory numberOfRecords="<%=ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>Error Message:
    claimHistoryView.jsp:190:4: The required attribute "numberOfRecords" is missing.
    <inquiry:tableClaimHistory numberOfRecords="<%=ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
    Check your spelling of that attribute. It looks right here,.
    You also said that ic.getTotalNumOfRecords returns an int, while the attribute returns a String
    Try
    <%@ include file="../common/page_imports.jsp" %>
    <inquiry:tableClaimHistory numberOfRecords="<%="" + ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/><%= "" + ic.getTotalNumOfRecords %> is the cop-out way to convert an int to a String :-)

  • Custom jsp tags

    Is ther anyway to get a custom tag to accetp ${variableName} syntax instead of <%= variableName %>? Im working with a DynaValidatorForm and the form values don't seem to be accessible via <%= %> calls.
    If there is no other way ot getting variable information into a custom tag, can someone please explain how to extract DynaActionForm form values in a way that will work with custom tags?

    also note that it doesnt need to be a String that is returned , If the variabel you are retrieveing is some Object
    then
    public void setvalue( String value ) throws JspException  {   
    AnObject arg=(AnObject )
    org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate 
    ("value", value, AnObject .class, this, pageContext);    this.value=arg; 
    }

  • Problem with boolean attribute of JSP tag

    Hi,
    I've being trying to use a custom JSP tag, which has a boolean attribute, declared in the TLD as follows:
    <attribute>
    <name>checked</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    <type>boolean</type>
    </attribute>
    The JSP code snippet is:
    <ui:check checked="<%= myBean.isChecked() %>"/>
    where myBean.isChecked() returns a boolean value (primitive type).
    It works fine on some web containers, but it causes a JSP compilation error on Oracle9iAS 9.0.3 Java Edition, which looks like the following:
    Method toBoolean(boolean) not found in class test. _jsp_taghandler_57.setChecked( OracleJspRuntime.toBooleanObject( toBoolean( myBean.isChecked())));
    After decompiling the container's JSP parser, I found what I think it's a bug. The java class generated by the JSP parser does not define a toBoolean method, and neither do its superclasses. The method is defined on the OracleJspRuntime class! I think the correct code would have to be something like:
    OracleJspRuntime.toBooleanObject(OracleJspRuntime.toBoolean(...))
    If I'm correct, then the "convertExpression" method of the "oracle.jsp.parse.JspUtils" class must be changed, because it outputs such wrong code for not just boolean types, but for all the primitive types.
    So, has anyone ever faced this problem before? Does it have a workaround, or a patch? Is it included on the bug fixes for the 9.0.4 release?
    Thanks!

    Instead of:
    out.println("<body onload ="+strAlert+">");
    Try this:
    out.println("<body onload =\""+strAlert+\"">");
    Add two \" around the alert call.

  • Unable to add Custom JSP 1.2 Tag Library to Project

    I am trying to upgrade to a newer version of JDeveloper (10.1.3.0.4) but am having a problem with projects that use custom JSP tag libraries.
    After converting the project (.jpr) files to the new version, I double click and go to "JSP Tag Libraries." When I click on "Add" to add a new JSP Tag library, only JSP version 1.1 libraries are shown, I cannot choose any JSP 1.2 tag libraries.
    my TLD files are all JSP 1.2, so I am not quite sure why this isn't working in a newer JDeveloper after it has worked fine in the past. If I examine any JSP page that uses my taglibs, I see the following 2 kinds of error:
    the line:
    <%@ taglib uri="taglib.uri" prefix="mytag" %>
    is underlined in red and says "the tag library taglib.uri is referenced, but not installed"
    And for any lines that try to use the custom tag:
    <mytag:dosomething>
    there is a yellow/orange underline that says "no grammar available for namespace taglib.uri, contents of element dosomething cannot be validated"
    Note that I can add the taglib JAR file under Tools > Manage Libraries, but I cannot add the JSP tag library to my project. Is there some sort of compatibility issue when transferring project files from an old version of JDeveloper?
    Any help would be appreciated

    Yes any new project I create I can specify JSP 1.2 or 2.0 with the wizard and it works fine.
    But I don't want to re-create my entire project file again just to register my taglibs.
    Here's the JSP related section in web.xml:
    <!-- TagLibraries -->
    <taglib>
    <taglib-uri>taglib.uri</taglib-uri>
    <taglib-location>/WEB-INF/tlds/mytag.tld</taglib-location>
    </taglib>
    It's definately something in the project itself... but I am lost as to what it is.
    Edit: nvm I fixed it. It was the web.xml. I had to change the line:
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    into
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    and it worked. Thanks.
    Message was edited by:
    user523020

  • Nested JSP tags not working in Weblogic 8.1/6.1

    Hi,
              I have a custom JSP tag which are used to display buttons (like Submit, Cancel, Revert, Previous etc) on a web page.
              This custom tag has a structure like
              <gui:toolBar>
              <gui:toolTemplate>...</gui:toolTemplate>
              <gui:button>
              <gui:buttonImg>...</gui:buttonImg>
              <gui:buttonAlt>...</gui:buttonAlt>
              </gui:button>
              </gui:toolBar>
              The <gui:button> tag can be repeated depending on the number of buttons needed to be displayed. The body content of the <gui:button> nested tags are used to populate the values in the <gui:toolTemplate/>.
              The issue is that if I have repetitive <gui:button> tags(meaning if I want to have 2 or more buttons), the page does not get compiled in Weblogic (both 6.1 and 8.1).
              But the same works fine in Websphere 4.x and 5.1.
              There are no exceptions being thrown and hence no clue as to what is the issue.
              If I have only one <gui:button> then it works fine even in Weblogic.
              Note: A link on a similar problem(but no soluton mentioned) is
              http://forums.bea.com/bea/thread.jspa?forumID=2025&threadID=200074523&messageID=202373683&start=-1#202373683
              Please advice.
              Sriram.C.S

    You're right, your situation is very similar to the situation the other poster describes. However, the main similarity is that neither of you have given us any information about what is going wrong. We can't read minds or read what's on your screen. We need to see specific error messages, stack traces, and specific code that shows what you are trying to do.
              However, it's likely that you're running into problems with the issues with "tag reuse" and "tag pooling". You should first read the JSP specification in the areas that talk about this issue, although this will probably leave you with more questions than you started with.
              I'm guessing that your "<gui:button>" element doesn't have any attributes. It's possible that WebLogic is reusing a single "<gui:button>" tag instance for each occurrence in your page. You may have to figure out how to turn off tag pooling in the JSP compiler, but I'm not sure how to do that.
              It's possible that Websphere doesn't give you an issue with this because perhaps they didn't bother with the tag pooling optimization (it is a good thing to have it available).

  • Importing classes that implement jsp tags

              I was making a custom JSP tag library. The tag functionality was implemented in
              a class called, lets cay ClassA. I made the tld file and put it under the WEB-INF
              directory. The class which implemented the functionality was placed under WEB-INF/classes
              directory. I had the imported the tag library using the taglib directive. I was
              getting an error which said "cannot resolve symbol". But when I in the JSP file
              I imported the class file which implemented the taglib functionality the error
              vanished. Is it necessary to import the class files even if the taglib is imported.
              The documentation does not say so. Or is there some configuration I have to make.
              

    I think was a side effect of the .jsp changing redeploys the web app in 6.0.
              When the web app was redeployed your directory structure was reread and thus
              it found your .tld.
              Sam
              "bbaby" <[email protected]> wrote in message
              news:3b422db7$[email protected]..
              >
              > I was making a custom JSP tag library. The tag functionality was
              implemented in
              > a class called, lets cay ClassA. I made the tld file and put it under the
              WEB-INF
              > directory. The class which implemented the functionality was placed under
              WEB-INF/classes
              > directory. I had the imported the tag library using the taglib directive.
              I was
              > getting an error which said "cannot resolve symbol". But when I in the JSP
              file
              > I imported the class file which implemented the taglib functionality the
              error
              > vanished. Is it necessary to import the class files even if the taglib is
              imported.
              > The documentation does not say so. Or is there some configuration I have
              to make.
              >
              >
              

  • Help! writing japanese using jsp tag extension

    Hello Group !
    I'm having problems implementing a simple jsp tag extension.
    I've written a written a short code that is invoked in my tag (see below).
    The code goal is to write two japanese letters. However, all I get are two
    single-byte letters which my browser displays as '?'.
    What should I do to make Weblogic write japanese and not Latin ?
    Should I dynamically mess with the Locale ??
    Any help would be highly appriciated.
    Here's my piece of code:
    public class myBlock extends javax.servlet.jsp.tagext.BodyTagSupport {
    private void parseTagBody() throws IOException, JspException
    ServletResponse response = (ServletResponse) pageContext.getResponse();
    response.setContentType("text/html;charset=EUC_JP");
    pageContext.getOut().write(38498);
    pageContext.getOut().write(39745);
    pageContext.getOut().flush();
    Best,
    Tal Moshaiov

    dataTable might help.
    [example 1|http://www.javabeat.net/tips/46-hdatatable-java-server-faces-jsf.html]
    [example 2|http://www.jsftoolbox.com/documentation/help/12-TagReference/html/h_dataTable.html]

  • How do I pass a local variable as a parameter to a JSP Tag File?

    I wrote a custom JSP tag file, and I want to pass a local variable to it through a parameter, like this:
    <% Integer someValue = new Integer(-5); %>
    <my:TestTag value="someValue"/>
    This doesn't work though - the result is the string someValue. Trying to do this doesn't work either:
    <% Integer someValue = new Integer(-5); %>
    <my:TestTag value="someValue"/>
    the value attribute ends up being null.
    I know I can work arount by putting the local variable in the request attributes then using ${}, but that seems like a lot of unecessary work. Does anyone know I can just pass a local variable to the custom tag through the custom tags parameter list?

    I'm far from beeing an expert, but this may be a clue (?)
    Basically, the rule is: everything you want to be considerred as Java must be in a
    JSP tag.
    As an example, think of how you would do to pass the litteral string "someValue" otherwise. Then you may imagine other related issues...

  • Urgent-how to access custom tag from jsp tag

    I have a problem accessing a custom tag from a jsp expression.
    Details: I have a custom tag that returns a string variable. I need to access that variable from jsp expression <%%>.
    Can any body help me?

    Tags don't "return" values as in the normal sense.
    They can only support TEI (Tag Extra Information) that just stuffs a declared variable into the page's state.
    For example, if the tag class had a public method called getValue(), you could do the following:
    <xmp:mytag id="foo"/>
    <%
    out.println("value is " + foo.getValue());
    %>

Maybe you are looking for