Assigning bean property to custom tag's attribute

1. The #{beanName.property} notation can only be used inside JSF tags.
2. The attributes of custom tags does not accept embedded tags.
e.g. <prefix:tagName attrib1="<jsftag>">
I need to assign a bean's property to the attrib1 attribute. how do I do this?

Alternatively, how can I assign the value of a bean property to a variable?
e.g.
<%
int var=<bean.property>
%>
I can use the variable on the custom tag like this:
<prefix:tagName attrib1="<%=var%>"> OR
But this may not be the best solution though because I have to use scriptlets...

Similar Messages

  • Custom Tag and Attribute Not Found

    Hi,
    I've been getting an error with the following code in a JSP called cardDeclined.jsp...
    <gwps:log level="ERROR" message="<%= request.getAttribute("errorMessage") %>" />gwps:log is a custom tag and errorMessage is a request attribute set in a servlet that includes my JSP. When I execute the program, I get a message from the servlet container (Tomcat 3.2.3) stating that "attribute 'errorMessage' has no value".
    I wrote some test code that dumps out "errorMessage"; that seemed to work. The JSP request object has a value for "errorMessage." So, I now use the following workaround...
    <% String message = (String)request.getAttribute("errorMessage"); %>
    <gwps:log level="ERROR" message="<%= message %>" />I'm looking for a reference describing how request and session variables can be passed to the custom tag
    Thanks,
    CW

    I think you might be having a problem with the quotes. Try this instead:
    <gwps:log level="ERROR" message='<%= request.getAttribute("errorMessage") %>' />
    Notice the single quotes around the scriptlet.

  • 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 Error with Weblogic SP9

              Hi
              I seem to be having a problem with a custom tag that I wrote. When I run the JSP
              on WLS (without a service pack), the generated java code uses the weblogic.utils.StringUtils
              class to interprete jsp expressions that are passed into the custom tag's attribute
              (on the JSP). The method called on this StringUtils class is valueOf(). This method
              in essence makes sure that the result of the expression is not null and then subsequently
              calls a toString() on the value. Note that if the value is null it simply returns
              an empty string.
              The problem is that when we go to service pack 9, this method is not called (StringUtils.valueOf()).
              Now the problem arises if first of all the result of the expression statement
              in the custom tag definintion (on the JSP) is null. Secondly, it will also error
              out when the setter method is called within the custom tag, if the object returned
              from the expression does not match the one that is expected by the tag... in our
              case a String.
              Here's a sample usage of the tag:
              <wescombop:selectTag
              selectName="buildingNumber"
              selectedItem="<%= buildingJB.getBuildingNumber()%>"
              trimSelectedItem="true"
              selectTagDataName="buildingNumberDataAttribute" />
              Note: buildingJB.getBuildingNumber() returns BigDecimal
              Here's a snipett of the line generated java:
              * Without the service pack
              comwestfieldgrp_wescom_bop_view_tag_SelectTag_1.setSelectedItem(weblogic.utils.StringUtils.valueOf(buildingJB.getBuildingNumber()));
              *With Service Pack 9
              comwestfieldgrp_wescom_bop_view_tag_SelectTag_1.setSelectedItem(buildingJB.getBuildingNumber());
              Note: The setSelectedItem() method expects a String object as a parameter, so
              the code with service pack 9 will result in a compilation error, since buildingJB.getBuildingNumber()
              returns a BigDecimal.
              Let me know if you need more explanation.
              Has anyone experience this problem before... Any help would be deeply appreciated.
              Thanks all.
              Niran
              

              Modify the <cewolf:param> tag.
              <cewolf:chart id="confchart" title="Reports" type="bar3d" yaxislabel="Time"> <cewolf:data>
              <cewolf:producer id="report"> <cewolf:param name="type" value="all" > </cewolf:param>
              </cewolf:producer> </cewolf:data> </cewolf:chart>
              "Balakrishnan" <[email protected]> wrote:
              >
              >We are using cewolf charting library in weblogic 7.0. The charting library
              >is implemented
              >as custom jsp tag library module.
              >
              >However, when the use the tag for displaying the chart, weblogic is producing
              >this compiler error.
              >
              >/reports/reportsView.jsp(108): no corresponding open tag for tag extension
              >close:
              >//[ null; Line: 108]
              >
              >Here's the corresponding source of the jsp file:
              >
              > <cewolf:chart id="confchart" title="Reports" type="bar3d" yaxislabel="Time">
              > <cewolf:data>
              > <cewolf:producer id="report">
              > <cewolf:param name="type" value="all" /> (<-- Error occurs
              >here.
              >Line no: 108)
              > </cewolf:producer>
              > </cewolf:data>
              > </cewolf:chart>
              >
              >I've also checked the corresponding tld file and it is in place.
              >
              >The same code without any modifications is working fine in tomcat. Can
              >you please
              >let me know what needs to be corrected to make this work?
              

  • Custom Tag is missing required attribute property

    Hello,
    Here is my struts config file source;
    <global-forwards>
              <forward name="mainpage" path="/index.jsp">
              </forward>
              <forward name="CustomerDetailsForward" path="/GoToCustomerPage.do">
              </forward>
         </global-forwards>
         <!-- Action Mappings -->
         <action-mappings>
              <action path="/SubmitCustomerForm" type="action.SubmitCustomerForm" name="CustomerForm" scope="request" validate="true" input="/CustomerDetails.jsp">
                   <forward name="success" path="/Success.jsp">
                   </forward>
                   <forward name="failure" path="/Failure.jsp">
                   </forward>
              </action>
              <action path="/GoToCustomerPage" type="org.apache.struts.actions.ForwardAction" parameter="/CustomerDetails.jsp">
              </action>
         </action-mappings>
    And my index.jsp source;
    <html:html>
    <head>
    <html:base/>
    </head>
    <body>
    <html:button></html:button>
    <html:link forward="CustomerDetailsForward">Go To Customer Form </html:link>
    </body>
    </html:html>
    And here is the error;
    Error Message:JSPG0227E: Exception caught while translating /index.jsp: /index.jsp(13,1) --> JSPG0006E: Custom Tag is missing required attribute property
    Root Cause:com.ibm.ws.jsp.translator.JspTranslationException: JSPG0227E: Exception caught while translating /index.jsp: /index.jsp(13,1) --> JSPG0006E: Custom Tag is missing required attribute property     at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.visitCustomTagStart(ValidateVisitor.java:304)     at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:267)     at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:309)     at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:268)     at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:309)     at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:139)     at com.ibm.ws.jsp.translator.visitor.JspVisitor.visit(JspVisitor.java:121)     at com.ibm.ws.jsp.translator.JspTranslator.processVisitors(JspTranslator.java:121)     at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJsp(JspTranslatorUtil.java:181)     at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJspAndCompile(JspTranslatorUtil.java:83)     at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:349)     at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:317)     at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:226)     at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:131)     at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:270)     at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:308)     at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:472)     at com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:111)     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)     at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)     at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)     at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)     at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)     at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)     at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)     at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)     at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)     at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)     at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)

    volkov wrote:
    Error Message:JSPG0227E: Exception caught while translating /index.jsp: /index.jsp(13,1) --> JSPG0006E: Custom Tag is missing required attribute propertyWhich is line 13 then? And check the syntax for that tag.

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

  • 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: pass my own type in as attribute

    I thought I can pass any type as attribute into my custom tag. I tried, but failed. The exception is:
    org.apache.jasper.JasperException: Unable to convert '${myType}' to class MyTpye for attribute myAttribute: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager.
    I know I can pass the value in using PageContext attribute. However, still want to figure out how to do it through custom tag attribute.
    Here's my taglig file:
    <tag>
    <name>myTag</name>
    <tag-class>MyTagClass</tag-class>
    <body-content>empty</body-content>
    <attribute>
    <name>myAttribute</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    <type>MyType</type>
    </attribute>
    </tag>
    What am I missing here? Thanks.

    Hi
    Pls tell me how did you resolve this issue. I am also facing the same problem.
    Thanks
    Prakash

  • 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 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%>"/>

  • Why it cannot find the setter method for the attribute in my custom tag?

    Hi, i have a custom tag like this:
    <robin:category tModelKey="#{data.tModelKey}" > </robin:category>And in my tld file:
    <tag>
          <name>category</name>
         <tag-class>category.component.HtmlCategoryTag</tag-class>
         <attribute>
             <name>tModelKey</name>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
             <type>java.lang.String</type>
         </attribute>
    </tag>
    ........................................and in my HtmlCategoryTag Class
    public class HtmlCategoryTag extends HtmlPanelGridTag
    private String tModelKey;
    public String getTModelKey()
    return tModelKey;
    public void setTModelKey(String modelKey)
    tModelKey = modelKey;
    So,you see,generally speaking,to use a custom tag,we only to write a tag class,declare it in the tld file,nothing more.
    What fints me is that if i change "tModelKey" to "test" and change the according part in the tag class , tld file and jsp file, the "setter not found" problem no longer exists,everything goes right!!!.
    So why this happens? please help:)
    Best Regards:)
    Robin

    Then you also need to create a UI element that extends HtmlPanelGrid
    that has a tModelKey member and getters/setters. That object will hold
    the information so that you can use it in your bean.Whoops... ignore that! Sorry. Attributes are simply stored in the component map component.getAttributes().
    Add to your Tag class:
    public void setProperties(UIComponent component) {
        super.setProperties(component);
        Tags.setString(component, "tModelKey", tModelKey);
    public void release() {
        // see above
    }Where Tags.java is:public class Tags {
        public static void setString(UIComponent component, String attributeName, String attributeValue) {
            if (attributeValue != null) {
                if (UIComponentTag.isValueReference(attributeValue)) {
                    setValueBinding(component, attributeName, attributeValue);
                } else {
                    component.getAttributes().put(attributeName, attributeValue);
        public static void setValueBinding(UIComponent component, String attributeName, String attributeValue) {
            FacesContext context = FacesContext.getCurrentInstance();
            Application app = context.getApplication();
            ValueBinding vb = app.createValueBinding(attributeValue);
            component.setValueBinding(attributeName, vb);
    }

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

  • ApplicationResources.properties value as custom tag attribute value

    I have a custom tag which takes 4 parameters, can accept static strings or expressions.
    I would like to send in the value of a key in my ApplicationResources.properties file as one of the values for my attributes but i'm unsure how to do so. I have not found any pertinent information out there either, is this even possible?
    Thanks,
    JP

    you can, but you can't nest tags like this:
    <my:tag attr="<bean:message key="abc">">
    so you'd have to do this, presuming the attribute allows rtexpressions:
    <%
    MessageResources mr = (MessageResources)application.getAttribute(Globals.MESSAGES_KEY); // or the bundle name
    Locale locale = (Locale)session.getAttribute(Globals.LOCALE_KEY);
    %>
    <my:tag attr="<%=mr.getMessage(locale, "abc") %>">

  • Using a custom tag inside another tag's attribute value?

    Hi all,
    I have a custom tag, mytag:link, whose use currently looks like this:<mytag:link path="/images/logo.gif"/>Nevermind what the tag does. Here's its 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.1.1</tlib-version>
        <jsp-version>1.2</jsp-version>
        <short-name>My custom tags TLD</short-name>
        <tag>
            <name>link</name>
            <tag-class>test.MyLinkTag</tag-class>
            <body-content>empty</body-content>
            <description>...</description>
            <attribute>
                <name>path</name>
                <required>true</required>
                <rtexprvalue>true</rtexprvalue>
            </attribute>
        </tag>
    </taglib>I want to replace the path argument of the mytag:link tag to the result of the evaluation of another tag (a SiteMesh decorator tag) like this:<mytag:link path="<decorator:getProperty property="meta.logo"/>"/>This, of course, doesn't work, as I get the following error:org.apache.jasper.JasperException: /decorator.jsp(34,92) equal symbol expected
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
         org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:193)
         org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:143)
         org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1328)
         org.apache.jasper.compiler.Parser.parseElements(Parser.java:1564)
         org.apache.jasper.compiler.Parser.parse(Parser.java:126)
         org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
         org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.opensymphony.module.sitemesh.filter.PageFilter.applyDecorator(PageFilter.java:156)
         com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:59) If I replace the call to the other tag with
    <mytag:link path="<%=someVariable%>"/>then it all works fine. This behavior seems correct, as the SiteMesh getProperty tag is writing its output to the Writer returned by pageContext.getOut() as it should. As such, this seems to be a design question, then. How are you supposed to do this?
    Thanks in advance,
    Matthew

    Note that I've also posted a question to the SiteMesh user forums about this. It has more information about the motivation of this question.
    See http://forums.opensymphony.com/thread.jspa?threadID=8561
    I'm still looking for an answer, though.
    --matthew                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Custom tag with rendered attribute

    Is it possible to create a custom tag that operates similar to a JSF tag with the rendered attribute? Wrapping output with c:if test="..." is not as nice as the JSF rendered option, but I don't want to use JSF for this particular project.
    Edited by: black_lotus on Nov 23, 2007 12:13 PM

    TLD File, per your previous recommendation:
    <attribute>
         <name>disabled</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <type>boolean</type>
    </attribute>My Tag class (snippet):
    public class ButtonTag extends TagSupport
      private boolean disabled;
      public ButtonTag() {}
      public boolean isDisabled()
         return disabled;
      public void setDisabled(boolean b)
        disabled = b;
    }A sample of the jsp file invoking it:
    <c:set var="result" value="${computedValue}"/>
    <ltm:button disabled="${result}"/>Regardless of the value of result, ("true" or "false") it always passes false to the setDisabled method of the button tag class.

Maybe you are looking for

  • Boot from an iMac?

    This is complicated.  Bear with me.  I have this recurring problem with the MacBook.  It is running OS 10.6.8.  About once every 11 to 12 months it gets some software problem.  I don't know how specifically how it starts, because the problem does not

  • Query on Resource_View

    I have a function that accepts an xmltype (pXml) as an agrument and will return the Resource Type (Link(L), File(D), or Folder(F)). The first part of the function works fine: EXTRACTVALUE(pXML, '/Resource/XMLRef') IS NULL EXTRACTVALUE(pXML, '/Resourc

  • Panic when connecting to VPN

    Hi We have several users who are getting panics when connecting to our VPN from home. They are configured to use either PPTP or IPSEC (they can choose either) and it happens across multiple macbooks, though not all, and when connecting to either type

  • Dial up mobility

    how do I get dial up mobility?

  • Database not starting automatically

    OS windows 2000 server database 8i I have changed sid of database successfully and manually database is opening up but it is not starting up automatically with machine startup.