Expression langage & jsp ?

hi,
in the j2EE tutorial, in the chapter related to Expression langage (EL), we can read "EL Expressions
can be used in two situations, In template text,
In any standard or custom tag attribute that can
accept an expression"
ok have a look at this code
<html>
<c:out value="${1.2E4 + 1.4}"/>
${1.2E10 + 1.4}
</html>the output is
12001.4
${1.2E10 + 1.4} why the second EL ${1.2E10 + 1.4} is not evaluated, even if it appears in the template texte!!!!
perhaps i didn't understand what is a 'template texte' ??
PS : i am using WSAD 5.1 with the built-in WASv5
tahnks for your help

hi,
in the j2EE tutorial, in the chapter related to
Expression langage (EL), we can read "EL Expressions
can be used in two situations, In template text,
In any standard or custom tag attribute that can
accept an expression"
ok have a look at this code
<html>
<c:out value="${1.2E4 + 1.4}"/>
${1.2E10 + 1.4}
</html>the output is
12001.4
${1.2E10 + 1.4} why the second EL ${1.2E10 + 1.4} is not evaluated,
even if it appears in the template texte!!!!
perhaps i didn't understand what is a 'template texte'
PS : i am using WSAD 5.1 with the built-in WASv5
tahnks for your help Because the "native" implementation of EL is not available untill JSP 2.0 and was 5 is JSP 1.2.
Thats why - J

Similar Messages

  • Regular expressions using jsp

    Hello Techies,
    I am having a text area inside a jsp file. When ever the end user gives input it must be submitted to the server.
    The real problem is when the end user gives special characters and double-quotes in this text area, jsp is preforming in abnormal way.
    Can u guys tell me how to resolve this issue. i.e how to solve regular expressions in jsp.
    Even though the end user gives special characters or double quotes we should take only the content.
    Looking forward for u reply.
    regards,
    Ramu

    The real problem is when the end user gives special characters and double-quotes in this text area, jsp is preforming in abnormal way.What do you mean with "jsp is preforming in abnormal way" ?
    A arbitrary JSP does not care about double-quotes.
    Can u guys tell me how to resolve this issue. i.e how to solve regular expressions in jsp.Usually the same way as you do it in a poj class.
    Nobody here knows how your JSP looks like and who handles the request when the form is submited or even who generates the model of the data displayed by your JSP.
    You have to provide us with more details.

  • Does Weblogic Express support JSPs

    Does Weblogic Express support JSPs?
              

    Yep!!
              Kumar
              Bryan Boyer wrote:
              >
              > Does Weblogic Express support JSPs?
              

  • Creating an expression from JSP using a non-bound variable

    Hi,
    This should be a simple question. I have an attribute that belongs to a row that is displayed on a jsp page.
    This attribute, however, is not displayed on the page, but is an attribute in the VO.
    I have a Set Property Listener on a command button, and I am trying to set this attribute ("Uid") to a pageFlowScope variable.
    I am having trouble figuring out which expression to use in order to get the value of my attribute.
    I can do this in code:
    int i = (Integer)currentRow.getAttribute("Uid");
    I want to be able to do the same thing in my expression language.
    Can anyone give me a clue?
    Or, is there a way I can instantiate a Set Property Listener in my code, and use the value of my attribute?
    The attribute I am using is my Auto-Increment primary key (I'm using MySQL), so I never use it as a UI element.
    Thanks.
    Joel
    Edited by: JRolls on Oct 1, 2010 10:30 AM

    I ended up removing the SetPropertyListener, and then from my backing bean I set the value on my pageFlowScope by doing this:
    RequestContext.getCurrentInstance().getPageFlowScope().put("pid", i);

  • WL vs. WL-express and JSP vs. javascript/SQL

    folks-
    i am trying to convince a certain party to
    disband a web-based job tracking system being
    written in ASP, javascript, html, css and SQL.
    it will be hosted on MS webserver running NT.
    i am trying to convince them to use JSP and
    WL express. i have done two years of EJB
    component work on weblogic, however, i have not
    done work with JSP or thin-clients. i was mostly
    business-logic.
    anyway i have some questions and need some
    direction. i already know JSP is better than
    ASP/javascript etc. because:
    * ASP is proprietary. ditto for VBscript
    * with an IDE creating JSP is easy and JSP
    automatically creates servlets which is way
    faster than by hand
    * JSP is JAVA based and hence benefits from
    all the portability pluses of JAVA
    but here are the more difficult questions:
    * why is WL express better than an MS
    web server? (not including WL market share
    and size. after all MS can claim that)
    * since WL express does not have an EJB
    container, how do you access the database?
    via JDBC? does one just have JDBC code
    floating around?
    * since there is no EJB container how does
    one separate presentation from logic from
    data access? this is a major downside of
    javascript, html, css and SQL etc.
    * if a web app grows beyond JSP with WL express
    into the need for an EJB container, i would
    think that most of the app needs to re-written
    as business-logic must be refactored into EJBs
    and all JDBC code will be replaced by container
    managed beans. this sounds a like a lot of
    rework.
    * isn't JSP slower than javascript as the
    servlet and hmtl code is bounced back and
    force across the network?
    with respect to architecture, scalability,
    and robustness what are the downsides to an
    MS webserver and non-JSP coding?

    * since WL express does not have an EJB
    container, how do you access the database?
    via JDBC? does one just have JDBC code
    floating around?
    Use JDO or an OR-mapper or embed JDBC into your own data access classes.
    * since there is no EJB container how does
    one separate presentation from logic from
    data access? this is a major downside of
    javascript, html, css and SQL etc.
    Presentation=JSP
    Logic=Servlet
    Data access=JDO or similar
    * if a web app grows beyond JSP with WL express
    into the need for an EJB container, i would
    think that most of the app needs to re-written
    as business-logic must be refactored into EJBs
    and all JDBC code will be replaced by container
    managed beans. this sounds a like a lot of
    rework.
    You should be able to tell up front if it a tx-intensive app that requires
    WLS.
    * isn't JSP slower than javascript as the
    servlet and hmtl code is bounced back and
    force across the network?
    They aren't exclusive. For dynamic pages, use Javascript on the front end,
    JSP on the back.
    * with respect to architecture, scalability,
    and robustness what are the downsides to an
    MS webserver and non-JSP coding?
    In the real world, and for most apps, while Java has the architectural edge,
    they both have similar scalability and similar robustness. MS gives you no
    choice though, and you rewrite every time they see a new buzzword. You can't
    leave MS-land without abandoning almost everything. You can leave WLS in a
    week if you have to.
    It's an investment. Invest wisely.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "shane miller" <[email protected]> wrote in message
    news:[email protected]...
    folks-
    i am trying to convince a certain party to
    disband a web-based job tracking system being
    written in ASP, javascript, html, css and SQL.
    it will be hosted on MS webserver running NT.
    i am trying to convince them to use JSP and
    WL express. i have done two years of EJB
    component work on weblogic, however, i have not
    done work with JSP or thin-clients. i was mostly
    business-logic.
    anyway i have some questions and need some
    direction. i already know JSP is better than
    ASP/javascript etc. because:
    * ASP is proprietary. ditto for VBscript
    * with an IDE creating JSP is easy and JSP
    automatically creates servlets which is way
    faster than by hand
    * JSP is JAVA based and hence benefits from
    all the portability pluses of JAVA
    but here are the more difficult questions:
    * why is WL express better than an MS
    web server? (not including WL market share
    and size. after all MS can claim that)
    * since WL express does not have an EJB
    container, how do you access the database?
    via JDBC? does one just have JDBC code
    floating around?
    * since there is no EJB container how does
    one separate presentation from logic from
    data access? this is a major downside of
    javascript, html, css and SQL etc.
    * if a web app grows beyond JSP with WL express
    into the need for an EJB container, i would
    think that most of the app needs to re-written
    as business-logic must be refactored into EJBs
    and all JDBC code will be replaced by container
    managed beans. this sounds a like a lot of
    rework.
    * isn't JSP slower than javascript as the
    servlet and hmtl code is bounced back and
    force across the network?
    with respect to architecture, scalability,
    and robustness what are the downsides to an
    MS webserver and non-JSP coding?

  • Using ${something} expressions in jsp

    hello,
    i'm writing a small web application using struts, hibernate, tomcat, my problem is that expressions ${some_formbean_property} written in jsp stay in html code to, they should be replaced with value of the property, what i have to do to fix it??
    thanks a lot

    In a JSP2.0 container, ${expr} is a runtime expression.
    if you use tomcat 5, and declare your web.xml as version 2.4, you can use ${expr} anywhere that you can use <%= expr %>
    So you can use it anywhere in template text, and also as an attribute to any tag that takes a runtime expression.

  • EL or RT expressions for JSP taglibs

    I have a simple question
    We all know that there are two ways to implement a JSP page. either RT expressions or expression language (EL). I have done plenty of research and I am comfortable at creating custom JSP taglibs that support both RT and EL. What I want to know is which if them is used more commonly?
    Its useless to right 2 seperated libs, since you can pass variables from EL to RT and vice versa, so I want to have only one tag library, but I dont know how I should implement it EL or RT.
    What is used more often and why? What is the advantages of using one over the other. Thank you!!!

    RT was the original way; it required scriptlets, which everyone hates.
    EL is the new way; it helps eliminate scriptlets, which everyone loves.
    EL is the method of choice; even moreso when JSP 2.0 is finalized, it allows them to be used more freely (not just in tags)

  • Rounding an expression in JSP

    Expression.......<TD>\${5 div 6}</TD> in a JSP results in output........0.83333333334.....
    I want to round off that value to......0.833...
    Please tell me how this can be done.

    Thanks BalusC
    But can this be done without importing fmp tld.....
    is there any function in jstl tld only <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    like Integer.round...i remember of using it sometime back.......
    or any other possible way without importing any external tld

  • PHP regular expression to JSP?

    Hi there,
    I have the following PHP regular expression, and was looking for tips on how to create an equivalent in JSP using the 1.3.1 API. This has been causing me problems since the regex package didn't arrive until 1.4.
    preg_match("/^(([\w\-\_])+(\.)*)+\@([\w\-\_]+\.)+[A-Za-z]{2,}$/i", $theAddress)Basically, it checks to make sure a valid email address pattern has been input.
    Any help would be appreciated!
    Thanks!

    Though I donno about PHP and the related stuff that you've posted, I can help you by providing a JS function that you can invoke to check for the valid format of an e-mail ID, I guess if this is what you want.
    function isEmail (s)
        // there must be >= 1 character before @, so we
        // start looking at character position 1
        // (i.e. second character)
        var i = 1;
        var sLength = s.length;
        // look for @
        while ((i < sLength) && (s.charAt(i) != "@"))
        { i++
        if ((i >= sLength) || (s.charAt(i) != "@")) return false;
        else i += 2;
        // look for .
        while ((i < sLength) && (s.charAt(i) != "."))
        { i++
        // there must be at least one character after the .
        if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
        else return true;
    }'s' is the e-mail ID string that you want to check.
    Hope you're assisted.
    fun_one

  • Does Weblogic Express support JSP ?

    Hi
    I wanted to know if i can deploy JSPs if i use a WeblogicExpress instead
    of a Weblogic Server .Iam not able to understand the deifference between
    Weblogic Express and Weblogic Server inspite of reading the material on the
    web site .Can someone throw more light on this ? Is there anywhere i can
    compare the features of the different weblogic products at one place ?
    thanks
    Srinivas

    For this type of stuff you should talk to your sales-person.
    We just make it, not sell it, so we dont understand the difference
    either. :)
    Cheers
    Mark G.
    In article <[email protected]>, [email protected] says...
    Hi
    I wanted to know if i can deploy JSPs if i use a WeblogicExpress instead
    of a Weblogic Server .Iam not able to understand the deifference between
    Weblogic Express and Weblogic Server inspite of reading the material on the
    web site .Can someone throw more light on this ? Is there anywhere i can
    compare the features of the different weblogic products at one place ?
    thanks
    Srinivas
    ==================================================
    NewsGroup Rant
    ==================================================
    Rant 1.
    The less info you provide about your problem means
    the less we can help you. Try to look at the
    problem from an external perspective and provide
    all the data necessary to put your problem in
    perspective.

  • Deferred expressions inside JSP tags

    Hello!
    I want to include custom JSP 2.0 tag into page.
    Something like
    <!-- Page.jsp -->
    <jsp:root version="2.0"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:jsp="http://java.sun.com/JSP/Page"
        xmlns:pk="urn:jsptagdir:/WEB-INF/tags">
        <jsp:directive.page language="java"
            contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" />
    <f:view>
    <pk:custTag bean="${beanInstance}"/>
    </f:view>
    </jsp:root>inside that tag I want to access my bean in JSF 1.2 way:
    <!-- custTag.tag -->
    <jsp:root version="2.0" xmlns:h="http://java.sun.com/jsf/html">
    <jsp:directive.tag body-content="empty" language="java"
            pageEncoding="ISO-8859-1" />
    <jsp:directive.attribute name="bean" required="true" type="com.my.Bean"/>
    Runtime way:
    ${bean}
    ${bean.prop}
    Deferred way:
    <h:outputText value="#{bean}"/>
    <h:inputText value="#{bean.prop}"/>
    </jsp:root>So ${} renders as expected, but <h:outputText> renders nothing as #{} evaluates to null. What should I do to make outputText and inputText work, if that's possible at all?
    I use Tomcat 6.0.2 and JSF-RI 1.2_03.
    Thanks,
    Alexey

    Oh, I see now.
    But is there a way to trick JSF by explicitly putting bean into request scope? Something, like Tomahawk's aliasBean?
    Actually, I did try to implement it. The following code was supposed to create a variable in EL-context:
    ValueExpression     expr = _value instanceof ValueExpression
                       ? (ValueExpression)_value
                       : facesContext.getApplication().getExpressionFactory().createValueExpression(_value, Object.class);
    ELContext   ctxt = facesContext.getELContext();
    VariableMapper varMap = ctxt.getVariableMapper();
    if ( varMap == null ) {
        ((ELContextImpl)ctxt).setVariableMapper( new VariableMapperImpl() );
        varMap = ctxt.getVariableMapper();
    if ( varMap != null ) {
        varMap.setVariable(_alias, expr);
        _active = true;
        log.fine("makeAlias: " + _alias + " = " + expr.getExpressionString());
    } else {
        log.warning("makeAlias: " + _alias + " = " + expr.getExpressionString() + " failed");
    }But resolving #{...} still returned null.

  • EXPRESS and JSP relation

    have got some basic doubtd in IDM
    We have XML and JSPs how both r getting related in
    the sense Take Login Form --> Login.jsp how both
    are gettign related
    Suppose In form1 I am entering some data that data
    if I want to recieve in form 2 How to specify the
    action ?
    It seems elementary
    Thanks in Advance
    senthilRajan

    I'm not really sure I understand your question.
    Although it's probably generally true that a JSP file maps to an XML form, it's not always the case.
    Can you be more specific about what you are trying to do? Are form1 and form2 different forms that would be presented during the processing of a workflow? Are you referring to end user vs. and admin activity?
    Often it can be easier to use a single form that nests fields within fields that can be conditionally disabled. Thus, a single form can look like multiple different forms. Or you can use tabs in the form spread fields out on multiple tabbed pages.
    Hope that helps,
    sbr

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

  • Could I use jstl tag in the JSP page of Creator 2 final release?

    I have a JSP page used to work well in Creator 2EA2. The page
    has the following code snippets:
    <c:forEach items="${SessionBean1.webQuery1.details}" var="item">
                                                        <tr>
                                                            <td class="detailKey">
                                                                <c:out value="${item.key}"/>
                                                            </td>
                                                            <td class="detailValue">
                                                                <c:out value="${item.value}"/>
                                                            </td>
                                                        </tr>
                                                    </c:forEach>
    ...Basically, it generates a table columns.
    After migrating to Creator2 final release, a fatal exception is thrown
    when the page is launched :
    Description: An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error.
    Exception Details: org.apache.jasper.JasperException
      /Page1.jsp(148,132) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
    Possible Source of Error:
       Class Name: org.apache.jasper.compiler.DefaultErrorHandler
       File Name: DefaultErrorHandler.java
       Method Name: jspError
       Line Number: 43
    Source not available. Information regarding the location of the exception can be identified using the exception stack trace below.
    Stack Trace:
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:43)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:414)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:155)
    org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes Any suggestion, or work around?
    Thanks

    There is something strange in the HTML for you posedt, so I cannot clearly see what you are trying to do in your JSP page. But either of the following kinds of usage would cause this kind of error:
        <h:dropDown ... items="<%= ...some Java expression ...>"/>or
        <h:dropDown ... items="${...some JSP EL expression...}"/>This is because JSF component tags allow neither Java runtime expressions nor JSP EL expressions (at least in JSF 1.1, which is what Creator 2 supports). The answer is to use a JSF EL expression instead, like this:
        <h:dropDown ... items="#{... some EL expression}"/>Craig

  • Design issue with JSP

    I've been rather thrown into the deep end of a JSP project, of which I have no prior experience, and have a couple of basic design questions.
    My project requires a number of web pages, delivered in sequence, to guide a user to a result. A 'wizard' if you will. The presentation code will need to make frequent trips to the back end system which will update it with status and what to do next.
    My assumption is that for this type of application, a set of JSP pages would be the right way forward. Access stage1.jsp, which provides an HTML link to stage2.jsp, and so on. Each page uses a bean which does the required clever back end stuff.
    The alternative, being pushed by a colleague, is to have a set of servlet/JSP page pairs.The servlet is the entry point, which does the back end stuff and sets up a bunch of values within the request, then it forwards to a JSP page which displays the values using EL to get at the values the servlet has prepared.
    Is one of these the "standard" way of doing it? After several hours of discussion we've not been able to decide if either way has any particular benefits that the other doesn't.
    One problem I'm starting to see with my approach is that returning information from the bean to the JSP page leaves the page needing to understand how to present the information, and that sort of logic isn't easy to express in JSP. For example, the JSP uses the bean to learn that 6 wotsits are available, but numbers 2 and 3 have been disabled.The JSP page needs to list the 4 that are ready, then perhaps list the other 2 elsewhere depending on another bean-derived value. Putting this sort of presentation logic into a servlet is straightforward, but if we do it my way than it's up to the JSP to try to sort it out. Which right now I don't know how to do, or whether it's even possible. I think what I need is for the JSP to hand this 6-wotsit list off to another piece of Java code which will generate the appropriate HTML for it - clearly not something the bean should be doing. Can I do that from another bit of servlet code somehow, without using a servlet to do the whole page?

    thrice wrote:
    BalusC wrote:
    thrice wrote:
    Is one of these the "standard" way of doing it? After several hours of discussion we've not been able to decide if either way has any particular benefits that the other doesn't.When you comes to the point that the standard taglibs/EL doesn't provide the needed functionality and you're forced to use a scriptlet, then it's time to use a Servlet.Um, so you're saying that both approaches are valid under the appropriate circumstances?There are circumstances/webapps where just a JSP page and a (smart) Javabean suffices without the need for any servlet (and scriptlet). It all solely depends on what you need and what the technology provides. If you need to have more control over the request (e.g. forwarding to another destination page depending on submitted input and/or result), a Servlet is more appropriate.
    Scriptlets are bad? Or at least not recommended?It's for sure NOT recommended. It's simply a sign of a bad practice. It unneccessarily tight-couples your presentation logic with business or even database logic. They simply doesn't belong in a JSP and collides with the "MVC" nature and also makes the code harder to read/maintain/test/debug/reuse. It's a (too) long living remnant of the first form of the JSP technology and its use has been discouraged since the introduction of taglibs/EL about a decade ago. Right now, it's at highest only useful for "quick testing" and "prototyping", for sole playing, testing and demonstration purposes only.

Maybe you are looking for

  • Been stuck for over  a year, please help me do this

    so i have this laptop with 8gb ram and core i7 as well as 2 hdd (no raid). Now i heard about premiere (cs4) and my laptop is ready to take most of the advantage but the hard drive is the bootleneck. Basically, all i want is to do few cuts in a video

  • Audio drop out on receiver side on nexus 4 (lollip...

    Hi , I am having this annoying problem for for then a month now. Whenever I call my friends & family they are not able to hear my voice after few mins or sec at times. This has made skype totally unusable on my phone. I have tried uninstalling and in

  • EXPORTING TO DVD Pro

    I have had horrible results with my titles created in FCP and exported to DVDPRO. They are pixilated. I was using Quicktime export. What I want are the crisp images I used to get on my PC with my Matrox realtimne export card. I recently tried compres

  • Payment Gauranteed Procedure

    Dear Gurus, In my customer master "Payment Gauranteed Procedure" field is not appearing, kindly advise.

  • Can find driver that lets me scan with HP 2545

    My HP laptop's hard drive died.  New one installed and now comes the set up issues.  Need to download what's necessary for my 2545 printer to work.  Got it to print, but can't get the part that let's me scan. Used to have icon on desktop that when cl