Tag Files: dynamic attributes

Hello,
I'm not quite sure what the following quote means. It's from the JSP 2.0 spec.
For dynamic-attributes attribute of Tag File:
"Only dynamic attributes with no uri are to be present in the Map; all other dynamic attributes are ignored."

Could someone help me here?

Similar Messages

  • Deferred EL in dynamic attributes

    According to the Sun Java EE 5 tutorial, using deferred EL ( #{} syntax) is forbidden for usage in a tag's dynamic attributes.
    What's the exact use of making this illegal? (what problem does this rule solve?)
    Anyway, I'm asking since I have developed lots of JSF 1.1 components with dynamic attributes that accept EL expressions. Technically it's not a problem. In the tag handler, I just itterate over all collected attributes, check if they're EL using the JSF API and if so create a value binding for them.
    However, in JSP 2.1/JSF 1.2 the container prevents the "#{...}" string from reaching my tag handler code. This is very nasty. I can of course disable container evaluation for the entire page, but this is quite an ugly solution.
    Is there any neat workaround for this problem?

    When in doubt, check
    the 2.1 spec. I'm guessing that the tutorial has a
    doc error.You're right, I checked the (may 2006) JSP 2.1 spec, and on page 2-72, section 3 it says:
    Dynamic attributes must be considered to accept request-time expression values
    as well as deferred expressions.So, the tutorial is definitely wrong.
    Maybe someone should notify Sun about this? It seems most people would resort to reading tutorials first instead of wading through the spec. Especially if a Sun tutorial states something, many people will probably consider it 'official'. Perhaps even the Tomcat folks have read said tutorial instead of the spec. Using an EL value in a dynamic attribute in Tomcat 6 causes a translation error.
    Btw, I'm not 100% sure how to interpret this note from the spec:
    Note that passing a String literal as a dynamic attribute will never be considered
    as a deferred expression.What other way is there to pass a deferred expression than through a String litteral?

  • Spec oversight? Using dynamic-attributes in XML tag files

    I have a couple of tagfiles that generate form elements with specific conventions for the 'name' and 'value' attribute. Basically, a data binding framework.
    Dynamic attributes are useful because you can delegate all the usual html attributes to the generated HTML form element: SELECT, INPUT, id, class etc.
    The usual way to do this is to concatenate all the "pass-through" attributes to a string, and append this string to the element generated:
    <input type="hidden" name="foo" ${dynattrs}/>I'm wondering how to do this in a tagfile in XML format (mytag.tagx), since the XML format forbids syntax like in the example above.
    jsp:attribute won't help much, if it's nested inside a c:forEach: it won't apply to the right element.

    Ran into the same problem with 'optional attributes'. (see post "JSP 2.0 Tag files outputting elements with conditional attributes" http://forum.java.sun.com/thread.jspa?forumID=45&threadID=681033)
    Found a solution that is not very elegant but does work and saves you the trouble of reverting to Java Tags. Consider the following tag-file that outputs an html input-tag with conditional attributes:
    <?xml version="1.0" encoding="utf-8"?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"
         xmlns:c="http://java.sun.com/jsp/jstl/core">
         <jsp:directive.attribute name="name" required="true" type="java.lang.String"/>
         <jsp:directive.attribute name="id" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="value" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="disabled" required="false" type="java.lang.Boolean"/>
         <jsp:directive.attribute name="hint" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="cssClass" required="false" type="java.lang.String"/>
         <jsp:text><![CDATA[<input type="text" name="]]><c:out value="${name}"/><![CDATA["]]></jsp:text>
         <c:if test="${!empty id}"><![CDATA[ id="]]><c:out value="${id}"/><![CDATA["]]></c:if>
         <c:if test="${!empty cssClass}"><![CDATA[ class="]]><c:out value="${disabled?(cssClass + '-disabled'):cssClass}"/><![CDATA["]]></c:if>
         <c:if test="${disabled}"><![CDATA[ disabled="disabled"]]></c:if>
         <c:choose>
              <c:when test="${!empty value}"><![CDATA[ value="]]><c:out value="${value}"/><![CDATA["]]></c:when>
              <c:when test="${!empty hint}"><![CDATA[ value="]]><c:out value="${hint}"/><![CDATA[" onfocus="if(this.value==']]><c:out value="${hint}"/><![CDATA[')this.value='';"]]></c:when>
         </c:choose>
         <jsp:text><![CDATA[/>]]></jsp:text>
    </jsp:root>In answer to your question: Yes, it looks like an oversight. Using the jsp:attribute tag in a c:forEach doesn't work because the attribute is then applied to the forEach tag. You would have to put the attribute-tag inside a jsp:body tag (inside the forEach). Then it would apply not to the forEach tag but to the tag enclosing the forEach. However, this doesn't work either, or at least it doesn't work in Tomcat 5.5. Could be a bug though, JSP 2.0 is still very buggy (for instance, using a tagfile inside another tagfile from the same taglib doesn't seem to work either...)
    Anyway, if you ever find a good solution please let me know by posting to this topic!
    TIA

  • Class as an attribute name in JSP tag file

    I just ran into an issue where I was writing a custom tag to generate a specific set of HTML elements, and wanted to be able to use CSS the same way I had before refactoring it into a tag. So, I included 'class' as an attribute in the custom tag file and deployed.
    On Glassfish v3, this generated a bunch of JasperExceptions in the Javac compilation, complaining about <identifier> expected and reaching the end of file while parsing. I tracked it down, of course, to the use of 'class' as an attribute name, which was reduced to a servlet class defining:
    public String getClass() {
       return this.class;
    public void setClass(String class) {
       this.class = class;
    }I'm curious -- which part of the process messed up here? Is "class" a valid identifier under the Java EE spec, and the translation should have used something like setClass_(String class_)? Or is it invalid, and Netbeans didn't know to mark it as an error before it tried to deploy? (And, of course, that I missed that in the spec, making it my fault.) I couldn't find anything specifically saying that reserved words couldn't be used as JSTL identifiers, so my gut is that the parser messed up. Also, I found a bug report about it for an alternate web container, but no mention of it in the bug trackers for Glassfish, Tomcat or Jasper.
    Where's the blame?

    stdunbar wrote:
    I think that Netbeans messed up. getClass() is, of course, defined on Object and class is a Java keyword.What's to stop the compiler from recognizing that "class" would be a problem and mapping it to an alternate name behind the scenes?
    This is the only documentation I turned up. Maybe this says it's invalid:
    Java EE SpecThe unique name of the attribute being declared. A translation error results if more than one attribute directive appears in the same translation unit with the same name.A translation error results if the value of a name attribute of an attribute directive is equal to the value of the dynamic-attributes attribute of a tag directive or the value of a name-given attribute of a variable directive.

  • Dynamic attribute file name

    Hi All,
              I am trying to use dynamic attribute file name using UDF in message mapping:
    <i>String filename = null;
    filename = "Yahoo";
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://seeburger.com/xi/common" , "dtSubject");
    conf.put(key1,filename);
    return "";</i>
    But its just giving me the name on the receiver side as in the sender side.
    I have checked FileName in Dynamic attributes in the reciever adapter.
    Regards,
    XIer

    your return statement looks like <i>return "";</i>
    Return the filename that you have assigned inside the UDF and can be achieved by
    conf.put(key1,filename);
    <b>return filename;</b>
    Do refer this blog as well
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

  • How to evaluate a bean property passed as attribute to a tag file?

    I wrote the following tag file:
    <%@ tag body-content="empty" %>
    <%@ attribute name="domain" required="true" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <select>
         <jsp:useBean id="codeManagerBean" class="blabla.CodeManagerBean" />
         <c:set var="domainMethod">codeManagerBean.${domain}</c:set>
         <c:forEach var="code" items="${domainMethod}">
              <option value="${code.symbol}">${code.description}</option>
         </c:forEach>
    </select> What I would like is to call a property of CodeManagerBean whose name was passed as an attribute.
    Let's say this tag is used with the attribute domain="currencyCodes", the combo box should be filled with values from CodeManagerBean#getCurrencyCodes().
    The problem is that, in order to define the value of items in the forEach instruction, I declared the variable domainMethod. Now I would like items to evaluate the method (and thus return an iterator in this case), and not a String (what it currently does...).
    Any idea?
    Colargol

    Hi,
    a managed property only gives you a anlde to a bean or property, it doesn't execute it. To execute a bean, you can use a custom JSF PhaseListener that calls a bean method. The reference to the bean is achieve through value binding
    ValueBinding vb = FacesContect.getCurrentInstance().getApplication().createValueBinding("Name of Managed Bean);
    TypeOfBean theBean =(TypeOfBean) vb.getValue(FacesContext.getCurrentInstance());
    .... theBean.theMethod() ...
    Frank

  • Optional attributes in Tag file

    Hi,
    New to tag files here...
    Let's say I have an optional attribute defined in a tag file:
    <%@ attribute name="width" required="false" %>
    <table width="${width}">
    </table>
    How do I detect in the tag file whether that parameter is passed in or not? I want to be able to use a default value for width (say 60%) if it's not passed in, but use the value passed in if provided.
    Thanks,
    Eric.

    <c:if test="${empty width}">
      <c:set var="width" value="60%"/>
    </c:if>Or something like that...

  • Tag File with dynamic name

    I need to include a page with a name I do not know in advance. I can do this with <jsp:include page="${filename}"/>.
    Can I also do it somehow using tag files?

    Atul,
    Are u using mapping program in ur interface? If yes you can go ahead with ASMA + Dynamic Configurations for renaming the file.
    Have u tried this option?
    See the below Solution
    Check the ASMA File for both sender/receiver channels.
    Write the below code UDF in mapping program
    //Get Input date. Don't pass anything to this UDF except the Date.
    //Map the output to the root node of the target.
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String fname = conf.get(key);
    String ret = fname"_"Date
    return "";
    raj.
    Edited by: Raj on Jan 23, 2008 4:09 PM

  • JSP 2.0 Tag files outputting elements with conditional attributes

    It appears to be impossible to conditionally output element-attributes in JSP 2.0 XML Tag files. Here's an example:
    Tagfile text.tagx:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
      <jsp:directive.attribute name="name" required="true" type="java.lang.String"/>
      <jsp:directive.attribute name="id" required="false" type="java.lang.String"/>
      <jsp:text>
        <input type="text" name="${name}" id="${id}" />
      </jsp:text>
    </jsp:root>Seems simple enough. This tag has a name-attribute and an optional id-attribute. But what if I want the id-attribute of the 'input' element not to be outputted when the id-parameter is empty!
    It appears there's no elegant way to do this but to revert to CDATA blocks and/or output-escaping. Is this an oversight in the API or am I missing something?
    I've also tried the following but it didn't work (in Tomcat anyway):
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2" xmlns:c="http://java.sun.com/jsp/jstl/core">
      <jsp:directive.attribute name="name" required="true" type="java.lang.String"/>
      <jsp:directive.attribute name="id" required="false" type="java.lang.String"/>
      <jsp:text>
        <jsp:element name="input">
          <jsp:attribute name="type" value="text"/>
          <jsp:attribute name="name" value="${name}"/>
          <c:if test="${!empty id}">
            <jsp:body>
              <jsp:attribute name="id" value="${id}"/>
            </jsp:body>
          </c:if>
        </jsp:element>
      </jsp:text>
    </jsp:root>Any ideas on how to do this?

    I wonder why no one has responded to this post!!!! I am trying to do the same thing, to no avial. In XSLT this is how it works, I would have thought JSTL would do the same thing. D'oh!

  • JasperException, calling tag with dynamic data

    Hello
    I want to call a tag which I have written with dynamic data.
    I can call the tag like this, and it works fine
    <cm:getCalendar year = "2" week = "51" />But I don't want the input to be hard coded.
    Therefor I have tried to insert GET data to the tag like this
    <cm:getCalendar year = "<%= request.getParameter("year")%>
    " week = "<%= request.getParameter("week")%>" />Or like this
    <cm:getCalendar year = "%{#request.yearNr}" week = "%{#request.weekNr}" />The %{#request.yearNr} should be struts 2 specific I think.
    In both this cases I get this exception
    org.apache.jasper.JasperException: /calendar.jsp(25,0) According to TLD or
    attribute directive in tag file, attribute week does not accept any expressions
    Is there a way which I could insert data dynamic to my own tag?
    Here is the TLD file
    <taglib>
      <tlib-version>1.0</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name></short-name>
      <tag>
           <name>getCalendar</name>
           <tag-class>taglib.PrintCalendar</tag-class>
           <body-content>JSP</body-content>
           <attribute>
                <name>year</name>
                <required>true/false</required>
           </attribute>
           <attribute>
                <name>week</name>
                <required>true/false</required>
           </attribute>
      </tag>
    </taglib>

    I change the tld to
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name></short-name>
    <tag>
    <name>getCalendar</name>
    <tag-class>taglib.PrintCalendar</tag-class>
    <body-content>JSP</body-content>
    <attribute>
    <name>year</name>
    <required>true/false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>week</name>
    <required>true/false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>

  • Issue with project having Tag File containing definition of other Tag File

    Hi Everyone,
    I have a small problem which you experts are able to help with.
    As the subject of this Post has suggested, I have a project which was originally built in NetBean 6.0 and I'm trying to migrate it across to JDeveloper 10.1.3. So far, I've managed to compiled all jsps and java source files successfully but I'm now stuck with the following error messages during building of the project in JDeveloper:
    --- START OF ERROR ---
    Error(6): Unable to instantiate tag: menu:tab (class: oracle.jsp._tag._tabmenu._tab_tag) Make sure that the tag class is available and that the tag library containing the class is not excluded from this application.
    Error(6): Unable to find class for bean: null defined by tag with class: oracle.jsp._tag._tabmenu._tab_tag
    --- END OF ERROR ---
    I believe the reason was that I have this Tag file (menu.tag) that contains definitions and references to another Tag file and here is its content:
    --- START OF TAG FILE ---
    <%@ taglib prefix="menu" tagdir="/WEB-INF/tags/tabmenu" %>
    <%@ attribute name="tab" required="true" type="java.lang.String" %>
    <jsp:useBean id="login" class="au.wa.apa.webbeans.WrsLogin" scope="session" />
    <div id="menu">
    <ul>
    <menu:tab tab="NEW" currentTab="<%=tab%>" label="New Query" tooltip="Create New Query" url="aq/adv_new_query.wrs?formMode=new"/>
    <menu:tab tab="OPEN" currentTab="<%=tab%>" label="Open Queries" tooltip="View Open/Active Queries" url="aq/adv_queries_list.wrs?view=OPEN"/>
    <menu:tab tab="CLOSED" currentTab="<%=tab%>" label="Closed Queries" tooltip="View Closed Queries" url="aq/adv_queries_list.wrs?view=CLOSED"/>
    <menu:tab tab="SEARCH" currentTab="<%=tab%>" label="Search" tooltip="Search Query" url="aq/adv_queries_search.wrs?view=OPEN"/>
    <% if (!"STAFF".equals(login.getUserType())) { %>           
    <menu:tab tab="ATTN" currentTab="<%=tab%>" label="Attention Of" tooltip="Attention Of Administration" url="aq/adv_query_attention_of_list.wrs"/>
    <% } else { %>
    <menu:tab tab="TEMP" currentTab="<%=tab%>" label="Templates" tooltip="Template Management" url="aq/adv_query_template_list.wrs"/>
    <% } %>
    </ul>
    <div class="clear"></div>
    </div>
    --- END OF TAG FILE ---
    I've this problem for several days now and have not been able to solve it and I hope you are able to help me with this problem. Thank you for time and assistance and have a nice day.
    Kind Regards,
    John

    Hi Guys,
    Do we have any workaround to this problem? Any feedback will be welcomed.
    Thanks and Regards,
    John

  • Dynamic Attributes with UDF - NullPointerException

    Hello,
    I want to set the file name of an file receiver by means of setting dynamic attributes in an UDF.
    I use the following code and map the output to the root node of the target message (one input variable is var1)
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String myFileName = var1;
    conf.put(key, myFileName);
    return "";
    When I want to test the mapping using the test tab I get a null pointer exception:
    Exception:[java.lang.NullPointerException] in class com.sap.xi.tf
    Could the reason be, that setting dynamic attributes does not work when testing a mapping as the mapping has to be called by the IE runtime or is there any other reason?

    Hi Florain,
    I can understand, but that is how it is designed because the filename paramter can be picked up only during the runtime. But if you use other parameters like interface, sender name etc you can test it in mapping. Please go to test tab and click on parameters  tab. There you see few parameters for runtime also. You can put some value there and then you can test the mapping and you will not receive that error. You dont have filename there, so thats the reason why you are getting error. Hope in next release SAP would come up with this option.
    Regards,
    ---Satish

  • Seeburger AS2 Adapter - Dynamic Attributes

    Dear all,
    We have a scenario where, we are sending an IDOC from our SAP system via XI to one of our partner using AS2.
    We have to manipulate the file name at the receiver end using the dynamic attributes of the AS2 communication channel.
    As per the documentation and the following threads
    Re: File to AS2 File Name? we have done the necessary configuration in the communication channel. The following activites are done
    Selected the checkbox "Use dynamic attributes"
    Under the Module tab
    In Processing sequence added a new entry
    Number 1
    Module Name : localejbs/Seeburger/solution/as2
    Module Type  : Local enterprise bean
    Module Key   :  "dynfile"
    Under the Module Configuration added the following details
    Module key  :  "dynfile"
    Parameter Name : "http://seeburger.com/xi/AS2/dtAS2FileName"
    Parameter Value : "DYNFILENAME"
    However, I understand that this configuration is incomplete, as somewhere i need to pass the value to the variable "DYNFILENAME".
    As per the thred Re: File to AS2 File Name?, Mr Srinivas Reddy mentioned 5 steps, however I am not clear about the step 3 & 4.
    FYI : What I want to map as the file name is the Parter Profile in the EDIDC40 segment of the idoc and the date+time stamp
    Many thanks for the help , in advance
    Regards : Bobby Bal
    Edited by: Bobby Bal on Sep 20, 2010 9:52 PM

    Hi,
    Use the below UDF in your mapping..
    public String FileName(String a,Container container){
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters()
    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://seeburger.com/xi/AS2","dtSubject");
    conf.put(key, a);
    As per your requirement, Use Concatenate function  Idoc + Date + Time .
    Pass the resultant value to the UDF and pass this to any unused Target node.
    IDOC + Time+Date --> UDF --> Target node.
    In your receiver AS2 adapter, Click on use dynamic attributes and  Subject check boxes.
    If you want to use other Dynamic attributes like dtAS2FileName, dtAS2ContentType ..
    Simply replace the dtSubject with dtAS2FileName or  dtAS2ContentType . No need to use any modules.
    Thanks
    Deepthi.

  • Change non-dynamic attributes of MBeans to dynamic attributes

    Hi All,
    I have legacy code (for WL 8.1), that must run with WL 10.3. There are old Admin scripts for the domain-configuration of the application. During the configuration of the domain, the scripts are trying to set some MBean properties. These properties are non-dynamic, so consuming the change of these properties requires a restart of the Administration Server.
    Is there a way to make these non-dynamic attributes to be dynamic? So, how can I omit the restart(s) of the server?
    The messages in the log file are like this:
    A non-dynamic change has been made which affects the server adminServer. This server must be rebooted in order to consume this change.
    Interestingly, in the log files of the old system (WL 8.1) there is no sign of the need of reboot. In those logs, there is nothing like "non-dynamic", "restart", "reboot".
    József
    Edited by: Jozsef Halasz on 2009.08.03. 15:54

    It is not possible to change the font family of smartstyles. Yes, you are write... Uni-code enable printer cannot support Helve fonts we should use HELVECRYL (cyrillic fonts) else alignment of quantity, amounts all gets truncated.
    Regards,
    SaiRam

  • Displaying dynamic attributes of a sku

    Hi,
    I have added dynamic attributes(key) for a sku and these attributes have further options example:
    colour(key)-red, green
    size(key)-small, large
    I want to display these in my jsp in a similar way based on key.
    Can somebody help me with this.
    Thanks
    Vaishali

    Why you want to go with this dynamic attributes approach ? why dont you go for traditional approach like extending the definition file .
    I have'nt used dynamic attributes but per documentation it says it is less efficient here is the link http://docs.oracle.com/cd/E23507_01/Platform.20073/ATGCommProgGuide/html/s0304extendingtheskuitemtype01.html

Maybe you are looking for

  • Executing same VI multiple times, sending/retrieving data

    I know how to execute a single vi multiple times using the invoke node/reentrant method.  But I am not sure how to send/get data the running vi's. A little background on my project.  I have to test up to 64 units for a long period of time.  When one

  • Bought Quicktime Pro and my computer died, do I have to buy it again?

    I bought Quicktime Pro back in 2006, recently my laptop died and I had to get it a new harddrive. I still have the serial number cause I bought it online. But it says it's an invalid number and I can't use it. Do I have to buy it again? Thank you!

  • Need table name for Output Types and Account Assignment Types

    Hi pl let me know the table name for 1. Account Assignment Type 2. Output Types (All) I need to download some company code specific data for both Pl confirm Warm Regards Vikcy

  • How can I Import music from 2 sources without duplicating music?

    Hello there, Hopefully someone here can help me get my itunes library on track. I have 2 separate music collections on an external hard drive and there is a large overlap of duplicated music on these libraries (however both contain some music that is

  • Assigning Central Autoreaction methods

    Hi all, I am having an issue in the Assignment of Central Autoreaction methods. I have installed CCMS agents on XI systems keeping Solution Manager as the central monitoring system.  In the satellite system --> RZ20 --> All systems monitoring segment