Custom tag attributes and rtexprvalue property

I have created a custom tag. In my .tld file I have added <rtexprvalue>true</rtexprvalue>
for several of the tag's attributes. Now I want to be able to pass values to
these attributes with the expression syntax:
eg <mytagprefix:pager maxRecordCount="{pageFlow.maxRecords}" />
where maxRecords is a public variable in my pageflow.
In my tag code to assign the value of maxRecordCount I have the following:
public void setMaxRecordCount(String maxRecordCount) throws JspException
Object obj = null;
obj = evaluateExpression(maxRecordCount, "maxRecordCount");
if(hasErrors())
reportErrors();
localRelease();
else
pb.setMaxRecordCount(new Long(((String) obj)).longValue());
I keep getting compile time errors in my jsp such as:
Error: no match was found for method setMaxRecordCount(long) in type package.PagerTag.
where package is the package of my custom class PagerTag.
In my pageflow maxRecordCount is a String. I don't understand why it is looking
for a long. Sometimes the error goes away and I thought I had gotten it to work
but then I realized that it was only working as long as the name of my attribute
and the name of my public variable matched and that is not what I wanted to do.
Should I be able to do what I am doing? I can instead pass this to the tag:
<netui-data:getData resultId="maxreccount" value="{pageFlow.maxRecordCount}" />
maxRecordCount="<%=(String) pageContext.getAttribute(\"maxreccount\")%>"
but that is much less convenient.
Thanks for any help.
Robin

Hello,
Yes I forgot to include the faces xml DD. Here are the portions of code relating to the component and renderers:
<render-kit>
<renderer>
<component-family>MyFamily</component-family>
<renderer-type>MyRenderer</renderer-type>
<renderer-class>essaisUn.MyRenderer</renderer-class>
</renderer>
</render-kit>
<component>
<component-type>MyComponent</component-type>
<component-class>essaisUn.MyComponent</component-class>
<component-extension>
<component-family>MyFamily</component-family>
<renderer-type>MyRenderer</renderer-type>
</component-extension>
</component>I changed from "<hello>" to "hello" and I still get the same exception.
Can anyone bail me out?
Thanks in advance,
Julien Martin.

Similar Messages

  • How to get and set custom tag attributes

    How do i get and set custom tag attributes from a jsp page?

    Not sure if this is what your looking for, but....
    example...
    < taglibprefix:testtag attribute1="x" attribute2="y">
    ...of course, the attributes have to be defined in your taglib (.tld) file

  • Custom tag attribute calculated by scriptlet expression

    Hi,
              If I set the rtexprvalue subelement of the attribute element in my tld to
              "true", should I be able to dynamically determine the value of my custom tag
              attribute using a scriptlet expression?
              When I include the custom tag reference:
              <prod:getCategory id="category"
              categoryID="<%=request.getParameter("catID")%>" scope="page"/>
              it actually gets written to the html as:
              <prod:getCategory id="category" categoryID="2133" scope="page"/>
              and is not recognized as a jsp tag.
              I am using weblogic 6.0 sp1.
              Thanks in advance!
              daniel
              

    I had the same problem in a design a couple of months ago and could not get around it so I switched the functionality into code and out of the tag lib.
    I take it you are trying to do something like this?
    <%
    String value="hiworld";
    %>
    <mytaglib:saysomething value="<%=value%>"/>

  • Custom tag attribute question

    How to assign value of expression or variable to custom tag attribute in jsp?

    I had the same problem in a design a couple of months ago and could not get around it so I switched the functionality into code and out of the tag lib.
    I take it you are trying to do something like this?
    <%
    String value="hiworld";
    %>
    <mytaglib:saysomething value="<%=value%>"/>

  • Custom Tag attribute

    Hi folks,
    I am trying to create a custom tag that accepts a java.util.Locale as a parameter, and for some reason the container is giving me all kinds of attitude. Here's the detail:
    ----from the .tld---
    <tag>
           <name>loadMasthead</name>
           <tag-class>uiTagHandlers.LoadMasthead</tag-class>
           <body-content>empty</body-content>
           <description>Paints the masthead for a given page</description>      
           <attribute>
                <name>locale</name>
                <required>false</required>
                <rtexprvalue>true</rtexprvalue>
             <type>java.util.Locale</type>
           </attribute>
      </tag> ---end tld--
    from the jsp-
    <%@ taglib uri="/WEB-INF/simpleUITags.tld" prefix="helper" %>
    <%@ page import="java.util.Locale" %>
    <helper:loadMasthead locale="<%= Locale.US %>" />---end jsp----
    ---from the handler-----
         public int doTagStart() throws JspTagException{
              JspWriter out = pageContext.getOut();
              try{
                   if( locale != null)          
                        out.print( UIHelper.loadMasthead(locale) );
                   else
                        out.print( UIHelper.loadMasthead() );
              }catch( Exception ex ){
                   throw new JspTagException( ex.getMessage() );
         return SKIP_BODY;
         public int doTagEnd() throws JspTagException{
         return SKIP_PAGE;
          * Sets the locale.
          * @param locale The locale to set
         public void setLocale(java.util.Locale locale) {
              this.locale = locale;
    end handler---
    Here's the error I'm getting from the container:
    [8/5/04 12:14:34:704 EDT] 7abbd628 WebGroup E SRVE0026E: [Servlet Error]-[Unable to convert string '<%= Locale.US %>' to class java.util.Locale for attribute locale: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager]: org.apache.jasper.JasperException: Unable to convert string '<%= Locale.US %>' to class java.util.Locale for attribute locale: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
         at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:920)
         at org.apache.jsp._index._jspService(_index.java:84)
         at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    Any ideas what is going on here?
    Thanks in advance,
    Matt

    The taglib always passes a string. The container is supposed to change it to the proper object, but some do not, as it wasn't clear in the original specs (I found various bug reports). My container does not do this properly for taglibs, so I ended up using a bean, which it processed correctly.
    Your container can't figure out how to change the String it receives to the Locale object it's supposed to set the property to.
    I found a similar problem displayed here:
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4727371
    You'd need to check with your container docs to see if yours is supposed to be able to do the conversion. If not, you'll either need to write it yourself or do what I did and use a bean so it never passes a string to begin with.

  • Custom Tag Attribute not correctly rendered

    Hello,
    I made a custom tag and I want the engine to parse dynamic scripts and evaluate them.
    I call the tag like this :
        <form:toolbaritem id="icon_cancelar" action="javascript:listingAction('<%= request.getContextPath() %>/logout.do');" icon="<%= request.getContextPath() %>/images/toolbar/Cancelar_32.gif"/>The icon and action attributes are declared in the tld like so :
              <attribute>
                   <name>action</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>
              <attribute>
                   <name>icon</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>However, the tag is not working with the evaluated expression, receiving "<%= request.getContextPath() %>" instead.
    Any help would be very welcome :) thank you
    Eamerial

    Gotcha........
    First, this is what the jsp spec has to say in sec 1.14.1
    When using scriptlet expressions, the expression must
    appear by itself (multiple expressions, and mixing of expressions and string
    constants are not permitted). Multiple operations must be performed within the
    expression.Simple, isnt it ? All you have to is evaluate the expression as a whole.
    <form:toolbaritem id="icon_cancelar" action="<%="javascript:listingAction('" + request.getContextPath() + "/logout.do;')"%>" icon<%= request.getContextPath() + " /images/toolbar/Cancelar_32.gif " %>"/>cheers,
    ram.

  • How can i use JSTL inside custom tag attribute

    Hi,
    I have one button tag which displays the button with round corner. I will show the button like this:
    <ep:button key="buttons.submit" name="submitBtn" styleClass="But"
              onClick='submitPage(''<c:out value='${buttonName}' />)' />
    I am getting the problem with the above code. how can i use JSTL inside the custom tags.
    Thanks in Advance,
    LALITH

    No. The details are given below:
    I have included the follwing line in web.xml file:
    <taglib>
        <taglib-uri>/tags/button</taglib-uri>
        <taglib-location>/WEB-INF/button.tld</taglib-location>
      </taglib>button.tld file
    <taglib>
         <tlibversion>1.0</tlibversion>
         <jspversion>2.0</jspversion>
         <shortname>button</shortname>
         <tag>
              <name>button</name>
              <tagclass>com.ksi.ep.web.taglib.ButtonTag</tagclass>
              <bodycontent>empty</bodycontent>
              <attribute>
                   <name>name</name>
                   <required>true</required>
                   <rtexprvalue>false</rtexprvalue>
              </attribute>
              <attribute>
                   <name>key</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>
              <attribute>
                   <name>onClick</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>
    </taglib>ButtonTag.java :
    public class ButtonTag extends TagSupport {
       private static final long serialVersionUID = 6837146537426981407L;
         * Initialise the logger for the class
        protected final transient Log log = LogFactory.getLog(ButtonTag.class);
         *  holds the Value of the button tag
        protected String onClick = null;
         *  holds message resources key
        protected String key = null;
         * The message resources for this package.
        protected static MessageResources messages =
                             MessageResources.getMessageResources
                                       ("ApplicationResources");
          *  (non-Javadoc)
          * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
         public int doStartTag() throws JspException {    
            StringBuffer label = new StringBuffer();         
            HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
            try {             
                   log.debug("in doStartTag()");
                   Locale locale = pageContext.getRequest().getLocale();
                 if (locale == null) {
                     locale = Locale.getDefault();
                 log.info("");
                 label.append("<a border=\"0\" style=\"text-decoration:none;color:#FFFFFF\" href=\"JavaScript:");
                 label.append(onClick);
                 label.append("\" >");
                   label.append("<table  onClick=\"");
                   label.append(onClick);               
                   label.append("\" ");
                   if(onmouseout!=null && !"".equalsIgnoreCase(onmouseout))
                    label.append(" onmouseout=\"");
                    label.append(onmouseout);               
                    label.append("\" ");
                   if(onmouseover!=null && !"".equalsIgnoreCase(onmouseover)){
                    label.append(" onmouseover=\"");
                    label.append(onmouseover);               
                    label.append("\" ");
                   if(title!=null && !"".equalsIgnoreCase(title)){
                    label.append(" title=\"");
                    label.append(title);               
                    label.append("\" ");
                   label.append("style=\"cursor:hand\" tabindex=\"1\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"");
                   label.append(request.getContextPath());
                   label.append(System.getProperty("file.separator"));
                   label.append("images");
                   label.append(System.getProperty("file.separator"));
                   label.append("background1.jpg\" > ");
                 label.append("<tr><td width=\"10\"><img  border=\"0\" src=\"");
                 label.append(request.getContextPath());
                   label.append(System.getProperty("file.separator"));
                   label.append("images");
                   label.append(System.getProperty("file.separator"));
                 label.append("leftcorner.jpg\" ></td> ");
                 label.append("<td valign=\"middle\"  style=\"padding-bottom:2px\"><font color=\"#FFFFFF\" style=\"");
                 label.append(styleClass);
                 label.append("\">");
                 label.append(messages.getMessage(key));
                 label.append("</font></td>");
                 label.append("<td width=\"10\" align=\"right\"><img src=\"");
                 label.append(request.getContextPath());
                   label.append(System.getProperty("file.separator"));
                   label.append("images");
                   label.append(System.getProperty("file.separator"));            
                 label.append("rightcorner.jpg\" border=\"0\"  ></td>");
                 label.append("</tr></table></a>");
                 pageContext.getOut().print(label.toString());
              } catch (Exception e) {               
                   log.error("Exception occured while rendering the button", e);
                   throw new JspException(e);
            return (SKIP_BODY);
         * Release all allocated resources.
        public void release() {       
            this.name=null;
            this.key=null;
            this.onClick=null;
    }In my JSP I have mentioned the taglib directive as
    <%@ taglib uri="/tags/button" prefix="ep"%>and
    <ep:button key="buttons.submit" name="submitBtn" styleClass="But"
         onClick='overwritePreApprovals('<c:out value='${transactionalDetails['inPrepList']}' />')' />Servlet.service() for servlet action threw exception
    org.apache.jasper.JasperException: /pages/pms/coordinator/Dashboard.jsp(325,48) Unterminated <ep:button tag
    Thanks,
    LALITH

  • Problem with custom tag attribute types

    Hi,
    I try to figure out how to pass an attribute to a custom tag that is of a type other than "String"?
    In my case, I should pass an attribute with a type of "java.util.ResourceBundle".
    My tag looks like this:
    <tt:cs sel="ab" ce="<%= java.util.ResourceBundle.getBundle("de", Application.getApp().getLocale())%>" />
    I always get the message that the attribute ce is empty.
    Isn't it possible to have attirbutes that are of an other type than string? How could I solve this problem?
    Thanks a lot!
    Regards Patrick

    In JSP 1.2, in the Tag Library Descriptor, you can specify a tagt attribute as
    <attribute>
       <name>attr1</name>
       <required>true|false|yes|no</required>
       <rtexprvalue>true|false|yes|no</rtexprvalue>
       <type>fully-qualified_type</type>
    </attribute> Notice the XML element <type>fully-qualified_type</type>
    Not sure if you can do this in JSP 1.1

  • Custom tag attribute named operation

              Hi,
              I ported a web application from WL6.1sp4 to WL7.0sp2 and expirienced a wired problem.
              All my JSP's did not compile anymore. I received a error message "no setter for
              attribute operation defined", although there was a a method setOperation in the
              current code and there were no code modifications at all.
              After replacing all attributes named operation with opmode the system worked fine
              again.
              Is there any restriction in naming your attributes in custom tags?
              Thanks for help
              Michael
              

              Me again,
              I checked again the parameters of the VM (Sun JDK 1.3.1_06) and tried the the
              different options of the HotSpot compiler. I found out that the problem I reported
              with the last posting can easily be reproduced if you run the VM in HotSpot-Classic
              mode.
              I suppose it is a bug in Sun's VM for Windows. Does somebody have similar expiriences?
              Michael
              "Michael" <[email protected]> wrote:
              >
              >Hi,
              >
              >I ported a web application from WL6.1sp4 to WL7.0sp2 and expirienced
              >a wired problem.
              >All my JSP's did not compile anymore. I received a error message "no
              >setter for
              >attribute operation defined", although there was a a method setOperation
              >in the
              >current code and there were no code modifications at all.
              >
              >After replacing all attributes named operation with opmode the system
              >worked fine
              >again.
              >
              >Is there any restriction in naming your attributes in custom tags?
              >
              >Thanks for help
              >Michael
              

  • Custom tag attribute case insensitive??

    We ran in to an interesting "feature" of custom tags: The attributes in the
              tags seem to be case insensitive.
              For example, if you play with the "tagext/quote" example provided with the
              WebLogic server installation, you can change the line in showcode.jsp to be
              like:
              <quote:code quoteColor="blue" COMMENTCOLOR="purple"
              defaultFont="face=Helvetica color=gray">
              and the generated java servlet code will still call the "setCommentColor()"
              method in the CodeTag class. Almost like it searches for a matching
              "attribute" in the .tld file and uses it. If you put multiple entries in
              the .tld file for different cases, it still picks the first one it finds and
              ignores the case differences.
              The J2EE/JSP spec indicates that custom tags are case sensitive, I assumed
              that is supposed to include their attributes.
              It bit us because we want to have attributes which differ by case only
              (don't ask).
              -Greg
              Check out my WebLogic 6.1 Workbook for O'Reilly EJB Third Edition
              www.oreilly.com/catalog/entjbeans3 or www.titan-books.com
              

    I had the same problem in a design a couple of months ago and could not get around it so I switched the functionality into code and out of the tag lib.
    I take it you are trying to do something like this?
    <%
    String value="hiworld";
    %>
    <mytaglib:saysomething value="<%=value%>"/>

  • Custom tag attribute values..

              hi,
              I have created custom tags from my EJB using ejb2jsp tool. I tried the following,
              1 works and the other doesn't,
              a) This works.
              <mytag:foo param1="<%="test"%>" />
              b) this gives me a "ClassCastException" <% String value = "test"; %> <mytag:foo param1="<%=value%>"
              />
              ----++++++ java.lang.ClassCastException: java.lang.Object at javax.servlet.jsp.tagext.TagData.getAttributeString(TagData.java:165)
              at com.niteo.projects.intelXML.xbrl.ejb.jsp_tags._XBRLContentProvider_se tIdTagTEI.isValid(_XBRLContentProvider_setIdTagTEI.java:37)
              at weblogic.servlet.jsp.StandardTagLib.verifyAttributes(StandardTagLib.j ava:443)
              ----++++++
              I have tried all possible tricks, but this doesn't work. Is there something that
              I missed while creating the custom tag Or is it the way I am using the tag..?
              any help pls...
              thx in advance -jay
              

    It seems like you want to be able to clear the default attribute and set an empty attribute in you custom tag. One way around this would be to pass a blank character in. That would force the default to be cleared with the blank. You could take it a step further and trim the attribute value before storing it. Alternatively you could set an overriding attribute such as:
    <slasher:foo name="slasher" ignorewhatever="true" />
    protected String whatever = "some default Value";
    public void setWhatever(String whatever)
         this.whatever = whatever;
    public void setIgnorewhatever(String ignore)
         if(ignore.equals("true"))
              this.whatever = "";
    }Cliff

  • Using gateway'd URLs in JSP custom tag attributes

    Hello,
    I am running Plumtree G6 using a gateway prefix to gateway Javascript from a remote server. I have recently discovered, thanks to people's help on the forum here, that in certain cases, you need to wrap a URL in a pt:url tag in order for Plumtree to recognize it as a URL that has to be gateway'd (i.e. a URL inside of a Javascript function).
    However, I have a custom tag that contains a contextPath attribute. This custom tag then includes other XML files that get included in the final page that is displayed. I am passing this value as my contextPath:
    <mytag:body sessionName="mysession" campusName="SampleCampus" contextPath="<pt:url pt:href='http://localhost:7021/application/scripts' xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/>"/>
    However, in the resulting content that is created from this custom tag, the contextPath value is still set to <pt:url pt:href=......./>, and not the actual gateway'd URL. I would have thought that Plumtree would have recognized and gateway'd this URL before it got substituted in the custom tag.
    Does anyone have any thoughts on how to get around a problem like this? One thought I had was to get ahold of the gateway URL value and pass that value directly in my contextPath attribute. Is it possible to get that gateway value, or is there a better solution here?
    Thanks again for any help you can provide.

    Chris,
    I added your code, changed the portlet's web service to send a login token for this portlet, and was then getting some ClassNotFoundExceptions related to Axis classes. So, I went and added all of the jar files from the devkit's lib directory (i.e. plumtree\ptedk\5.3\devkit\WEB-INF\lib), recompiled, and those errors went away. But, now I see the following error:
    java.lang.NoSuchFieldError: RPC
         at com.plumtree.remote.prc.soap.QueryInterfaceAPISoapBindingStub.(QueryInterfaceAPISoapBindingStub.java:27)
         at com.plumtree.remote.prc.soap.QueryInterfaceAPIServiceLocator.getQueryInterfaceAPI(QueryInterfaceAPIServiceLocator.java:43)
         at com.plumtree.remote.prc.soap.QueryInterfaceProcedures.(QueryInterfaceProcedures.java:37)
         at com.plumtree.remote.prc.xp.XPRemoteSession.(XPRemoteSession.java:202)
         at com.plumtree.remote.prc.xp.XPRemoteSessionFactory.GetTokenContext(XPRemoteSessionFactory.java:80)
         at com.plumtree.remote.portlet.xp.XPPortletContext.getRemotePortalSession(XPPortletContext.java:261)
         at com.plumtree.remote.portlet.PortletContextWrapper.getRemotePortalSession(PortletContextWrapper.java:45)
         at jsp_servlet._collabrasuite.__riarooms._jspService(__riarooms.java:325)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:417)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6718)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    I am using version 5.3 of the EDK, and running Plumtree Foundation G6. Have you ever seen an error like this before?
    Thanks again for all of your help.

  • Is it possible to set a custom tag attribute from a TagExtraInfo?

    Hi Everyone,
    I'm developing my own tags and I need to set some optional attributes of my custom tag if the user doesn't do it.
    Is is possible to do that on the IsValid method of a TagExtraInfo class?
    The code is running without exceptions but is not setting the attribute.
    My Tag (The optionValue attribute is optional):
    <qe:select name="cars" optionBody="carName" optionValue="carID" />My TagExtraInfo class:
    public class SelectTei extends TagExtraInfo {
        private static final Logger logger = Logger.getLogger(SelectTei.class);
        @Override
        public boolean isValid(TagData tagData) {
            String optionBody = tagData.getAttributeString("optionBody");
            String optionValue = tagData.getAttributeString("optionValue");
            if (optionBody != null && optionValue==null){
                    tagData.setAttribute("optionValue",optionBody);
            //Other validations.... 
            return true;
    }

    CFGadget wrote:
    It's not obvious as to how to set a background color which is by default, black.
    Assuming you mean set the background color of a new image, just set the desired canvas color using hex or a named color ie "red", "white", ...
                    ImageNew([source, width, height, imageType, canvasColor])

  • JSP in custom tag attributes...

    Sirs,
              A very nice feature from a development perspective, would be the ability
              to use JSP code within custom tags. Say I have a page on which I wish
              to give all the information on a widget. Say further that I have
              implemented a tag that writes out all the info of a widget as HTML
              table. I would like to write something like this:
              <mytaglib:widgetTag widgetID="<%=request.getParameter("widget_id")%>"
              />
              As far as I know, in the current implementation of custom taglibs this
              does not seem to be possible. Instead you end up writing something like
              this:
              <mytaglib:widgetTag>
              <mytaglib:getWidget><%=request.getParameter("widget_id")%>"</mytaglib:getWidget>
              <mytaglib:displayWidget />
              </mytaglib:widgetTag>
              Which is much more like a scripting language than a heirarchical XML .
              Now, I could always just use the request object within the tag helper
              classes, but this gives up flexibility and can introduce security
              issues, and it also makes the tags much more difficult to work with...
              In short, we should push for JSP evaluation of tag attributes. Weblogic
              could leap ahead of other app servers in this area (making up for the
              custom tag performance issues, to be solve in sp6) and Sun would, once
              again, follow Weblogic's lead and rewrite the standard to include this
              functionality.
              Regards,
              Carson Gross
              

    Carson,
              Perhaps the problem is that you are treating custom tags like one would
              construct an imperative language. I have never had to put Java or use beans
              or %= or even parameters to tags into a JSP because of custom tags.
              The real problem is writing/packaging/maintaining all those tags; sure could
              use a tool that did just that ;-)
              Peace,
              Cameron Purdy
              [email protected]
              http://www.tangosol.com
              WebLogic Consulting Available
              "Carson Gross" <[email protected]> wrote in message
              news:[email protected]...
              > Sirs,
              >
              > A very nice feature from a development perspective, would be the ability
              > to use JSP code within custom tags. Say I have a page on which I wish
              > to give all the information on a widget. Say further that I have
              > implemented a tag that writes out all the info of a widget as HTML
              > table. I would like to write something like this:
              >
              > <mytaglib:widgetTag widgetID="<%=request.getParameter("widget_id")%>"
              > />
              >
              > As far as I know, in the current implementation of custom taglibs this
              > does not seem to be possible. Instead you end up writing something like
              > this:
              >
              > <mytaglib:widgetTag>
              >
              >
              <mytaglib:getWidget><%=request.getParameter("widget_id")%>"</mytaglib:getWid
              get>
              >
              > <mytaglib:displayWidget />
              > </mytaglib:widgetTag>
              >
              > Which is much more like a scripting language than a heirarchical XML .
              > Now, I could always just use the request object within the tag helper
              > classes, but this gives up flexibility and can introduce security
              > issues, and it also makes the tags much more difficult to work with...
              >
              > In short, we should push for JSP evaluation of tag attributes. Weblogic
              > could leap ahead of other app servers in this area (making up for the
              > custom tag performance issues, to be solve in sp6) and Sun would, once
              > again, follow Weblogic's lead and rewrite the standard to include this
              > functionality.
              >
              > Regards,
              > Carson Gross
              >
              

  • 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.

Maybe you are looking for

  • Cost center account determination

    Hello All, When I created outbound delivery for a sales order, on the goods movement tab, cost center automatically assigned to the line item. Could you please inform me how the system derive this cost center? Thanks in advance! Best Regards, JHeRo

  • Tree based on ViewObject with bindparams

    Hi, We have some pages that are tree-form based; the tree and the form and based on two different viewobject usages, but the same viewobject. This VO uses a bind parameter to limit the data. With JHeadstart we can provide this bindparameter with the

  • SNMP Configuration on solaris10

    Please can anybody put some light on SNMP configuration on Solaris 10.I am newbie on this.I read SMA Agaent on solaris 10 is NET-SNMP compliant.I need to monitor disk usage,CPU load ..So I configured snmpd.conf (inside /etc/sma/snmp) for this.The tra

  • Reference To Serial JButton

    How can I get an individual reference to a JButton that was created 26 times and assigned a different letter of the alphabet? public void createButton(Container panel, String letter) { JButton alphabetButton = new JButton(letter); alphabetButton.addA

  • I m using a MAc 4.1 and can't upgrade to the new OS Maverick,,Have 2 gb onboard

    I tried tomupgrade to the new OS Maverick and it rejected my upgrade.. I am using mAc 4.1 with 2 gb onboard.. Any advise will do cause i dont want to upgrade my ram if not needed cause it is quite costly and my Mac was bought cheap as i ma learning t