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.

Similar Messages

  • 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

  • Unable to view jsp page containing jsf tags

    I'm pretty new to this JSF world, so facing lot of problems. I have installed JWSDP ver 1.2 When I start tomcat and specify URL http://localhost:8080 the site goes in waiting phase for ever. So even I'm not able to view/run the samples provided for jsf.
    Moreover, i have created a simple appln to test jsf tag, but it's giving following error:
    javax.servlet.ServletException: This absolute uri (http://java.sun.com/jsf/core) cannot be resolved in either web.xml or the jar files deployed with this application
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:207)
    I don't know where the problem is. The code for sample i have downloaded from http://www.horstmann.com/corejsf/tutorial.html
    but with no success in running jsf app.
    anyone know the reason, why??
    Thanx in Advance,
    K.K.

    Roger, here are the contents of log file.
    Here goes the contents of launcher.server.log :
    Sep 17, 2003 10:25:07 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 921
    Sep 17, 2003 10:25:07 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 171
    Sep 17, 2003 10:25:08 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 781
    Sep 17, 2003 10:25:08 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 200
    Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 190
    Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 71
    Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 80
    Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 290
    Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 110
    Sep 17, 2003 10:25:09 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 50
    Sep 17, 2003 10:25:10 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 341
    Sep 17, 2003 10:25:10 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 170
    Sep 17, 2003 10:25:10 AM org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource execute
    INFO: Reading descriptors ( dom ) 90
    Sep 17, 2003 10:25:12 AM org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on port 8080
    Sep 17, 2003 10:25:12 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 6670 ms
    Sep 17, 2003 10:25:14 AM org.apache.catalina.core.StandardService start
    INFO: Starting service Java Web Services Developer Pack
    Sep 17, 2003 10:25:14 AM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Java Web Services Developer Pack/1.2
    Sep 17, 2003 10:25:15 AM org.apache.catalina.core.StandardHost getDeployer
    INFO: Create Host deployer for direct deployment ( non-jmx )
    Sep 17, 2003 10:25:46 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    Sep 17, 2003 10:25:46 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
    Sep 17, 2003 10:26:15 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', returnNull=true
    Sep 17, 2003 10:26:24 AM com.sun.xml.rpc.server.http.JAXRPCContextListener contextInitialized
    INFO: JAX-RPC context listener initializing
    Sep 17, 2003 10:26:26 AM com.sun.xml.rpc.server.http.JAXRPCServletDelegate init
    INFO: JAX-RPC servlet initializing
    And here the contents of jwsdp_log :
    2003-09-17 10:25:14 createObjectName with StandardEngine[Catalina]
    2003-09-17 10:25:14 preRegister with Catalina:type=Logger
    2003-09-17 10:25:54 createObjectName with StandardEngine[Catalina].StandardHost[localhost].StandardContext[jaxrpc-HelloWorld]
    2003-09-17 10:25:55 preRegister with Catalina:type=Logger,path=/jaxrpc-HelloWorld,host=localhost
    2003-09-17 10:26:28 createObjectName with StandardEngine[Catalina].StandardHost[localhost].StandardContext[jsf-cardemo]
    2003-09-17 10:26:28 preRegister with Catalina:type=Logger,path=/jsf-cardemo,host=localhost

  • How do I use the ? operator in JSF tag attributes?

    I want to do something like this:
    <h:inputText styleClass="${myBean.valid ? 'styleA' : styleB'}" ...>
    What do I have to do to use this Expression language?
    With the #{...} expression the ? operator doesnt seem to be available.
    When I use the ${...} expression I am getting this error:
    javax.servlet.ServletException: ServletException in '/WEB-INF/body/Test.jsp': /WEB-INF/body/Test.jsp(12,5) According to TLD or attribute directive in tag file, attribute styleClass does not accept any expressions
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
    Can anybody please help?
    Thanks!

    Personally, i'd do:
    <h:inputText styleClass="styleA" rendered="#{myBean.valid}"/>
    <h:inputText styleClass="styleB" rendered="#{!myBean.valid}"/>

  • Pass arguments to JSF tag attributes like id oder value

    Hi!
    I started with JSF some weeks ago and have some questions that i could not find in FAQ or tutorials.
    My page structure uses some <jsp:includes>. Each included page uses JSF.
    The structure is (example - users):
    Users.jsp
    |
    |(incl)
    |
    Mainpage.jsp (=Framework)
    |
    |(incl)
    |
    Browser.jsp (=Table)
    In "Users" all specific data is set. In "Browser" there is a <h:form> tag and a <h:dataTable> tag.
    The result should be a simple table with users inside.
    So I want to pass arguments to those sub-pages.
    1) -> form-ids as parameter:
    <h:form id="#{sessionScope.formName}">
    ... does not work, because ids have to start with a character or "_".
    formName is set as followed:
    session.setAttribute("formName", "form_users");
    2) ->beans as parameter:
    <h:dataTable id="browser_table_#{sessionScope.id}" styleClass="browser_table"
    var="user" value="#{sessionScope.user_list}">
    ... does not work. "id" is requested to be a static value and "value" can't find the bean by this string.
    user_list is set as followed:
    session.setAttribute("user_list", "UserListBean.users");
    (UserListBean.users is an ArrayList)
    Is there an error in my thinking? Or is there a way to pass arguments as i want?
    Thanks!

    sorry ... mistake in topic: "oder" = "or" of course :)

  • Please help ... evaluating jsp:expression in attributes

    Dear All,
    I have searched the forum and found a few posts expressing a similar problem. However none seemed to divulge any solution.
    <option value="<jsp:expression> signals[count] </jsp:expression>"><jsp:expression> signals[count] </jsp:expression></option>In the code above the second expression evaluates fine but the first causes problems. Its the angle brackets of the jsp:expression:
    The value of attribute "value" must not contain the '<' characterI have also tried <%= %> and %= % as has been suggested in previous posts
    <%= => fails also because of the angle brackets
    %= % is set to the value, instead of the evaluated expression.
    Am Completely Stumped. Surely there must be a way to do this!?!
    Thanks is advance

    Hi Steve, thanks for your help I have resolved the problem. Somewhere in the J2EE Tutorial I found a snippet of code that talked about using CDATA tags.
    My working code now looks like this:
    <td><select name="signal_list" multiple="multiple">
        <jsp:useBean id="signalslist" class="acreweb.SignalsList" scope="session" />
            <jsp:scriptlet>
                int count = 0;
                System.out.println("useBean");
                String[] signals = signalslist.getSignals();
                while(count < signals.length)
         //Display signal names in select box
         System.out.println(signals[count]);
         </jsp:scriptlet>
              <![CDATA[<option value=']]><jsp:expression>new String(signals[count])</jsp:expression><![CDATA[' />]]><jsp:expression> signals[count] </jsp:expression>
         <jsp:scriptlet>     
         count++;
               </jsp:scriptlet>
        </select>
    </td>Sorry about formatting am being dragged to the pub, impatient work colleagues

  • JSP 1.2: jsp expression in attribute value doesn't parse.

    Hi, I'm trying to use a jsp:expression in an html attribute value in JSP 1.2 but jasper doesn't seem to be able to parse it correctly. I'm using the XML syntax in my jsp, the relevant snippets are as follows:
    <jsp:scriptlet>
    String versionedPath = "/mysite/2.1/images";
    </jsp:scriptlet>
    <img src="%= versionedPath %/foo.jpg" />
    The JSP documentation claims that this will work but I'm beginning to think this syntax won't work when using JSP's XML syntax. I already know that the following won't work:
    <img src="<jsp:expression> versionedPath </jsp:expression>/foo.jpg" />
    as it did in JSP 1.1 because it's not well-formed xml.
    Is it even possible to use jsp expressions in attribute values when using JSP 1.2's XML syntax? If so, please enlighten me, and if not, well, that seems pretty broken to me.
    TIA...
    --Stuart

    you should use this:
    <img src=<%= versionedPath %>/foo.jpg >

  • Xml/html to jsp - problem with quotes in attribute values

    I am trying to convert a static html document into a jsp using an xsl stylesheet, but run into problems trying to use the jsp expression syntax inside of attribute values.
    Here is a sample of the source file:
    <input type="text" name="firstName" value=""/>
    Here is what I want the resulting jsp file to look like:
    <input type="text" name="firstName" value="<jsp:expression>customer.getField("firstName") </jsp:expression>">
    Here is what part of my stylesheet looks like:
    <xsl:template match="input">
    <xsl:copy>
    <xsl:copy-of select="@type"/>
    <xsl:copy-of select="@name"/>
    <xsl:attribute name="value">
    <xsl:text disable-output-escaping="yes"><jsp:expression></xsl:text>
    <xsl:text disable-output-escaping="yes">customer.getField(</xsl:text>
    <xsl:text disable-output-escaping="yes">"</xsl:text>
    <xsl:value-of select="@name"/> ")
    <xsl:text disable-output-escaping="yes">")</xsl:text>
    <xsl:text disable-output-escaping="yes"></jsp:expression></xsl:text>
    </xsl:attribute>
    </xsl:copy>
    </xsl:template>
    The problem i have is with the <%= customer.getField("firstName") %>. I have tried several different ways of inserting the double quotes around firstName, but no matter what I try, it always uses the entity reference instead of actually putting the " character. The jsp container will not accept the entity.
    I am assuming that the problem is with trying to place double quotes inside of an attribute value. Any ideas how to get around this?
    Thanks
    David

    Which App Server are you using?
    You should just be able to escape the double quotes.
    If that doesn't work, it's a bug in the app-server.
    Alternatively, you can use single quotes around the
    attribute value.
    Hope that helps,
    AlexSorry, I'm an idiot. By escaping you meant the unicode character escape "\u0022". I had not tried that. However, once i realized what you meant, I tried it, and it worked. Thanks for your help.
    David

  • Struts2 and Tiles2 - Error executing tag: Attribute 'title' not found.

    I keep getting Error executing tag: Attribute 'title' not found when I go to the baseLayout.jsp page. I am figuring it is not seeing the tiles.xml file, but I have placed it in the /WEB-INF directory like every web page I have found says too. Any help or pointers would be appreciated.
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Error executing tag: Attribute 'title' not found.
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)I am using maven to load my dependency, so here are the version numbers.
            <dependency>
              <groupId>org.apache.struts</groupId>
              <artifactId>struts2-core</artifactId>
              <version>2.2.1</version>
         </dependency>
         <dependency>
              <groupId>org.apache.struts</groupId>
              <artifactId>struts2-tiles-plugin</artifactId>
              <version>2.2.1</version>
         </dependency>
            <dependency>
              <groupId>log4j</groupId>
              <artifactId>log4j</artifactId>
              <version>1.2.16</version>
         </dependency>
            <dependency>
              <groupId>jboss</groupId>
              <artifactId>javassist</artifactId>
              <version>3.1</version>
         </dependency>Struts.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
         <constant name="struts.enable.DynamicMethodInvocation"
              value="false" />
         <constant name="struts.devMode" value="false" />
         <constant name="struts.custom.i18n.resources"
              value="forum" />
         <package name="default" namespace="/" extends="struts-default">
              <result-types>
                   <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
              </result-types>
              <action name="login" class="net.game_tech.LoginAction">
                   <result name="success" type="tiles">/login.success.tiles</result>
                   <result name="error" type="tiles">/login.tiles</result>
              </action>
              <action name="login-form">
                   <result name="success" type="tiles">/login.tiles</result>
              </action>
         </package>
    </struts>web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID" version="2.5">
         <display-name>Forum</display-name>
         <listener>
              <listener-class>
                   org.apache.struts2.tiles.StrutsTilesListener
              </listener-class>
         </listener>
         <context-param>
              <param-name>tilesDefinitions</param-name>
              <param-value>/WEB-INF/tiles.xml</param-value>
         </context-param>
         <filter>
              <filter-name>struts2</filter-name>
              <filter-class>
                   org.apache.struts2.dispatcher.FilterDispatcher
              </filter-class>
         </filter>
         <filter-mapping>
              <filter-name>struts2</filter-name>
              <url-pattern>/*</url-pattern>
         </filter-mapping>
         <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
         </welcome-file-list>
         <resource-ref>
              <description>Mysql Forum</description>
              <res-ref-name>jdbc/Forum</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
              <res-sharing-scope>Shareable</res-sharing-scope>
         </resource-ref>
    </web-app>tiles.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
           "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
    <tiles-definitions>
         <definition name="baseLayout" template="/baseLayout.jsp">
              <put-attribute name="title" value="Simple Java Forums" />
              <put-attribute name="header" value="/common/Header.jsp" />
              <put-attribute name="menu" value="/common/MenuNav.jsp" />
              <put-attribute name="body" value="" />
              <put-attribute name="footer" value="/common/Footer.jsp" />
         </definition>
         <definition name="/login.tiles" extends="baseLayout">
              <put-attribute name="header" value="/pvt/Login.jsp" />
         </definition>
         <definition name="/login.success.tiles" extends="baseLayout">
              <put-attribute name="header" value="/pvt/Welcome.jsp" />
         </definition>
    </tiles-definitions>baseLayout.jsp
    <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
         <title><tiles:insertAttribute name="title" /></title>
         <link href="css/main.css" rel="stylesheet" type="text/css" media="all"/>
    </head>
    <body>
         <div id="page">
              <tiles:insertAttribute name="header" />
              <tiles:insertAttribute name="menu" />
              <tiles:insertAttribute name="body" />
              <tiles:insertAttribute name="footer" />
         </div>
    </body>
    </html>

    I was playing around with it some more and was trying to follow this page:
    http://www.vaannila.com/struts-2/struts-2-example/struts-2-tiles-example-1.html
    I made sure I had the same jar versions. I still get the same exception in the Browser, but I get a few more log messages in the tomcat log;
    Obviously I have something configured wrong. I'll see what searching brings up, and of course any help would be appreciated.
    2010-08-24 10:30:59,885 DEBUG com.opensymphony.xwork2.config.ConfigurationManager.debug:57 - Checking ConfigurationProviders for reload.
    2010-08-24 10:30:59,920 DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler.debug:57 - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@4ba76eff], property=struts]
    2010-08-24 10:30:59,956 WARN  com.opensymphony.xwork2.ognl.OgnlValueStack.warn:45 - Could not find property [struts.actionMapping]
    2010-08-24 10:30:59,957 DEBUG com.opensymphony.xwork2.config.ConfigurationManager.debug:57 - Checking ConfigurationProviders for reload.
    2010-08-24 10:30:59,967 DEBUG com.opensymphony.xwork2.config.ConfigurationManager.debug:57 - Checking ConfigurationProviders for reload.
    2010-08-24 10:30:59,969 DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler.debug:57 - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@4ba76eff], property=org]
    2010-08-24 10:30:59,969 WARN  com.opensymphony.xwork2.ognl.OgnlValueStack.warn:45 - Could not find property [org.apache.catalina.jsp_file]
    2010-08-24 10:31:00,089 DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler.debug:57 - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@4ba76eff], property=org]
    2010-08-24 10:31:00,089 WARN  com.opensymphony.xwork2.ognl.OgnlValueStack.warn:45 - Could not find property [org.apache.tiles.servlet.context.ServletTilesRequestContext.CURRENT_CONTAINER_KEY]
    2010-08-24 10:31:00,099 DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler.debug:57 - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@4ba76eff], property=org]
    2010-08-24 10:31:00,100 WARN  com.opensymphony.xwork2.ognl.OgnlValueStack.warn:45 - Could not find property [org.apache.tiles.AttributeContext.STACK]
    2010-08-24 10:31:00,100 DEBUG com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler.debug:57 - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@4ba76eff], property=org]
    2010-08-24 10:31:00,100 WARN  com.opensymphony.xwork2.ognl.OgnlValueStack.warn:45 - Could not find property [org.apache.tiles.AttributeContext.STACK]
    Aug 24, 2010 10:31:00 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.tiles.jsp.taglib.NoSuchAttributeException: Attribute 'title' not found.

  • Using JSP scriplets in the JSF tags

    Hi,
    I haven't done that much JSP development using various tag libraries prior to looking at JSF, hence this very basic question:
    I am declaring and manipulating Java variables in my JSP. Is there a way to access those in my JSF tags? It seems that something like:
    <%
    String myString="MyLabel";
    %>
    <h:view>
    <h:outputText id="myID" value="<%=myString%>" />
    </h:view>
    blows up in the JSF processor.
    I am porting some stuff to JSF and hence do not use backing beans in all cases.
    Any suggestions/ideas/pointers are greatly appreciated.
    Thanks in advance,
    Vadim.

    JSF action element attributes take JSF EL expressions, not Java expressions. A JSF EL expression has access to objects in one of request, session or application scope only, not to scripting variables. One way to get your example to work is by putting the String in one of these scopes within the scriptlet, e.g.:
    <%
      String myString="MyLabel";
      request.setAttribute("myString", myString);
    %>
    <h:view>
      <h:outputText id="myID" value="#{myString}" />
    </h:view>But, if you're porting a JSP-based application to JSF, I strongly recommend that you move all scriptlet code into beans; otherwise it's kind of pointless to migrate to JSF. The strength of JSF is its separation of UI layout and application logic.
    Even though JSP happens to be one way to wire up a JSF view with JSF components, JSF has very little to do with JSP. You need to understand the basic JSF component model, event-driven development, and use JavaBeans to really gain any benefits. Don't be fooled into believing that JSF is "just a new JSP tag library" by the support for JSP as the default presentation layer; it's far more than that, and I personally believe that using JSP as the presentation layer makes using JSF a lot harder than it should be. In fact, most of the issues posted in this forum are issues with the JSP layer, not with the core JSF components or the infrastructure classes.
    Hans Bergsten (EG member)

  • Custom tag attribute calculated by scriptlet expression

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

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

  • Using TAG Attributes within JSF Tags

    I'm using some .tag files for templating purposes. I'm using two tag attributes via <@% attribute %> directive. How can i access this attribute to do something like follows.
    <%@ tag display-name="Area de Trabajo" language="java" %>
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%>
    <%@ attribute name="title" required="true"%>
    <%@ attribute name="location" %>
    <t:div styleClass="zonaArea#{(not empty location) ? location : 'Global'}">
      <h:panelGrid columns="1">
        <h:outputText value="#{title}" />
      </h:panelGrid>
      <jsp:doBody />
    </t:div>

    Hola Alberto.
    Any luck? Did you worked that around?
    I'm just trying to do the same thing...
    Tried to do something like:
    <%@attribute name="enabled" type="java.lang.String" %>
    <h:outputText value="test: #{requestScope['enabled']}" style="font-weight: bold;" /> to no avail...
    Let me know, please!
    Hi,
    Manrico

  • Calling jsp custom tag from jsp expression

    hi there,
    I have a problem calling oracle(or any other) custom tag from inside a jsp expression.(i.e.)embeding <jbo:tagname...> into <%......%>.
    For example:
    I need to get the value of a jsp parameter, but the parameter name is dynamic (retrieved from a DataBase)
    So I though it would be something link that:
    <%=request.getParameter(<jbo:ShowValue datasource="ds" dataitem="ParamName" ></jbo:ShowValue>) %>
    where <jbo:ShowValue is an Oracle custom tab that retrieves the value of a certain dataItem(certain field).
    But it does not work.........
    if any body can tell me how to overcome, or work around it, I'll be so pleased.
    Regards,
    Remoun Anwar

    Hi,
    You get the custom tag output into a hidden variable (say 'key') and use the request.getParameter("key")
    Hope u got the answer...
    Regards
    ravi

  • How we can use jsf tags in included jsp enclosed in subview tags

    Hello everybody,
    I am developing web app by using jsf. I am including a jsp page "header.jsp" into another jsp page "main.jsp". The header.jsp page is enclosed in jsf subview tag on main.jsp page. The header.jsp contains some static html code and some jsf tags like "outputText". When i added tag library url in header.jsp then my app was not even not initiating and i was getting following exception
    ERROR [UIComponentTag] Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.
    16:22:16,890 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    java.lang.NullPointerException
    at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:929)
    at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:310)
    ....Now i removed jsf tag library url from included jsp "header.jsp" so now my app is running but only static html data is being displayed but the value in the jsf tag "outputText" is not being printed in the browser
    kindly help me. i would be very thankful....

    Your question has nothing to do with Sun Java System Directory Server.
    Please use the right forum(s).
    Thanks

  • Jsf 1s phase of life cycle how knows ths components of the jsp with jsf tag

    i wish to know how faces servlet knows the jsp s view components while creaTI NG component tree at first request to input jsp which may have jsf tags.in the first phase faces servlet doesnot know input jsp with jsf tags what componnets it has. it is actually atthe response send or forward time which is the final phase when the tag ge executed and output is sent to client.i did understandin jsf life cycle in 1 st phase component tree is created at first request in 1 st phase .

    Hi,
    though a FacesContext holds the values used by a request, it doesn't mean it lives for as long as the request. The best explanation I found is from the JavaDocs
    release
    public abstract void release()
    +Release any resources associated with this FacesContext instance. Faces implementations may choose to pool instances in the associated FacesContextFactory to avoid repeated object creation and garbage collection. After release() is called on a FacesContext instance (until the FacesContext instance has been recycled by the implementation for re-use), calling any other methods will cause an IllegalStateException to be thrown.+
    The implementation must call setCurrentInstance(javax.faces.context.FacesContext) passing null to remove the association between this thread and this dead FacesContext instance.
    Throws:
    java.lang.IllegalStateException - if this method is called after this instance has been released
    Frank

Maybe you are looking for