Unwanted body evaluation of a custom tag

Following custom tag should output:
[Tag Test]
a
b
c
This is another test
a
b
c
This bad boy!
a
b
c
But, in reality, the output is as follows:
[Tag Test]
a
b
c
This is another test
c
a
b
c
This bad boy!
c
a
b
c
As you can see, everytime the tag is executed, unwanted body evaluation has occured before the assignment to a page-scope variable. What coud be the cause of the problem?
/* tag handler */
package mytag;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
import javax.servlet.http.*;
import java.util.*;
public class foreach extends BodyTagSupport{
  private Iterator iterator;
  private String group;
  public void setGroup(String group){
    this.group = group;
  public  String getGroup(){
    return group;
  public int doStartTag() throws JspException{
    try{
      String[] intarray = new String[] {"a","b","c"};
      ArrayList ar = new ArrayList(Arrays.asList(intarray));
      iterator = ar.iterator();
      if (iterator.hasNext()){
        return EVAL_BODY_BUFFERED;
      else{
       return SKIP_BODY;
    catch (Exception e){
      System.err.println(e);
    return SKIP_BODY;
  public int doAfterBody() throws JspException{
    try{
      if (iterator == null){
        return SKIP_BODY;
      if (iterator.hasNext()) {
        String o = (String)iterator.next();
        pageContext.setAttribute("a1", o);   
        return EVAL_BODY_AGAIN;
      else{
        return SKIP_BODY;
    catch (Exception e){
      System.err.println(e);
    return SKIP_BODY;
  public int doEndTag() throws JspException {
    try {
      pageContext.getOut().print(bodyContent.getString());
    catch(Exception ioe) {
      System.out.println(ioe);
    return EVAL_PAGE;
--test.jsp---
<%@ page contentType="text/html" %>
<%@ taglib prefix="jrun" uri="/WEB-INF/mytag.tld" %>
<html><body bgcolor="lightgreen">
<hr>
[Tag Test]<br>
<jrun:foreach group="itemsql">
${a1}<br>
</jrun:foreach>
<hr>
This is another test<br>
<jrun:foreach group="itemsql">
${a1}<br>
</jrun:foreach>
<hr>
This bad boy!<br>
<jrun:foreach group="itemsql">
${a1}<br>
</jrun:foreach>
<hr></body></html>
--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/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
  <tlib-version>1.0</tlib-version>
  <jsp-version>1.2</jsp-version>
  <short-name></short-name>
  <description>
  </description>
  <tag>
    <name>foreach</name>
    <tag-class>mytag.foreach</tag-class>
    <body-content>JSP</body-content>
    <description>
    </description>
    <attribute>
      <name>group</name>
      <required>true</required>
      <rtexprvalue>true</rtexprvalue>
    </attribute>
  </tag>
</taglib>

Never mind. I've found the cause of my problem. I shoud hava started the iterator in the doStartTag() metod instead of in the doAfterBody().

Similar Messages

  • Jsp:include problem in custom tag

    I call <jsp:include page="emailbody.jsp" /> within a custom tag(in a file
              caller.jsp), which does emailing.
              When I invoke caller.jsp from browser, I do get the output(body of the
              email) on the browser screen, but not the output is not send as the body of
              the email.
              When I use static include namely, <@include file="emailbody.jsp" />, the
              output is directed to the body of the email.
              The above means, for a static jsp include file, it is parsed and included in
              the body-evaluation of the custom tag.
              For a dynamic include file, it is NOT parsed and NOT included in the
              body-evaluation of the custome tag.
              The reason could be, How Weblogic loads classes for custom-tag for dynamic
              include files.
              Can anybody at BEA throw loght on this and the solution.
              Thanks in advance.
              Chandra
              

    Well I found out jsp:include is not supported inside custom tags for JSP
              spec 1.1.
              This was stated in section 5.4.5 of spec 1.1.
              May be in future spec 1.2.
              Thanks
              Chandra
              "Cameron Purdy" <[email protected]> wrote in message
              news:[email protected]...
              > Have you sent this to [email protected]?
              >
              > It sounds serious.
              >
              > Peace,
              >
              > --
              > Cameron Purdy
              > Tangosol, Inc.
              > http://www.tangosol.com
              > +1.617.623.5782
              > WebLogic Consulting Available
              >
              >
              > "matthew mcclain" <[email protected]> wrote in message
              > news:[email protected]...
              > > I have run into the same problem.
              > > I'm certain it's because CustomTags have their own buffer and
              > > jsp:include or pageContext.include() or requestDispatcher.include()
              > > all bypass the buffer and write to the underlying stream.
              > >
              > > I attempted to define jspx:include by wrapping the response object
              > > which is sent to requestDispatcher.include and then wrapping the
              > > OutputStream returned from the response with a stream which
              > > writes to the "out" of the pageContext for my tag.
              > >
              > > Unfortunately, I get a class cast exception because weblogic expects
              > > it's own class to be there as a ServletOutputStream:
              > >
              > > java.lang.ClassCastException:
              com.allmystuff.wif.IncludeServletResponse$1
              > > at
              > >
              >
              weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp
              > > l.java:202)
              > > at
              > >
              >
              weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp
              > > l.java:172)
              > > at com.allmystuff.wif.Include.doStartTag(Include.java:37)
              > >
              > > So any chance, jsp:include will get fixed?
              > >
              > > Thanks,
              > > Matthew McClain
              > > [email protected]
              > >
              > >
              > > "chandra" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > I call <jsp:include page="emailbody.jsp" /> within a custom tag(in a
              > file
              > > > caller.jsp), which does emailing.
              > > > When I invoke caller.jsp from browser, I do get the output(body of the
              > > > email) on the browser screen, but not the output is not send as the
              body
              > > of
              > > > the email.
              > > > When I use static include namely, <@include file="emailbody.jsp" />,
              the
              > > > output is directed to the body of the email.
              > > >
              > > > The above means, for a static jsp include file, it is parsed and
              > included
              > > in
              > > > the body-evaluation of the custom tag.
              > > > For a dynamic include file, it is NOT parsed and NOT included in the
              > > > body-evaluation of the custome tag.
              > > > The reason could be, How Weblogic loads classes for custom-tag for
              > dynamic
              > > > include files.
              > > > Can anybody at BEA throw loght on this and the solution.
              > > > Thanks in advance.
              > > > Chandra
              > > >
              > > >
              > >
              > >
              >
              >
              

  • Dynamic include inside custom tag body

    I am trying to perform the dynamic include of another JSP from within the body of a custom tag using JSP1.1. It cannot be done using <jsp:include> since flush=true is required and thus an exception is thrown when called from inside the body of a custom tag - it can be done in JSP1.2 since flush does not have to be set to true but upgrading is not possible at this time.
    Does anyone know of any custom tag or the code needed to perform this function with JSP1.1?
    I am using Tomcat 3.2.3.
    Using a RequestDispatcher and calling include() does not have the desired effect since the output is witten directly to the response and does not go into the correct position in the calling JSP.
    I think the solution involves making a call to the included JSP (is it possible to use a RequestDispatcher that doesn't write directly to the page output stream?) and then append the response to the BodyContent object which is buffering the body content of the custom tag until the doAfterBody() method is called. Is it possible to create a dummy ServletResponse object to pass to the RequestDispatcher and then obtain the HTML response from the internal buffer?

    I don't know if there is a solution to the problem you are having with JSP 1.1. If you look in the spec, it actually warns you that dynamic includes can not be done inside a body tag. The spec actually states that the included code shout write directly to the response and not to the BodyContent.
    I was excited to find out they had fixed this in JSP 1.2, but they seem to have foiled me again. If my tag calls PageContext.include(), the spec says that include must call the flush method, which causes BodyContent to throw an exception since flush is not a valid call.

  • EL expressions not evaluated in custom tag attribute

    I'm writing a custom tag implementation where I need to have some attribute values
    dynamically evaluated using EL, such that I can write:
    <mytaglib:mytag id="${somevar}"/>
    I cannot seem to accomplish this, however. My taglib tag definition looks like this:
         <tag>
              <name>mytag</name>
              <tag-class>myclass</tag-class>
              <body-content>empty</body-content>
              <description>
    Foo
              </description>
              <attribute>
                   <name>articleId</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
                   <type>java.lang.String</type>
              </attribute>
         </tag>
    The implementation of myclass extends TagSupport (since I need to get at the PageContext). The setArticleId() method looks like this:
    public void setArticleId(String idStr) throws JspException {
    if (logger.isDebugEnabled()) {
    logger.debug("idStr = " + idStr);
    try {
    /* XXX: Somehow, the evaluation should happen automagically, but
    * I can't figure out why that doesn't happen!
    String articleIdStr = (String)pageContext.getExpressionEvaluator().evaluate(
    idStr,
    java.lang.String.class, pageContext.getVariableResolver(), null);
    this.articleId = Integer.parseInt(articleIdStr);
    } catch (ELException e) {
    throw new JspException("Failed to parse article id expression");
    Why does it not work automagically?

    Make sure you are working with a JSP 2 container (like Tomcat 5). Also, you should make sure that your web.xml is configured to use the newest Servlet Spec. Read reply #6 on: http://forum.java.sun.com/thread.jspa?threadID=629437 to make sure it is set up properly.
    If you are not using a JSP 2.0 container, then you will not be able to use EL in your custom tag. See: http://forum.java.sun.com/thread.jspa?forumID=45&threadID=725503 for alternatives.

  • How to access variables passed in custom tag body

    I am developing custom tags in my application. I need to pass some variables from the .jsp file into tag file. I want these to be passed as body of the tag rather than as tag parameter. It seems the correct syntax for this is:
    <myTags:display> someVariable </myTags:display>
    Question 1: Can I not use this as: <myTags:display someVariable /> Since this tag will be used at many places in the jsp, I dont want to write myTags:display twice for every usage.
    Question 2:
    I want to call the tags from main.jsp like:
    <% String var1 = "Display Me Please"; %>
    <myTags:display var1 />I want the tag file to do some processing on the value stored in var1. I've written the following code in tag file, display.tag:
    <jsp:doBody var="theBody" />
    <% Object obj = (Object) request.getAttribute ("theBody"); %>This code snippet gives me access to obj which has the value "var1". Now how do I access the value that is contained in "var1".
    Edited by: coolkomal on Jun 3, 2009 7:45 AM

    coolkomal wrote:
    I am developing custom tags in my application. I need to pass some variables from the .jsp file into tag file. I want these to be passed as body of the tag rather than as tag parameter. It seems the correct syntax for this is:
    <myTags:display> someVariable </myTags:display>
    Question 1: Can I not use this as: <myTags:display someVariable /> Since this tag will be used at many places in the jsp, I dont want to write myTags:display twice for every usage.
    <myTags:display var="<%=someVariable>"/> is a valid syntax for performing respective action of that variable. You can also use EL to pass the variable ${someVariable} provided the custom tag provide support for EL.
    >
    Question 2:
    I want to call the tags from main.jsp like:
    <% String var1 = "Display Me Please"; %>
    <myTags:display var1 />
    Just ensure that you declare all the related variables in Main.jsp and statically include Main.jsp in your jsp such that you do the checking
    [http://java.sun.com/products/jsp/tags/11/syntaxref117.html]
    >
    I want the tag file to do some processing on the value stored in var1. I've written the following code in tag file, display.tag:
    <jsp:doBody var="theBody" />
    <% Object obj = (Object) request.getAttribute ("theBody"); %>This code snippet gives me access to obj which has the value "var1". Now how do I access the value that is contained in "var1".Can be done provided you code it the right way. Start learning basics of how to create custom taglibraries to gain more knowledge on how things can be managed.
    [http://java.sun.com/javaee/5/docs/tutorial/doc/bnalj.html]

  • Custom Tag not evaluating expression in attribute

    I have a custom tag that needs to take dynamic values in the attributes, but I can't seem to get the values "interpreted" correctly. I have the <rtexprvalue> tag set to "true" in my .tld file, which I thought was the only thing that was needed in order to accomplish what I am trying to do. However, that does not seem to be the case.
    I am using WebLogic (8.1.4) and their <netui> tags, along with JSTL tags (1.0).
    An example of what my code looks like is the following:
    <test:myTag id="1" idx="<netui:content value='{container.index}' />">
        <netui:select ... />
    </test:myTag>and
    <c:set var="myIdx" value="<netui:content value='{container.index}' />" />
    <test:myTag id="1" idx="<c:out value='${myIdx}' />">
        <netui:select ... />
    </test:myTag>Neither of the above approaches has worked. In my code for my Tag.java file, I get the literal string values of <netui:content value='{container.index}' /> and <c:out value='${myIdx}' />, respectively, in my idx property.
    Can someone give me any hints as to what I may be doing wrong?
    Thanks.

    Shouldnt that be
    <netui:content value='${container.index}' />Actually, weblogic does not use the '$' prefix before
    their expressions. Fine. Which in turn means weblogic has some custom expression evaluator.
    Note weblogic 8.1
    as a container doesnt implicitly supportexpressions
    and you have to build in that feature into yourtag
    library.Are you referring to the 'isELIgnored' attribute when
    you mentioned the above statement? If not, can you
    explain what you meant by "build that feature into
    your tag library"?
    It's like this - expression language is supported by default in all containers that implement the j2ee 1.4 spec (servlet 2.4/jsp 2.0). Additionally you should also declare your web application to adhere to the 2.4 standards (through the schema definition in web.xml). In applications that refer to the 2.3 dtd but are run on a 2.4 compliant container you can set the 'isELIgnored' attribute to false and use EL. This works because your container anyways supports it.
    If your container doesnt provide support for EL (outside the jstl tags) as is the case with weblogic 8.1, then you can still use expressions by using something like the [url http://jakarta.apache.org/commons/el/]apache common evaluator  package. The difference being that you will have to call the evaluator classes to evaluate the attribute.
    Are there any alternatives that I could use to
    accomplish what I am trying to do?Did the above answer your question?
    ram.

  • Custom tag with no body

     

    The method in your tag handler that is processing your tag (doStartTag()?
              doAfterBody()? doEndTag()?), should return SKIP_BODY if you don't want the
              tag handler to process the body. In your example it doesn't have a body
              anyway, so I guess you should still return SKIP_BODY.
              Hope this helps,
              Kevin Hooke
              In article <95sb9s$2tn$[email protected]>, <[email protected]> writes:
              >Hi,
              >
              >We seem to encounter the following problem:
              >WebLogic JSP engine cannot parse customed tag without a body correctly.
              >E.g., <xyz:foo attrib="value" /> would cause error "no corresponding
              >open tag ...". On the contrary, <xyz:foo attrib="value"></xyz:foo>
              >works fine. Does WebLogic enforces both oepn tag and close tag to be
              >present separately? If yes, is this specified in any of the document?
              >
              >We are using 5.1.
              >
              >Thanks,
              >
              >Xiao Ma
              >
              >
              >Sent via Deja.com
              >http://www.deja.com/
              ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
              http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
              NewsOne.Net prohibits users from posting spam. If this or other posts
              made through NewsOne.Net violate posting guidelines, email [email protected]
              

  • Custom Tag with open body loop

    Hi
    I'm fairly new to custom tags. I want to do something like the following
    index.jsp
    <mytag:allItems>
    ${item.name} ${item.url}
    </mytag:allItems>
    At the moment I have the following which works fine
    menu.tag
    <jsp:useBean id="items" class="com.content.urls"/>
    <c:forEach var="menuItem" items="${items.attachedItems}">
    ${menuItem.name}
    </c:forEach>
    index.jsp
    <mytags:menu />
    The bean returns a list and the tag file produces the urls which is great. However what I would like to do is using the example above not have the content of the loop fixed. For exmaple I could do
    <mytag:allItems>
    ${item.name}
    </mytag:allItems>
    or
    <mytags:menu>
    <li>${item.name}</li>
    </mytags:menu>
    I would also like to leave it so that closing the tag would still produce the list of urls as a default.
    any help much appreciated.

    Rob - replace your forEach with:
    <c:forEach var="menuItem" items="${items.attachedItems}">
        <%@ variable name-given="menuItem" scope="NESTED" %>
        <jsp:doBody />
    </c:forEach>The key here is that the menuItem variable is then exposed to the tag body before it is output.
    then your jsp will be:
    <mytag:allItems>
        <a href="${menuItem.url}">${menuItem.name}</a>
    </mytag:allItems>To do the last bit - you just need to define a variable for the body and then test whether it is set:
    <jsp:doBody var="body" />
    <c:forEach var="menuItem" items="${items}">
        <c:if test="${not empty body}">
            <%@ variable name-given="menuItem" scope="NESTED" %>
            <jsp:doBody />
        </c:if>
        <c:if test="${empty body}">
             <a href="${menuItem.path}">${menuItem.name}</a>
        </c:if>
    </c:forEach>Peter.

  • JSF custom tag body content problem

    Hi, I'm having some problem with a custom tag I built, but the body of the tag content is not rendered correctly.
    I have:<foo:bar>
        <ul>
            <li>blah</li>
            <li>blah</li>
        </ul>
    </foo:bar>
    </pre>But the rendered html source look like this:    <ul>
            <li>blah</li>
            <li>blah</li>
        </ul>
    <!-- beging foo tag -->
    <!-- end foo tag -->The <ul> tags are supposed to be inside of the <!-- begin foo --> & <!-- end foo -->. I've declared in TLD it has JSP content. I've compared to the J2EE tutorial and corejsp book again and again, couldn't figure where I went wrong. So, am I missing something?
    Thanks a lot.

    Use <f:verbatim> around the non-jsf content.
    I.e.<foo:bar>
    <f:verbatim>
        <ul>
            <li>blah</li>
            <li>blah</li>
        </ul>
    </f:verbatim>
    </foo:bar>--
    Sergey : jsfTutorials.net

  • Evaluating custom tag file

    I have an attribute called Template with the following info:
    <html>
    <tr>
    <td><tags:searchResults/></td>
    </tr>
    </html>
    In my results.jsp I have the following:
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/fn.tld" prefix="fn" %>
    <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
    <%@ taglib tagdir="/WEB-INF/tags" prefix="tags" %>
    ${Template}
    When ${Template} gets evaluated it rendeers the html tags properly but never evaluates the <tags:/searchResults/> which is a tag file that just says "search results"
    I'm using Tomcat 5.0.19
    Any help would be appreciated.

    Sorry, but you can't do that. A JSP must be aware of a custom tag at translate time, so you can't embed tag calls in an attribute or JSTL variable or in output from another tag.

  • Tomcat 4.1.12 and custom tags with body

    Hi,
    I had deployed one application in tomcat 3.3.1 which used custom tags with body, and it worked fine, However recently I upgraded that application to tomcat-4.1.12
    and the tags with body stopped giving expected behaviour, however the tags without body are giving expected behaviour, I had a look at generated jsp file...
    I am pasting the generated output here
    jp.co.nttdata.sk._webtier.tagext.FormTag jspxth_sk_form_0 = (jp.co.nttdata.sk._webtier.tagext.FormTag) jspxtagPool_sk_form_action.get(jp.co.nttdata.sk._webtier.tagext.FormTag.class);
    jspxth_sk_form_0.setPageContext(pageContext);
    jspxth_sk_form_0.setParent(null);
    jspxth_sk_form_0.setAction(SKScreenDefinition.SK_I0100 );
    int jspxeval_sk_form_0 = jspxth_sk_form_0.doStartTag();
    if (_jspx_eval_sk_form_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
    if (_jspx_eval_sk_form_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
    javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
    _bc.clear();
    out = _bc;
    jspxth_sk_form_0.setBodyContent(_bc);
    jspxth_sk_form_0.doInitBody();
    do {
    out.write("\r\n<input type=\"hidden\" name=\"rpt_no\" value=\"<%= rpt_no %>\">\r\n<input type=\"hidden\" name=\"optnOpen\" value=\"0\">\r\n<table border=0 cellspacing=0 cellpadding=0 class=\"bdsyl\">\r\n<tr>\r\n<td class=\"innframe\">\r\n\r\n\t<table border=0 cellspacing=0 cellpadding=5 class=\"bgcol_1\">\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������E/td>\r\n\t<td>\r\n\t\t\t<select name=\"rptDivCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOskCodeNameRptDiv != null) nLen = arrOskCodeNameRptDiv.length;\r\n%>\r\n<%\r\n\tfor(int i=0;i<nLen;i++) \r\n\t{\r\n\t\tString cd = arrOskCodeNameRptDiv.getCode();\r\n\t\tString nm = arrOskCodeNameRptDiv[i].getName();\r\n\t\tString value = cd + SKConstants.SEPARATOR + nm;\r\n\r\n\t\tstrSelected = \"\";\r\n\t\tif(cd.equals(rpt_div)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%=value%>\"><%= nm%></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ��� ���E���</td>\r\n\t<td>\r\n\t\r\n\t\t\t<select name=\"prortyCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOskCodeNameProrty != null) nLen = arrOskCodeNameProrty.length;\r\n");
    out.write("%>\r\n<%\r\n\tfor(int i=0;i<nLen;i++) \r\n\t{\r\n\t\tString cd = arrOskCodeNameProrty[i].getCode();\r\n\t\tString nm = arrOskCodeNameProrty[i].getName();\r\n\t\tString value = cd + SKConstants.SEPARATOR + nm;\r\n\r\n\t\tstrSelected = \"\";\r\n\t\tif(cd.equals(prorty)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= value %>\"><%= nm %></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\t\r\n\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������E/td>\r\n\t<td><input type=\"text\" size=4 maxlength=4 name=\"rpt_dt_yyyy\" value=\"<%= rpt_dt_yyyy %>\">��� <input type=\"text\" size=2 maxlength=2 name=\"rpt_dt_mm\" value=\"<%= rpt_dt_mm %>\">���E<input type=\"text\" size=2 name=\"rpt_dt_dd\" maxlength=2 value=\"<%= rpt_dt_dd %>\">��� <input type=\"text\" maxlength=2 size=2 name=\"rpt_dt_hh\" value=\"<%= rpt_dt_hh %>\">���E<input type=\"text\" size=2 maxlength=2 name=\"rpt_dt_mi\" value=\"<%= rpt_dt_mi %>\">���E<span class=\"fsyl_2\">�E����������������E/span></td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ��� ���E���E</td>\r\n\t<td><input type=\"text\" size=20 name=\"rpt_user\" value=\"<%= Util.forHidden(rpt_user) %>\"></td>\r\n");
    out.write("\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������������E/td>\r\n\t<td>\r\n\t\r\n\t\t\t<select name=\"rptRegiUserCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOfUserName != null) nLen = arrOfUserName.length;\r\n\r\n\tfor(int i=0;i<nLen;i++){\r\n\t\tString[] arrTemp = UzUtil.extractTokens(arrOfUserName[i], SKConstants.SEPARATOR);\r\n\t\t\r\n\t\tstrSelected = \"\";\r\n\t\tif(arrTemp[0].equals(rpt_regi_user)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= arrOfUserName[i] %>\"><%= arrTemp[1] %></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\r\n\t\r\n\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������������</td>\r\n\t<td><input type=\"text\" size=70 name=\"rpt_title\" value=\"<%= UzString.forHidden(rpt_title)%>\"> <span class=\"fsyl_2\">�E�E00���E�����E/span></td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ��������E���</td>\r\n\t<td nowrap><textarea wrap=\"physical\" rows=10 cols=72 name=\"rpt_txt\"><%= UzString.htmlEncodeForHidden(rpt_txt) %></textarea> <span class=\"fsyl_2\">�E�E000���E�����E/span>      </td>\r\n");
    out.write("\t</tr>\r\n\t<tr>\r\n\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������E��</td>\r\n\t<td><textarea rows=5 cols=72 name=\"rpt_effct_lmt\"><%= UzString.htmlEncodeForHidden(rpt_effct_lmt) %></textarea> <span class=\"fsyl_2\">�E�E00���E�����E/span></td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���E��� ���</td>\r\n\t<td><textarea rows=5 cols=72 name=\"reappr_cnd\"><%= UzString.htmlEncodeForHidden(reappr_cnd)%></textarea> <span class=\"fsyl_2\">�E�E00���E�����E/span></td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td nowrap class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������������E/td>\r\n\t<td><input type=\"text\" size=4 name=\"rply_prf_dt_yyyy\" maxlength=4 value=\"<%= rply_prf_dt_yyyy %>\">��� <input type=\"text\" size=2 name=\"rply_prf_dt_mm\" maxlength=2 value=\"<%= rply_prf_dt_mm %>\">���E<input type=\"text\" maxlength=2 size=2 name=\"rply_prf_dt_dd\" value=\"<%= rply_prf_dt_dd %>\">��� <input type=\"text\" maxlength=2 size=2 name=\"rply_prf_dt_hh\" value=\"<%= rply_prf_dt_hh %>\">���E<input type=\"text\" maxlength=2 size=2 name=\"rply_prf_dt_mi\" value=\"<%= rply_prf_dt_mi %>\">���E<span class=\"fsyl_2\">�E����������������E/span></td>\r\n");
    out.write("\t</tr>\r\n\t<tr>\r\n\t<td>���</td>\r\n\t<td align=right><input type=\"button\" value=\"���������������\" onClick=\"openOptn()\"></td>\r\n\t</tr>\r\n<!---- ��������������������������������������� ----->\r\n\t<tr id=\"com\" style=\"display:none\">\r\n\t<td colspan=2>\r\n\t\t<table border=0 cellspacing=0 cellpadding=5>\r\n\t\t<tr>\r\n\t\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������������E/td>\r\n\t\t<td>\r\n\t\t\t<select name=\"crrspndUserCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOfUserName != null) nLen = arrOfUserName.length;\r\n\r\n\tif(crrspnd_user.equals(\"\")) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= SKConstants.NOTSPECIFIED %>\">���������������������E/option>\r\n<%\r\n\tfor(int i=0;i<nLen;i++){\r\n\t\tString[] arrTemp = UzUtil.extractTokens(arrOfUserName[i], SKConstants.SEPARATOR);\r\n\t\t\r\n\t\tstrSelected = \"\";\r\n\t\tif(arrTemp[0].equals(crrspnd_user)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= arrOfUserName[i] %>\"><%= arrTemp[1] %></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\t\t\r\n\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������������E/td>\r\n");
    out.write("\t\t<td>\r\n\t\t\t<select name=\"fndngDivCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOskCodeNameFndngDiv != null) nLen = arrOskCodeNameFndngDiv.length;\r\n\r\n\tif(fndng_div.equals(\"\")) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= SKConstants.NOTSPECIFIED %>\">���������������������E/option>\r\n<%\r\n\tfor(int i=0;i<nLen;i++) \r\n\t{\r\n\t\tString cd = arrOskCodeNameFndngDiv[i].getCode();\r\n\t\tString nm = arrOskCodeNameFndngDiv[i].getName();\r\n\t\tString value = cd + SKConstants.SEPARATOR + nm;\r\n\r\n\t\tstrSelected = \"\";\r\n\t\tif(cd.equals(fndng_div)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= value %>\"><%= nm %></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\t\t\r\n\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������E��������</td>\r\n\t\t<td><input type=\"text\" maxlength=4 size=4 name=\"crrspnd_fin_pln_dt_yyyy\" value=\"<%= crrspnd_fin_pln_dt_yyyy %>\">��� <input type=\"text\" maxlength=2 size=2 name=\"crrspnd_fin_pln_dt_mm\" value=\"<%= crrspnd_fin_pln_dt_mm %>\">���E<input maxlength=2 type=\"text\" size=2 name=\"crrspnd_fin_pln_dt_dd\" value=\"<%= crrspnd_fin_pln_dt_dd %>\">��� <span class=\"fsyl_2\">�E����������������E/span></td>\r\n");
    out.write("\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������E��</td>\r\n\t\t<td><input type=\"text\" maxlength=4 size=4 name=\"crrspnd_fin_dt_yyyy\" value=\"<%= crrspnd_fin_dt_yyyy %>\">��� <input type=\"text\" maxlength=2 size=2 name=\"crrspnd_fin_dt_mm\" value=\"<%= crrspnd_fin_dt_mm %>\">���E<input type=\"text\" size=2 maxlength=2 name=\"crrspnd_fin_dt_dd\" value=\"<%= crrspnd_fin_dt_dd %>\">��� <span class=\"fsyl_2\">�E����������������E/span></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������</td>\r\n\t\t<td><textarea rows=8 cols=72 name=\"cause_txt\"><%= UzString.htmlEncodeForHidden(cause_txt) %></textarea> <span class=\"fsyl_2\">�E�E000���E�����E/span></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������E��</td>\r\n\t\t<td><textarea rows=10 cols=72 name=\"crrspnd_txt\"><%= UzString.htmlEncodeForHidden(crrspnd_txt) %></textarea> <span class=\"fsyl_2\">�E�E000���E�����E/span></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������������E/td>\r\n\t\t<td><textarea rows=8 cols=72 name=\"rlps_prvnt_schm\"><%= UzString.htmlEncodeForHidden(rlps_prvnt_schm) %></textarea> <span class=\"fsyl_2\">�E�E000���E�����E/span></td>\r\n");
    out.write("\t\t</tr>\r\n\t\t</table>\r\n\t</td>\r\n\t</tr>\r\n<!---- ��������������������������������������� ���E----->\r\n\t<tr>\r\n\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������������E/td>\r\n\t<td>\r\n\t\t<table border=0 cellspacing=0 cellpadding=0>\r\n\t\t<tr valign=top>\r\n\t\t<td><input type=\"radio\" name=\"mail_sendto_div_radio\" checked onClick=\"mailCheck(true)\" value=\"<%= SKConstants.CD_ONE + SKConstants.SEPARATOR + \"������\" %>\">��������������� <input type=\"radio\" name=\"mail_sendto_div_radio\" onClick=\"mailCheck(false)\" value=\"<%= SKConstants.CD_ZERO + SKConstants.SEPARATOR + \"���������E��\" %>\">���������E��Enbsp; </td>\r\n\t\t<td>\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOskCodeNameGroup != null) nLen = arrOskCodeNameGroup.length;\r\n\tint nExtra = (nLen/2) + (nLen%2);\r\n%>\r\n<%\r\n\tfor(int i=0;i<nLen;i++) \r\n\t{\r\n\t\tString cd = arrOskCodeNameGroup[i].getCode();\r\n\t\tString nm = arrOskCodeNameGroup[i].getName();\r\n\t\tString value = cd + SKConstants.SEPARATOR + nm;\r\n%>\r\n\t\t\t\t<input type=\"checkbox\" name=\"send_mail\" value=\"<%= value %>\"><%= nm %><br>\r\n<%\r\n\t\tif((i+1) == nExtra)\r\n\t\t{\r\n%>\r\n\t\t\t</td>\r\n\t\t\t<td>    </td>\r\n");
    out.write("\t\t\t<td>\r\n<%\r\n\t\t}\r\n\t}//for loop\r\n%>\r\n\t\t</td>\r\n\t\t</tr>\r\n\t\t</table>\r\n\t</td>\r\n\t</tr>\r\n\t<td>���</td>\r\n\t<td align=right><br><input type=\"submit\" value=\"������������\" name=\"saveReport\">���<input type=\"submit\" value=\"���������������������\" name=\"regReport\"></td>\r\n\t</tr>\r\n\t</table>\r\n\r\n</td>\r\n</tr>\r\n</table>\r\n");
    int evalDoAfterBody = jspxth_sk_form_0.doAfterBody();
    if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
    break;
    } while (true);
    if (_jspx_eval_sk_form_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
    out = pageContext.popBody();
    What I found out that scriptlets are also encluded in string however they should not be enclosed.
    Is it a bug? or do I need to change my taghandler class...?
    Any suggestion, any help ll be really helpful
    Regards,
    Susheel

    Hi,
    I am able to resolve it,
    Actually I was using the body content as tagdependent instead of jsp.
    However the body content tagdependent works in Tomcat 3.3.1 and weblogic 5.1, 6.0.
    Anyway...

  • How to create a custom tag for a custom converter

    In Jdeveloper 11g, I have a project where I have created a custom converter class that impements the javax.faces.convert.Converter class. I have registered the converter with an id in the faces-config.xml file of the project, and the converter works fine by using the <f:converter type="myconverter"> tag. However, the custom converter has a field which I would like to set from the tag itself. Hence, I would like to add an attribute to <f:converter> tag if possible or create a custom tag that has the attribute.
    I have done some reserach and I found that a custom tag can be implemented: I need to create a class which extends from the ConverterTag class or javax.faces.webapp.ConverterElTag class, which I did, but I also need to create ".tld" (tag library) file which defines the tag itself.
    The part about creating the ".tld" file and registring the new tag is what I'm not sure how to do.
    Does someone know how to do this?
    thank you

    Hi frank,
    that's a good document, and it explains how to make a custom converter. I already created the custom converter, it converts a number to any currency pattern. I know java already has a currency converter, but it doesn't support Rupee currency format, and I need that format.
    My converter works, but I would like to pass the pattern of the format through an attribute in a tag. Since f:converter doesn't seem to support that, I created a custom tag which uses my converter, and it enables me to pass a pattern to the converter.
    All of that works, but I need to be able to pass the pattern as an EL expression, and it's not evaluating the expression before passing it to the converter. It just passes the whole expression as a string. I'm thinking It may be something I'm doing wrong.
    this is the tag library definition file:
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.2</tlib-version>
    <jsp-version>2.1</jsp-version>
    <short-name>custom</short-name>
    <uri>custom-currency-converter</uri>
    <description>
    custom currency custom tag library
    </description>
    <tag>
    <name>CurrencyConverter</name>
    <tag-class>
    converter.Tag.CurrencyConverterTag
    </tag-class>
    <body-content>JSP</body-content>
    <attribute>
    <name>pattern</name>
    <type>java.util.String</type>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    Edited by: Abraham Ciokler on Feb 4, 2011 11:20 AM

  • Problem using jsp:include from inside a custom tag

    Hi, All !
              I have a problem using <jsp:include> from inside a custom tag. Exception is:
              "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              could not do this. Is it a bug, since in the 1.1 spec is said: "The
              BodyContent is a subclass of JspWriter that can be used to process body
              evaluations so they can retrieved later on."
              My code is:
              <wfmklist:items>
              <jsp:include page="item.jsp" flush="true"/>
              </wfmklist:items>
              

    This is an area of contention with WL. It is not so tolerant with regards to
              the spec. I spent several days recently trying to convince it to accept the
              specification in regards to bodies and includes and it appears to have
              successfully rebuffed my efforts.
              Frankly, this is very disappointing. It appears that some shortcuts were
              taken on the way to JSP 1.1 support, and the result is a very hard-coded,
              inflexible implementation. As I have not seen the implementation myself, I
              hate to assume this, however one could posit that the term "interface" was a
              foreign concept during the implementation, other than as some annoying
              intermediary reference requiring an immediate cast to a specific Weblogic
              class, which in turn is apparently required to be final or have many final
              methods, as if being optimized for a JDK 1.02 JIT.
              I am sorry that I don't have any positive suggestions other than to use a
              URL object to come back in an execute the necessary "include" directly. You
              lose all context (other than session) and that can cause its own problems.
              However, you can generally get the URL approach to work, and you will
              hopefully avoid further frustration.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              Tangosol: How Weblogic applications are customized
              "Denis" <[email protected]> wrote in message
              news:[email protected]...
              > Hi, All !
              > I have a problem using <jsp:include> from inside a custom tag. Exception
              is:
              > "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              >
              > Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              > could not do this. Is it a bug, since in the 1.1 spec is said: "The
              > BodyContent is a subclass of JspWriter that can be used to process body
              > evaluations so they can retrieved later on."
              >
              > My code is:
              > ...
              > <wfmklist:items>
              > <jsp:include page="item.jsp" flush="true"/>
              > </wfmklist:items>
              > ...
              

  • Problem in using jsp 1.1 custom tag library in websphere

    I am using was 3.5.2. Everything has been installed properly. I am using jdeveloper 3.2 for building the jsp application using custom tag library. But when I run the jsp file in browser, its gives dr. watson on java.exe. I am using websphere 3.5.2 application server.
    Have any body got this type of prob. ...
    pls respond asap.
    Thanks in Advance
    Yogesh

    Let me explain the problem again
    I am using was(websphere) 3.5.2. Everything has been installed properly. I am using jdeveloper 3.2 for building the jsp application using custom tag library.
    Application works fine in JDeveloper 3.2.
    Application works fine even when deployed on JRun 3.0. ( we are evaluating various web servers).
    How when deployed on WAS and I run the jsp file in browser, its gives dr. watson on java.exe. I am using websphere 3.5.2 application server.
    WAS has typical settings as against JRun and Tomcat and may be I have not set the necessary paths.
    Have any body got this type of prob. ...
    pls respond asap.
    Thanks in Advance
    Yogesh
    null

  • Custom Tag Problem

    I have implemented what I thought was a simple custom tag to handle if
              conditions. In the page that I am using to test this new tag, I have
              two instances of this tag - one right after another - the second of
              which is giving me an error in parsing the page saying that there is a
              close tag for which there is no start. The page looks like this:
              <prefix:if expr="<%=expr here%>" >
                   <p>some text</p>
              </prefix:if>
              <prefix:if expr="<%=expr here%>" >
                   <p>some more text</p>
              </prefix:if>
              Where prefix is really the prefix I identified in my taglib directive
              and "expr here" are two different boolean expressions.
              I have search the page for an errant closing tag - but they are all
              matched up just fine. At first I had these tags nested - and thinking
              that was the problem - I unrolled the nesting so that the start and
              end pairs were always matched up - i.e. an end for this tag always
              came after the start without an intervening start for the same tag.
              But doing that unrolling had no effect - and I always seem to get the
              error on the second close tag being encountered by the parser.
              My tld file specifies the body content for this tab as JSP and the
              expr attribute as a run-time evaluated attribute which is required. My
              tag class file extends TagSupport and implements the doStartTag and
              setExpr() methods.
              This problem occurrs for me running both WLS 5.1 SP5 and SP6.
              Is there something simple that I am missing here? Note also that I
              have two other custom tags which work just fine in the same page -
              however both of those tags specify an empty bodycontent.
              

    I found my problem - as I had thought I had a typo - I was missing the
              '=' between expr and the quoted expression in the second tag. I sure
              wish my eyes would quit filling in those missing pieces! :)
              On Wed, 08 Nov 2000 13:21:47 GMT, [email protected] (Scott Jacobs)
              wrote:
              >I have implemented what I thought was a simple custom tag to handle if
              >conditions. In the page that I am using to test this new tag, I have
              >two instances of this tag - one right after another - the second of
              >which is giving me an error in parsing the page saying that there is a
              >close tag for which there is no start. The page looks like this:
              >
              ><prefix:if expr="<%=expr here%>" >
              >     <p>some text</p>
              ></prefix:if>
              ><prefix:if expr="<%=expr here%>" >
              >     <p>some more text</p>
              ></prefix:if>
              >
              >Where prefix is really the prefix I identified in my taglib directive
              >and "expr here" are two different boolean expressions.
              >
              >I have search the page for an errant closing tag - but they are all
              >matched up just fine. At first I had these tags nested - and thinking
              >that was the problem - I unrolled the nesting so that the start and
              >end pairs were always matched up - i.e. an end for this tag always
              >came after the start without an intervening start for the same tag.
              >But doing that unrolling had no effect - and I always seem to get the
              >error on the second close tag being encountered by the parser.
              >
              >My tld file specifies the body content for this tab as JSP and the
              >expr attribute as a run-time evaluated attribute which is required. My
              >tag class file extends TagSupport and implements the doStartTag and
              >setExpr() methods.
              >
              >This problem occurrs for me running both WLS 5.1 SP5 and SP6.
              >
              >Is there something simple that I am missing here? Note also that I
              >have two other custom tags which work just fine in the same page -
              >however both of those tags specify an empty bodycontent.
              

Maybe you are looking for