Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014
    Rep Power

    Default Netbeans won't parse Expression Language in a JSP page

    Hi, i've this code

    PHP Code:
    <%@ taglib prefix="c" uri="" %>
    <%@page import="Javabean.Articolo"%>
    <%@page import="java.util.ArrayList"%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE html>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
              String nome="porcodio";
              <div> ${nome}</div>
    I'm using Netbeans with glassfish server 4. When i try to launche the web page, i see that "nome" is not printed... Why?
    My older projects that uses EL, still works fine, while this wont' parse the syntax... why??

  2. #2
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Rep Power

    Default Re: Netbeans won't parse Expression Language in a JSP page

    Expression Langauge is used to evaluate scoped variables (page,request,session,attribute). The variable that you have declared is simply a local variable.
    To get this to work, you would need to store the nome variable as a request attribute:

    Java Code:
              String nome="porcodio";
              request.setAttribute("nome", nome);
    Then, you can use Expression Language to access it, as you have.

    You really don't need to use EL here, just use a scripting-language-expression:

    Java Code:
             <% String nome="porcodio"; %>
    Last edited by sehudson; 06-03-2014 at 06:05 PM.

Similar Threads

  1. How do you parse an inputted expression?
    By Propinquity in forum New To Java
    Replies: 1
    Last Post: 11-19-2013, 03:49 PM
  2. Replies: 0
    Last Post: 02-01-2012, 04:50 PM
  3. How to parse an expression with given format
    By mariaK in forum New To Java
    Replies: 2
    Last Post: 11-23-2011, 12:17 PM
  4. Replies: 2
    Last Post: 07-18-2011, 07:11 AM
  5. Multiple Language in my web page
    By Albert in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 09-21-2009, 01:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts