Nesting EL expressions in core tags

Hi all,
I have a situation where I require to use dymanic textboxes based on the certain criteria. To make this work I used strut's LazyValidatorActionForm. It works like a charm but when I want to write out certain form property using EL, it doesn't work well. I am not sure how to use it with <c:out />. For example:
This is the code I tried to display a link with a value in the dynamic form:
<c:forEach var="counter" begin="0" end="${numTextFields}" >
?methodToCall=removeElement&id=<c:out value="${request['FAEditorForm'].id_${counter}}" />">Remove</a>
</c:forEach>
Here, I am trying to get the Form from the request attribute and invoke the method for property 'id_?' where '?' can be some number depending on the counter in the loop. When executing this page, I am getting an exception:
javax.servlet.jsp.JspException: Can't insert page '/pages/findingaids/FACustomContainerEditor.jsp' : javax.servlet.jsp.JspException: The taglib validator rejected the page: "tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${request['FAEditorForm'].id_${counter}}": Encountered "{", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"], "
I also tried using <c:set /> but looks like the JSTL tags does not allow nesting EL ('{') inside another EL. Not sure how to solve this issue. Any help is appreciated.
Thanks,
Srini

To solve the nested EL expression issue, you use the square brackets notation.
This should be close to what you want.
<c:forEach var="counter" begin="0" end="${numTextFields}" >
  <c:set var="cVar" value="id_${counter}"/>
  <c:out value="${FAEditorForm[cVar]"/>
</c:forEach>However instead of building the parameter string manually, you should let the struts tag do it for you.
Seeing as you have two parameters, you have to pass it a map.
<jsp:useBean id="paramMap" class="java.util.HashMap" scope="page"/>
<c:set target="${paramMap}" property="methodToCall" value="removeElement"/>
<c:forEach var="counter" begin="0" end="${numTextFields}" >
  <c:set var="cVar" value="id_${counter}"/>
  <c:set target="${paramMap}" property="id" value="${cVar}"/>
  <html:link page="/FAEditor.do" name="paramMap">Remove </html:link>
  <br>...
</c:forEach>Cheers,
evnafets

Similar Messages

  • Nested CASE expressions in SQL Server 2008 R2

    Hi, For some reason when I use the below CASE expression in my SELECT statement I get duplicate records.
    CASE WHEN <Condition 1> THEN <Expression 1>
    WHEN <Condition 2> THEN <Expression 2>
    WHEN <Condition 3> THEN <Expression 3>
    WHEN <Condition 4> THEN <Expression 4>
    END AS CaseResult
    Also tried using coalesce with no luck. How to write a nested CASE expression which would yield just one expression. In case if I have to combine 2 different Expressions for 1 record, Is there a way to merge the 2 Expressions writing CASE
    expression something like below.
    STUFF ((SELECT ',' + CASE WHEN <Condition 1> THEN <Expression 1>
    WHEN <Condition 2> THEN <Expression 2>
    WHEN <Condition 3> THEN <Expression 3>
    WHEN <Condition 4> THEN <Expression 4>
    END
    FOR XML PATH(''), ROOT('MyString'), TYPE).value('/MyString[1]','VARCHAR(MAX)'), 1, 1,'') AS CaseResult
    --ResultSet
    CaseResult
    <Expression 1, Expression 2>
    I am using SQL Server 2008 R2. Thanks in advance.......
    Ione

    Hi, For some reason when I use the below CASE expression in my SELECT statement I get duplicate records. Also tried using coalesce with no luck. How to write a nested CASE expression which would yeild just one expression. In case if I have to combine 2 different
    Expressions for 1 record, Is there a way to merge the 2 Expressions writing CASE expression something like below in SQL Server 2008 R2.
    CASE WHEN <Condition 1> THEN <Expression 1>
    WHEN <Condition 2> THEN <Expression 2>
    WHEN <Condition 3> THEN <Expression 3>
    WHEN <Condition 4> THEN <Expression 4>
    END AS CaseResultSTUFF ((SELECT ',' + CASE WHEN <Condition 1> THEN <Expression 1>
    WHEN <Condition 2> THEN <Expression 2>
    WHEN <Condition 3> THEN <Expression 3>
    WHEN <Condition 4> THEN <Expression 4>
    END
    FOR XML PATH(''), ROOT('MyString'), TYPE).value('/MyString[1]'<span clas
    Ione

  • JSP ${} expressions in JSF tag attributes

    Does anyone know why the expert group decided not to allow ${} style expressions within JSF tag attributes? I understand that a different syntax is needed to implement the 'late binding' #{} expressions used to link input controls to form beans, but not why the JSF tags actually prevent the use of immediately evaluated ${} expressions for accessing variables in the page scope in JSP 2.0.
    I know there has been a lot of discussion about this and other threads mention a security loophole that would be opened up by allowing expressions like #{blah.${someProperty}}, but I'm not sure why this sort of thing would cause a problem. Is there any way to enable this behaviour, such as editing the JSF tag library descriptors to allow runtime expressions (horrible though that sounds)? Or perhaps another JSF implementation that supports both immediately evaluated and late-binding expressions? It seems a rather unnecessary restriction that is going to cause much confusion and mistyping for all...
    Thanks in advance,
    Keith.

    Thanks Adam, I see the problem now. It's a fairly obscure loophole but serious nonetheless. Of course, this problem could also be avoided by not using request parameters within JSF tags as it doesn't affect the majority of legitimate uses for expressions.
    I have to disagree with you about mixing ${} and #{} expressions though. The majority of developers will be used to writing ${} expressions in JSTL and JSP text and so will expect them to do work the same in JSF tags. Judging by the number of posts in this forum about being unable to use page scope variables in JSF tags this issue is already confusing a lot of people.
    As a rule of thumb, "use ${} for expressions that are output to the page and #{} for binding controls to backing beans and invoking methods" (which perform clearly distinct functions) is a lot simpler and easier to learn IMHO than the current one, which is "use ${} for expressions that are output to the page except within a JSF tag, where you use #{} for the same thing and also to update form values and invoke action methods"! (OK, I'm exaggerating a little for effect, but you get the point... :-)
    I agree that mixing both types of expression in the same attribute might be a little confusing, but this is an unlikely edge case that should probably be prevented in value binding or action attributes anyway. It's more of an issue for label values where mistyping one for the other is already very common and, although not especially difficult to debug, is just another pitfall awaiting the unwary JSP developer. I'm not sure that JSP expressions would be much more difficult to debug anyway as the value and method bindings will simply not work, which is pretty obvious as soon as you try and test the thing.
    Is this something that the EG would be prepared to reconsider for the next release of JSF, or perhaps getting the security loophole addressed in the next JSP spec? In the meantime, is there any reason that developers shouldn't enable runtime expressions in the TLD file provided that they're willing to live with the consequences?
    (Sorry to harp on about it, but I've already had several complaints about this after recommending JavaServer Faces for a major development project at ingenta.com.)
    Many thanks,
    Keith.

  • Core Tag causes java.io.UTFDataFormatException

    Hi,
    I am using JSTL core tag in my JSP file. While running the file I am getting following error:
    java.io.IOException: javax.servlet.jsp.JspException: The taglib validator rejected the page: "java.io.UTFDataFormatException: Invalid byte 2 of 3-byte UTF-8 sequence., "I am using WebLogic 8.1 SP4 version and eclipse 3.1.1 with MyEclipse configured.
    Can anybdy please help me find a solution to my problem. It's urgent.
    Thanks in advance.
    Niranjan

    I'm sorry my mind reading powers aren't working today.
    Can you show an example of a simple JSP that duplicates this error?
    The smallest example possible?
    What is it on the page that does this.
    If you create the page in a text editor (eg notepad) does it still occur?

  • Using expressions in jsf tags

    I have a problem with using expressions in jsf tags! I know this
    topic was discussed before but it doesn`t work.
    I want to use the following jsf-code:
    <h:panel_data id="tab" var="vari" modelReference="Bean.varis">
    <h:output_text id="Id" modelReference="vari.id"/>
    <h:command_hyperlink id="hyper" href="next.jsp" label="Detail">
    <f:parameter id="Param1" name="id" value="vari.id"/>
    </h:command_hyperlink>
    </h:panel_data>
    The value of the parameter should have the value of vari.id!! Why doesn`t it work?? I also tried to use value="${vari.id}" and value=<%= vari.id %>.
    I have also changed the jsf_core.tld from
         <rtexprvalue>false</rtexprvalue>
    to
         <rtexprvalue>true</rtexprvalue>
    Does anybody know what to do? Where should the .tld-files be localized when i deploy the webapplication??

    On May 19th, 2003 HydraD == "HD" wrote:
    HD> I have a problem with using expressions in jsf tags! I
    HD> know this
    HD> topic was discussed before but it doesn`t work.
    HD>
    HD> I want to use the following jsf-code:
    HD>
    HD> <h:panel_data id="tab" var="vari" modelReference="Bean.varis">
    HD> <h:output_text id="Id" modelReference="vari.id"/>
    HD> ...
    HD> <h:command_hyperlink id="hyper" href="next.jsp" label="Detail">
    HD> <f:parameter id="Param1" name="id" value="vari.id"/>
    HD> </h:command_hyperlink>
    HD> </h:panel_data>
    HD>
    HD> The value of the parameter should have the value of
    HD> vari.id!! Why doesn`t it work?? I also tried to use
    HD> value="${vari.id}" and value=<%= vari.id %>.
    HD>
    HD> I have also changed the jsf_core.tld from
    HD>      <rtexprvalue>false</rtexprvalue>
    HD> to
    HD>      <rtexprvalue>true</rtexprvalue>
    HD>
    HD> Does anybody know what to do? Where should the
    HD> .tld-files be localized when i deploy the
    HD> webapplication??
    If you want your parameter's value to be pulled from the model, you must
    use modelReference instead of value. Try that and see if it works.
    Ed

  • Can't locate ADF Faces Core tag document

    I found a good ADF Faces core tag document (10g), using this URL, http://www.oracle.com/technology/products/jdev/htdocs/partners/a
    ddins/exchange/jsf/doc/tagdoc/core/imageIndex.html. This reference has images for each tag component. but somehow the URL is not working anymore. Can anyone tell me why this URL is not working any more and how/where can I download the same refrence to local machine? This is for 10g.
    Thanks
    Jade

    Unfortunately, with the recent big change to OTN, there are a lot of links whose content has moved and the links don't work.
    http://webcache.googleusercontent.com/search?q=cache:bz4GyBiDfFIJ:www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/imageIndex.html+http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/imageIndex.html&cd=1&hl=en&ct=clnk&gl=uk is Google's cache of that site.
    John

  • Accesing array with core tags

    Hi
    To build an jsp page using struts, I need to access elements inside a bidimensional array, contained in a class stored in session, using core tags.
    I tried to access this way
    <c:out value="$(relations[1][2])"/>
    but it doesn�t work.
    I don�t know if it�s possible to access this kind of structure with jstl , does anyone know the way to do it?
    Thanks in advance,

    So are you using: $(relations[1][2]) like your post says, or was that a type. You should be using ${relations[1][2]}. Se, curly brackets {} not the parenthesis. It works fine for me:
    <%
      String[][] data = new String[][] { {"Here", "is", "some"},
                                         {"data", "in", "a"},
                                         {"two", "dimensional", "array"}};
      pageContext.setAttribute("data", data);
    %>
        <c:out value="${data[1][2]}"/>

  • Nesting a BC4J JSP data tag within a Struts tag?

    Has anybody tried nesting a BC4J JSP data tag within a Struts JSP tag? I can't get it to work. For example,
    <logic:equal name="sort" value="<jbo:ShowDefinition datasource='ds' dataitem='CustomerName' definition='ColumnName' />">
    blah blah blah
    </logic:equal>

    Try using single quotes in the value=' ' and double quotes in the jbo tag usage.

  • HTML / Core Tag Overview

    Besides the JSF Tutorial, where can I find a detailed description of the html / core tags that come with JSF? The JSF Tutorial does not list in detail all the possible attributes.
    thanx,
    sven

    hi;
    you can look at the TLD file

  • Why is 'f:' used for taglib of 'core' tags whereras 'h:' is for 'html'?

    Forgive a simple question from a new comer, but does anyone know why was 'f' chosen to signify the taglib for 'core' tags whereras 'h' is used for 'html'?
    E.g. f:attribute and h:form.
    Regards,
    SIDCUP

    Those are the preferred taglib prefixes, which weren't used by another taglibs yet. You can always change the taglib prefix to your taste in the taglib declaration. But for everyone's convenience it is smart to provide a preferred taglib prefix. I don't know the exact details and I don't really worry about it, but I guess that 'f' just stands for Faces and 'h' stands for HTML.

  • Parsing EL expression in custom tag 10.1.3.4

    Hello all,
    I have a custom tag that extends CoreOutputTextTag. This tag needs to resolve the El expression passed in from the value attribute and perform an operation with it. Since I this tag needs to work with adf 10.1.3.4, the jsp level is 1.2 and does not support container parsing of EL expression directly in the page ($).
    I have tried a couple approaches but both of them result in just the same EL expression I pass in being returned to me. Anyone have an idea of the proper way to resolve an EL expression within a custom tag?
    Thanks in advance,
    - Joe
    public class CoreOutputTextTag extends oracle.adfinternal.view.faces.taglib.core.output.CoreOutputTextTag {
        private String groupId;
        private String groupCode;
        private String value;
        public void setValue(String value) {
            this.value = value;
            super.setValue(value);
        public int doStartTag() throws JspException {
            super.doStartTag();
            UIComponent uiComponent = this.getComponentInstance();
            if (uiComponent instanceof CoreOutputText) {
                CoreOutputText coreOutputTextComponent =
                    (CoreOutputText)uiComponent;
                if (coreOutputTextComponent.getValue() == null) {
                    String codeValue =
                        (String)ExpressionEvaluatorManager.evaluate("value", value,
                                                                    java.lang.String.class,
                                                                    this,
                                                                    pageContext); // the page context
                    try {
                        ExpressionEvaluator expressionEvaluator =
                            pageContext.getExpressionEvaluator();
                        codeValue =
                                (String)expressionEvaluator.evaluate(value, java.lang.String.class,
                                                                     pageContext.getVariableResolver(),
                                                                     null);
                    } catch (ELException elex) {
                    SystemSettingRow row =
                        SystemSettings.getSystemSettings(groupId, groupCode, null,
                                                         value);
                    if (row != null)
                        coreOutputTextComponent.setValue(row.getShortDesc());
            return TagSupport.SKIP_BODY;
        public void setGroupId(String groupId) {
            this.groupId = groupId;
        public String getGroupId() {
            return groupId;
        public void setGroupCode(String groupCode) {
            this.groupCode = groupCode;
        public String getGroupCode() {
            return groupCode;
    <tag>
      <name>coreOutputText</name>
      <tag-class>od.adf.ics.ui.taglib.CoreOutputTextTag</tag-class>
      <body-content>empty</body-content>
      <attribute>
       <name>groupId</name>
       <required>true</required>
      </attribute>
      <attribute>
       <name>groupCode</name>
       <required>true</required>
      </attribute>
      <attribute>
       <name>id</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>truncateAt</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>description</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>escape</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>shortDesc</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>partialTriggers</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>onclick</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>ondblclick</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>onmousedown</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>onmouseup</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>onmouseover</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>onmousemove</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>onmouseout</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>onkeypress</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>onkeydown</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>onkeyup</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>styleClass</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>inlineStyle</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>value</name>
       <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
       <name>converter</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>rendered</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>binding</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
       <name>attributeChangeListener</name>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
    </tag>

    I also would like to know how to accomplish this. I have a similar requirement and need to set the "disable" attribute on a commandbutton and requires an el statement that calls a methodAction defined on the pageDef.
    I followed the great instructions over on this thread:
    ADF FACES:Creating custom component on top of adf
    on how to create custom adf tags for JDeveloper 10.1.3.4.
    many thanks!
    Wes
    Edited by: Wes Fang on Sep 16, 2010 5:39 AM

  • Hi..assign a core tag value to a variable in jsp scriplet

    Hi
    I have a <core:set var="membershipType" value="${somevar}" />I want to set the membershipType value of the above tag to a variable in scriplet <% String member =""%> How can I do that,
    Any ideas
    Thanks
    jag

    EL variables are assigned to one of the 4 scopes -> Page, Request, Session, or Application. By default they go to the page scope, which corresponds to the pageContext object in scriptlets.
    The result is that you need to retrieve the value out of the scope it is in using the proper getAtribute(name) method, such as:
    <% String member = pageContext.getAttribute("membershipType") %>The best course of action, though, is re-designing your application so there is no need for scriptlets.

  • JSTL core tag error in Weblogic Poral 9.2

    C:IF Tag Expressions are not recognized in weblogic portal 9.2, getting compile time errors (pls find the details below). But we have expressions for C:FOREACH those are working fine. I am just wondering any one using C:IF with expressions in weblogic portal 9.2 successfully!
    I appreciate your response to this post
    Thanks for looking at this posting !
    <Sep 20, 2006 3:57:24 PM EDT> <Error> <Sep 20, 2006 3:57:24 PM EDT> <Error> <HTTP> <BEA-101017> <[weblogic.servlet.internal.WebAppServletContext@6e696d - appName: 'CTagServerTest', name: 'CTagServerTestWebAPP', context-path: '/CTagServerTestWebAPP'] Root cause of ServletException.
    weblogic.servlet.jsp.CompilationException: Failed to compile JSP /index.jsp
    index.jsp:13:24: Illegal token.
    <c:if test="${1=1}"> 1=1</c:if>
    ^

    Hello User,
    You can find the application under below path
    Domain_name - Expand "Environment" and Select " Deployments " - here your application will show which are deployed in this domain.
    Please refer -http://docs.oracle.com/cd/E13222_01/wls/docs100/intro/console.html
    Regards
    Laksh

  • Result set not forwared to Core Tag

    HI,
    I have the following code, but no any data output. I guess the result is not forwarded to <c:> </c> tag, could you please give me a hand? any help is appreciated much.
    ===========================================
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <sql:query var="rs" dataSource="jdbc/AutoCRM">
    select * from password
    </sql:query>
    <html>
    <head>
    <title>DB Test</title>
    </head>
    <body>
    <h2>Results</h2>
    <c:forEach var="columnName" items="${rs.columnNames}">
    <th><c:out value="$columnName"/></th>
    </c:forEach>
    <c:forEach var="row" items="${rs.rows}">
    <tr>
    <c:forEach var="column" items="${row}">
    <td><c:out value="${column.value}"/></td>
    </c:forEach>
    </tr>
    </c:forEach>
    </body>
    </html>

    thank you for the try and reply.
    Now, I add <table> and </table>, the result is as below:
    ============================
    Results
    $columnName ${column.value}
    ===============================
    my platform is Tomcat 5.0.19+Mysql 4.1.

  • Using nested IIF expressions in an update query - is it possible?

    Hi everyone,
    I've been tasked by my manager to build a database which replicates a large, complicated Excel spreadsheet that consumes too much of our team's time and system resources. I've just about got most of it, but there is one particular required field that, in
    Excel, requires multi-layered nested If/Then formulae. I have to ask if building something similar in Access is possible. Here is the problem and the logic:
    Let us assume two established fields, Field 1 and Field 2; and then one field to be created via Update query, Field 3.
    Let us further assume that in Fields 1 and 2, there are three specific alphanumeric sequences occurring (“X1A”, “X1”, and “Z1”) that need to be identified and then called out as either “S1” or “U1” in field 3.
    If an Update Query were to be written to populate Field 3 with either “S1” or “U1” depending on one of the three alphanumeric sequences appearing in either Field 1 or Field 2, could it be written as the following expression, using the IIF and OR operators?
    And if so, is the syntax of the following expression correct?
    IIf([FIELD 1]="* X1A", "U1", OR IIf([FIELD 2]="* X1", "U1", OR IIf([FIELD 2]="* Z1", "U1", OR IIf([FIELD 1]="* X1", "U1", OR IIf([FIELD 1]="* Z1", "U1", "S1")))))
    Any help, critiques, or guidance would be appreciated.

    IMHO, a main consideration when "migrating" from Excel to Access is that a relational database is fundamentally different from a spreadsheet (although there can be much overlap).  In Excel, calculated values are "live" (unless you paste the values only
    into some other cells).  To replicate this "live" quality in Access, you can use a query with a calculation to display (not create or update) Field 3 in your case; Field 3 really wouldn't be a field, just a representation (query, form, report) or snapshot
    (export, print).  One reason for this is to avoid conflicts and redundancy.  In other words, if Field 3 is based solely on Fields 1 & 2 and some rule, then usually there is no need to waste disk space to store Field 3 and you don't risk Field
    3 being wrong as in the case when the rule changes.
    So here are a couple of options.
    1) Create view only query to display Field 3.  In query design view, enter the following where you would normally select a field:
    [FIELD 3]: IIf([FIELD 1]="* X1A", "U1", IIf([FIELD 2]="* X1", "U1", IIf([FIELD 2]="* Z1", "U1", IIf([FIELD 1]="* X1", "U1", IIf([FIELD 1]="* Z1", "U1", "S1")))))
    I assume you literally mean the asterisk character and are not trying to invoke a wildcard for the LIKE operator.
    There are other ways of doing this (e.g. with the LIKE operator or multiple queries and UNION), but I leave that up to you to explore.
    2) Actually update the value of FIELD 3 in a table.  Create two update queries and use your rules as conditions (i.e. the criteria in the bottom of query design).
    a) Update query 1 (run first): set [FIELD 3] = "U1" where [FIELD 1] = "* X1A" OR [FIELD 1] = "* X1" OR [FIELD 1] = "* Z1" OR [FIELD 2] = "* X1" OR [FIELD 2] = "* Z1"
    b) Update query 2 (run after): set [FIELD 3] = "S1" where [FIELD 3] is null
    Again, there are other ways of doing this such as setting the default value of [FIELD 3] in the table to "S1" and just running update query 1.
    Good luck.

Maybe you are looking for