Using StringMatchFilter in Log4J XML Config. File?

I'm trying to use the StringMatchFilter in an appender to determine based on the contents of the message when to send an email, when testing with single words it works great. For example if the message has "Here is a DEBUG" and my "StringToMatch" value is DEBUG then that message is correctly identified. However if I want to match on more specific string like "Here is DEBUG" for my "StringToMatch" value it will match on every message that has the word "Here" in it anywhere. So it would incorrectly match on "Here is a WARN" when the "StringToMatch" value specified is "Here is DEBUG". Below are my two files I'm using to run my test. How should I specify a string with embedded spaces for this to work? I've tried with single quotes inside the double quotes like this: "'Here is DEBUG'" but it still matched on 'Here'.
My XML Config. file looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="EMAIL"  class="org.apache.log4j.net.SMTPAppender">
          <param name="BufferSize" value="512" />
          <param name="SMTPHost" value="???" />
          <param name="From" value="???" />
          <param name="To" value="???" />
          <param name="Subject" value="Test LogMessage" />
          <layout class="org.apache.log4j.PatternLayout">
                  <param name="ConversionPattern" value="[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n" />
          </layout>
          <filter class="org.apache.log4j.varia.StringMatchFilter">
                  <param name="StringToMatch" value="Here is DEBUG" />
                  <param name="AcceptOnMatch" value="true" />
          </filter>
          <filter class="org.apache.log4j.varia.LevelRangeFilter">
                  <param name="LevelMax" value="FATAL"/>
                  <param name="LevelMin" value="DEBUG"/>
          </filter>
  </appender>
  <root>
    <appender-ref ref="EMAIL"/>
  </root>
</log4j:configuration>and my test java code looks like this:
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
public class Test{
   static Logger logger = Logger.getLogger(Test.class);
   public static void main(String args[]) {
      DOMConfigurator.configure("/home/agsteam/testing/log4j/Test.xml");
      logger.debug("Here is DEBUG");
      logger.info("Here is some INFO blah");
      logger.warn("Here is some WARN");
      logger.error("Here");
      logger.fatal("fatal here");
}In the above example code every logger message matches, the debug, info, warn, error and fatal all match because of the the 'here' that is found in the message, even though the filter StringToMatch values has "Here is DEBUG".
Thanks for any help.

There's an XML parser in the tomcat common diretories. Check out the documentation for XML parser on www.java.sun.com for descriptions.
Basically there's two levels of XML parsing, the first generates "events" for tags, attributes etc. the second comiples into a tree of Node objects.

Similar Messages

  • Urgent: UWL XML Config file

    Hi all!
    I copied the business object EXTSRV to ZEXTSRV and created a new method zprocess that is mainly a copy of the Process method of the EXTSRV BO just that the creation part of the url is diffirent. I kept the call_browser function.
    Then, I assigned this method to a task in the workflow this task is copy of the standard task TS50000075. I added the itemtype to the UWL XML config file and uploaded it to the system successfuly then i cleared the cash.
    When i double click on the item in the UWL it partially works. I see the text written in the task but it is supposed to pop up a window. This window doesn't appear.
    Can anyone help with that?
    Thank you in advance,
    Hajar

    Hi
    Just check this out Please do not forget to give points
    User Roles     Restricts who can get work items via the user role. For example, you can assign a portal role here, such as buyer. Only users with the role buyer will see items from the provider system in UWL.You can have multiple user roles separated by semi-colon. By specifying user roles for the portal users, it can be restricted as to who gets the work items in UWL.  For example, you can assign a portal role to a user, such as buyer.  Only users with the role buyer will see items from a system, for example, B7QCLNT000 in UWL.
    Pull Channel Delta Refresh Period (in Seconds)     Delta Pull mechanism of UWL enables new items to be fetched from the back end SAP systems every minute by default every 60 seconds, and every 30 seconds for alerts. However, this can be configured. The user does not need to use the refresh function to update the inbox. Once items are retrieved, timestamps are updated for the users whose items are successfully retrieved. These retrieved items are updated in the UWL cache. Setup necessary from Business Workflow to enable Delta Pull MechanismSome configuration settings are required if you use the UWL and the Extended Notifications for SAP Business Workflow. Define the following two batch jobs:...&#9679;      Background job (for example UWL_DELTA_PULL_1), consisting of a single step of ABAP report RSWNUWLSEL in FULL mode, using a report variant.Run the job once a day.1.     &#9679;      A background job (for example UWL_DELTA_PULL_2), consisting of a single step of ABAP report RSWNUWLSEL in DELTA mode (default mode is delta, so report variant is optional).Run the job every one to three minutes (depending on the performance of the back end SAP system).Setup necessary from UWL to enable Delta Pull Mechanism The UWL service user in portal, with user id uwl_service, has to be granted access to the corresponding back end systems. This is a predefined service user provided by UWL. When the back end system is configured in the UWL administration page, an automated process is triggered to create a corresponding UWL service user in the back end system.Check role assignments and profiles status of this automated generated UWL service user and perform user comparison if necessary.&#9679;      If SAPLogon ticket is used (without using user mapping), you first create the system entry. A message about uwl_service user appears. Then in the back-end system give the uwl_service user an initial password. Now edit the system entry.&#9679;      If user mapping is used, you can first configure the back end system in the UWL administration page. Then access the respective back end system to initialize the password for the user uwl_service. Then, do user mapping in the portal as usual for service user uwl_service.In case uwl_service fails to be created in the back end and does not exist, you can manually create a back end user with the id uwl_service and assign the role SAP_BC_UWL_SERVICE and the rights as other end users.ORMap uwl_service to an existing back end user. Make sure that there is no multiple user mapping (there must not be two portal users mapped to the same back end user). This back end user must have the role SAP_BC_UWL_SERVICE.
    Snapshot Refresh Period (in minutes)     All items at the current time are fetched from the backend (for example from the SAP Business Workflow). The cache is synchronized thereafter. New / modified / deleted / updated items are fetched every session (every log on) if you leave the field value empty or enter a negative number.To specify a particular time frame for which the refresh occurs, enter the number of minutes
    The above registration procedure is usually sufficient to use a UWL iView. Item type retrieval and registration requires a connection to the systems and may take a couple of minutes.
    For each system, they are generated as the configuration named uwl.webflow.<system_alias> or uwl.alert.<system_alias>.
    In Manager Self-Service (MSS), the Universal Worklist groups together in Workset: Work
    Overview the various workflow tasks and alerts that are relevant for a manager.
    The standard MSS delivery includes the configuration file com.sap.pct.erp.mss.001.xml for the universal worklist.
    1. In the portal, choose System Administration &#8594;&#61472;System Configuration &#8594;&#61472;Universal
    Worklist and Workflow &#8594;&#61472;Universal Worklist &#8594;&#61472;UWL Systems Configuration.
    2. Create the following system connections:
    If you have already registered a suitable connector to the system connected to
    the system alias, the existing connector is sufficient and you do not have to
    register an additional one.
    &#9675; System alias: SAP_ECC_Financials
    Connection types:
    &#9632; WebFlowConnector
    &#9632; AlertConnector
    &#9675; System alias: SAP_ECC_HumanResources
    Connection type WebFlowConnector
    &#9675; System alias: SAP_SRM
    Connection type WebFlowConnector
    Leave the Web Dynpro Launch System field blank for all system connections.
    with regards
    subrato

  • Simple xml config file

    I have created a simple config file using something like:
          XMLEncoder e = new XMLEncoder(
                                      new BufferedOutputStream(
                                          new FileOutputStream("Config.xml")));
          e.writeObject(base.toString());
          e.writeObject(numberFrom);
          e.writeObject(numberTo);
          e.writeObject(numberPad);
          e.writeObject(maxTasks);
          e.writeObject(maxSubTasks);
          e.writeObject(textFrom);
          e.writeObject(textTo);
          e.close();which produces a file like:
    <?xml version="1.0" encoding="UTF-8"?>
    <java version="1.4.2_05" class="java.beans.XMLDecoder">
    <string>C:\</string>
    <int>1</int>
    <int>20</int>
    <int>2</int>
    <int>0</int>
    <int>1</int>
    <string>a</string>
    <string>z</string>
    </java> I want to make it a bit more version proof so need to get something more like:
    <?xml version="1.0" encoding="UTF-8"?>
    <program name=myprog>
    <dir>C:\</dir>
    <version>1</version>
    <myval1>20</myval1>
    <myval2>2</myval2>
    </program>There's probably loads of errors in that bit;) but you get the idea. I'm a bit new to xml programming.
    Can anyone give me any urls of help or examples that might do this?
    Thanks,
    David.

    You could use a binding api such as JAXB or xmlbeans. In essence these apis abstract the xml as pure java objects. Alternatively you could use an xml parser such as dom4j and build the XML 'by hand'. This class will create an example config file and write it to the file system
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.apache.xml.serialize.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Text;
    * Class to create a simple xml config file using W3C api
    * @author wollnyj
    public class CreateConfig {
         * create the config file
         *?xml version="1.0" encoding="UTF-8"?>
         *<program name=myprog>
         *    <dir>C:\</dir>
         *    <version>1</version>
         *    <myval1>20</myval1>
         *    <myval2>2</myval2>
         *</program>
         * @param configFile
         * @throws ParserConfigurationException
         * @throws IOException
        public CreateConfig(String configFile) throws ParserConfigurationException, IOException {
            //Document doc = parseXml(configFile);
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            Document doc = factory.newDocumentBuilder().newDocument();
            Element program = doc.createElement("program");
            program.setAttribute("name","myprog");
            Element dir = createEle("dir","c:\\",doc);
            Element version = createEle("version","1",doc);
            Element val1 = createEle("myval1","20",doc);
            // etc...
            program.appendChild(dir);
            program.appendChild(version);
            program.appendChild(val1);
            doc.appendChild(program);
            write(doc,new File(configFile));
         * @param args
         * @throws Exception
        public static void main(String[]args) throws Exception {
            CreateConfig create = new CreateConfig("F:\\config.xml");
         * Write an xml document to the file system
         * @param document The document to be written
         * @param xmlFile The output file
         * @throws IOException The file does not exist or could not be created
        private void write(Document document, File xmlFile) throws IOException {
            OutputFormat format = new OutputFormat(document);
            format.setIndent(4);
            format.setLineSeparator(System.getProperty("line.separator"));
            format.setLineWidth(80);
            FileWriter writer = new FileWriter(xmlFile);
            XMLSerializer fileSerial = new XMLSerializer(new BufferedWriter(writer), format);
            fileSerial.asDOMSerializer();
            fileSerial.serialize(document);
        private Element createEle(String name, String value, Document doc) {
            Element ele = doc.createElement(name);
            Text textNode = doc.createTextNode(value);
            ele.appendChild(textNode);
            return ele;
    }

  • XML Config File

    Firslty, I am a visual studio developer now working on a project in j2ee / weblogic.
    I have a project that currently uses an IP address that is hard coded. Ideally I would like this changed to some sort of XML config file. Can someone please provide me with an idiots guide to doing this please.
    Thanks in advance......

    The Preferences API does allow new ones to be created and to be written in
    XML format, but I found the XML format allowed very rigid and not very useful for
    what I wanted to do.The article caused me to finally read up on Preferences. It's neat, but not really for the same thing as configuration files. Configuration files typically have data which is fixed for the program, regardles of environment. Messages, SQL text and so on. The Preferences system is for stuff that's specified when it's installed on a particular system (URLs, file directories etc.), and simple stuff that you want to persist for a user, like window positions, user name etc..
    On windows it's stored in the registry. On unix hidden away on your home directory.

  • Where can i find the doc about xml config file of 9ias?

    i cant find the "Oracle9iAS Containers for J2EE User&#8217;s Guide",
    it should contains the info about the xml config file, i dont
    know why oracle launch a product without the config guide, i
    have read ton of material for learning the configuration of 9ias
    but still have not find the answer!
    i cant find it in otn:
    http://otn.oracle.com/tech/java/oc4j/content.html#technicaldocs,
    it have jsp, servlet....etc guide but no config guide, if
    someone seen it in microsoft or sun or borland website, please
    call me :)

    i mean the deployment config file in the application server like: server.xml, application.xml, web.xml, it is the J2EE standard, and can be used between all application server, tomcat, 9ias, weblogic........

  • Generate a xml config file for SPA3102

    Hi everyone,
    I'm trying to create a xml config file for my SPA3102
    I tried  http://<phone -or- device ip address>/admin/spacfg.xml
    to generate the xml but i had a  404 Not Found !
    web page so i'm searching a solution to generate a config file from the existing configuration
    I don't want to generate 2 html files for voice and router
    can you help me ?

    Basically, XML config file for this SPA3102 can be generated using SPC tool software (Profile
    compiler). However, I think this tool is only available from your Value Added Reseller or from your VoIP.Thanks.

  • Should I use .INI or .XML config files on cRIO?

    I'm looking to make a configuration file for an application running on a cRIO-9022. It will contain a small amount of configuration data (like numeric offsets, file paths, and IP addresses). I have 2 questions:
    1) Which file format should I use (.ini or .xml)? I have used .INI in the past because it is human readable/configurable with notepad, but it seems like .xml is becoming the new standard
    2) I would like to be able to modify config parameters on the PC that connects to the cRIO. What is the best way to modify the config file if it is stored on the cRIO hard disk (FTP the file to PC, make changes, FTP back? Network Streams?)
    --CLD--
    LV 6.1, 8.6.1, 2011 SP1, 2012 SP1

    JimMacD wrote:
    Thanks for the info.
    Any clever ways of accessing and changing the Config File data from a LV application running on a PC that doesn't require manually editing the file? I want the operator to just be able to click a button that says "cRIO Config", open a dialog, and change the values from there.
    uhm.... Yes!
    In This Post I show a bit of my hand on just exactly what I keep in a ini.config file (wel,l 1 section of a config file)  It would be nearly idiotic of me to not provide a Config editer since there are numerous Enum type defs in the delimited value for each key.  so since I, as the developer, know what sections (and possibly keys) are there I can read the file and load them to indicators on a config editor GUI.
    I've actually done this two ways-
    1) a seperate app that only "admin Engineers" know the location of "Launch Config editor.exe.
    2) In the application referanced above I have a button that opens a MODAL panel to edit the file (remember- I know what is in the file).   Users need permissions (Users- Passwords and permissions are kept in a config file, of course!) to even display the "Edit Sequence" button. but the "super user" can edit the step parameters. 
    HINT: one of these "Steps" loads a xml file to expose telnet commands and config for the uP on the DUT.   I expect the firmware on the Linux DUT will change in the future and did not want to rebuild my app whenever a typo was fixed in a command line tool.  BUT, since there are "special characters" that do not fit nicely into a .ini I exposed the telnet commands and line ends IP address and the login script  in a xml file.
    I know this did not directly answer your question!  but It should provide some food for thought.
    If you can share your data structure- I can be more specific. 
    Jeff

  • Log4J: Different config files for different applications?

    Hi all.
    If you run an application which uses Log4J logging it's enough to place the log4j.xml file in the Classpath.
    But how do you specify which configuration file to use during startup of a Java programm if they need different configurations but have the same classpath?
    Thanks in advance
    Carsten

    my log4j knowledge is a bit outdated - but somewhere in your apps you should have a line that loads the properties file, something like:PropertyConfigurator.configure(path_to_log4j.properties);And the log4j.properties file should be in your app's EAR file somewhere - and since the app server creates a context for each application, I don't think there would be any "bleed over". So, does your setup differ from this somehow?
    Good Luck
    Lee

  • Log4j: XML configuration file problem

    Hello,
    I set up some logging in my existing application with log4j and an xml configuration file. Now I made some changes to my package structure, and some problems occured. So I thougt of setting the logging level of one of my loggers (named myapp.iointerface.DBAccess in the config file). So the only change I did was adding a <param name="Level" value="TRACE"/> to my logger. Now, log4j complains when it reads the configruation file:
    log4j:WARN Continuable parsing error 36 and column 11
    log4j:WARN The content of element type "logger" must match "(level?,appender-ref*)".My config file:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <log4j:configuration debug="false" xmlns:log4j="http://jakarta.apache.org/log4j/">
         <appender name="RootConsole" class="org.apache.log4j.ConsoleAppender">
              <param name="Threshold" value="DEBUG"/>
              <param name="Target" value="System.err"/>
              <layout class="org.apache.log4j.PatternLayout">
                   <param name="ConversionPattern" value="%d{dd MM yyyy HH:mm:ss} %p %C %nIn Zeile Nummer: %L %m %n%n"/>
              </layout>
         </appender>
         <appender name="LoginInfo" class="org.apache.log4j.FileAppender">
              <param name="Threshold" value="TRACE"/>
              <param name="File" value="${user.dir}/login_info.log"/>
              <layout class="org.apache.log4j.PatternLayout">
                   <param name="ConversionPattern" value="%d{dd MM yyyy HH:mm:ss} %p %C %nIn Zeile Nummer: %L %m %n%n"/>
              </layout>
         </appender>
         <appender name="DBConnectionInfo" class="org.apache.log4j.FileAppender">
              <param name="Threshold" value="TRACE"/>
              <param name="File" value="${user.dir}/db_connection.log"/>
              <layout class="org.apache.log4j.PatternLayout">
                   <param name="ConversionPattern" value="%d{dd MM yyyy HH:mm:ss} %p %C %n%m %n%n"/>
              </layout>
         </appender>
         <logger name="myapp.windows.MainFrameController" additivity="false">
              <appender-ref ref="LoginInfo"/>
         </logger>
         <logger name="myapp.iointerface.DBAccess" additivity="false">
              <param name="Level" value="TRACE"/>
              <appender-ref ref="DBConnectionInfo"/>
         </logger>
         <root>
              <param name="Level" value="DEBUG"/>
              <appender-ref ref="RootConsole"/>
         </root>
    </log4j:configuration>Does anybody know what's wrong with that? I don't understand and found nothing googling it netiher. The strange thing is, that logging messages with level TRACE are recorded in the destination file, but the level id DEBUG.
    Thx,
    Julien

    If you look at the error, the parser expects level and not Level
    So :
    <param name="Level" value="TRACE"/>should be :
    <param name="level" value="TRACE"/>Same goes for :
    <param name="Level" value="DEBUG"/>That will solve the problem (even though it is not a critical error)!

  • Using Bash script to edit config file

    This is a really simple question, but given that I'm just learning Bash scripting and having this solved now would be really illustrative for me, I would really thank some help here.
    I'm using uzbl, and running Tor+Polipo. So, as you will see below in the tail of the config file, there is a line to redirect the requests of uzbl through Polipo.
    # === Post-load misc commands ================================================
    sync_spawn_exec @scripts_dir/load_cookies.sh
    sync_spawn_exec @scripts_dir/load_cookies.sh @data_home/uzbl/session-cookies.txt
    # Set the "home" page.
    #set uri = https://duckduckgo.com
    # Local polipo proxy
    set proxy_url = http://127.0.0.1:8123
    # vim: set fdm=syntax:
    What I want to accomplish is to comment in/out that line with a key shortcut on Awesome. I've thought of doing 2 scripts to do so and using 2 differente key shortcuts, but I want to "toggle" the proxy redirection with only 1 shortcut. To do so, I suppose that the script should go something like:
    if
    tool 'set proxy_url = http://127.0.0.1:8123' config_file
    then
    tool '#set proxy_url = http://127.0.0.1:8123' config_file
    else
    if
    tool '#set proxy_url = http://127.0.0.1:8123' config_file
    then
    tool 'set proxy_url = http://127.0.0.1:8123' config_file
    fi
    fi
    I know little about sed, but I think is the tool for this job. The most intriging part to me is to ask sed to print the regular expression when it finds it in the config file, and use that as an input in the conditional statement.
    Well, this is a mess I have done here. Hope there is a simple answer to this.
    Thanks in advance.-

    You can do this with a single sed command:
    sed -i 's/^#set proxy_url/set proxy_url/;
    t end;
    s/^set proxy_url/#set proxy_url/;
    : end' config_file
    This edits the file in-place (-i) and first tries to replace the commented with the uncommented line. If that suceeds, sed jumps to the "end" label. If not, it tries to replace the uncommented with the commented line. Thus you don't have to include any logic about the current state: if the first substitution succeeds, the line was obviously commented, if not, it was uncommented, and the second substitution should succeed.
    Note that my knowledge of sed is very limited. There might be a simpler way to do this.
    EDIT: For the sake of example, here's how to do the same in bash using regular expressions. Note how this script needs to use a temporary file to simulate in-place editing, how it needs to process the file line by line manually, etc. All things that sed does out of the box...
    #!/bin/bash
    tmp=test.conf.tmp
    echo -n "" > "$tmp"
    while read line; do
    if [[ "$line" =~ ^#set\ proxy ]]; then
    echo "${line/\#/}" >> "$tmp"
    elif [[ "$line" =~ ^set\ proxy ]]; then
    echo "#$line" >> "$tmp"
    else
    echo "$line" >> "$tmp"
    fi
    done < test.conf
    mv test.conf.tmp test.conf
    To answer your original question, the line
    if [[ "$line" =~ ^#set\ proxy ]]; then
    reads: if the line begins with a "#", followed by "set proxy", then...
    Last edited by hbekel (2011-03-20 10:40:16)

  • What the use of piublicKeyToken in App.Config file

    Hi Experts,
    I'm trying to get some answers related to "piublicKeyToken" in App.Config file if its needed at all! if so do I need to change it for different WS or I can use the same key with different project?
    Thanks

    Anyone!

  • Problem with mapping parameter when specified through an XML config file

    I have decided to attept to stipulate UDT mapping parameters from C# to Oracle in the AppConfig File.
    The original code (which worked) was as follows:
    namespace RoyalLondon.Processes.Oracle.Dto
    [OracleCustomTypeMappingAttribute("TEST_SCHEMA.T_PROJECT_CODE_CHANGES")]
    class ProjectCodeChangeTableFactory : TableFactoryTemplate<ProjectCodeChangeTableDTO>
    So, I've commented out the [OracleCustomTypeMappingAttribute line and added the following into the config file:
    <oracle.dataaccess.client>
        <settings>
          <add name="ProjectCodeChangeTableDTO"
           value="udtMapping factoryName='RoyalLondon.Processes.Oracle.Dto.ProjectCodeChangeTableFactory, RoyalLondon.Processes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
                             typeName='T_PROJECT_CODE_CHANGES'
                             schemaName='TEST_CON_DEV'"/>
        </settings>
    </oracle.dataaccess.client>
    This yields the following error message:
    Unhandled Exception: System.InvalidOperationException: Custom type mapping for ' RoyalLondon.Processes.Oracle.Dto.ProjectCodeChangeTableDTO' is not specified or is invalid.
    All the documentation I have read suggest that this ought to be ok. Is there anything obvious I am missing?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    ummm, nevermind.
    Turns out I hadn't updated the list of files that went in my servlet's jar file. I was recompiling the jar file successfully each time, but the list of files being included needed to contain a new class. This was a really stupid mistake on my part.
    Just one of those things that I was bound to solve as soon as I broke down and posted something on the web. Sort of like taking your umbrella with you to ensure that it won't rain.
    If anyone is reading this I am sorry I wasted your time.
    Jon

  • 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

  • How to hide navigation button in xml config file

    I have a photo gallery with a navigation button that allows for additional photo categories that I don't want to appear. Unfortunately, I can't open the .fla as it appears to have been created with a newer version of Flash. The code in the config.xml file is basically:
    <navigation>
      <menu 1> <content>
    </menu 1>
    <menu 2> <content>
    </menu 2>
    etc.
    </navigation>
    Is there a tag I can add to make the navigation link disappear?

    Deleting the navigation tags will make the xml malformed.  You need to keep those, but the parts in between can go.

  • UWL - I want to add the column "item type" in the UWL XML config file

    Hi,
    when personalizing a view in the default UWL iView, a user can add the column "Item Type", which shows the icon of the corresponding item.
    I want to add this column to a default view configuration in the XML file, so that all users have this column available by default. I guess the right attribute to do so would be the "columnOrder" attribute of a view. I tried to add the value itemType and objectType, but none of this worked, the column did not appear.
    From help.sap.com at
    http://help.sap.com/saphelp_nw70/helpdata/en/39/a1bb5c4c0d4ab4a417e87ef35f1efa/frameset.htm
    I found some attributes and I tried statusIcon, externalId and externalType. statusIcon does not show the item type icons and the other two don't work at all. The table shows that they have the attribute "Visible to user = NO".
    Does anybody know the correct value which I have to add to the columnOrder attribute or how I have to configure the XML file?
    Thanks a lot for any help,
    Fabian

    I found it myself, it's the attribute "itemTypeIcon" which has to be added to the columnOrder attribute.

Maybe you are looking for