Expression Language Problem in Jsp

Hi,
I am using EL to get the values stored in session for displaying it in JSP page. I can get the values from the session, but when stored in a jsp page to a hidden variable, the values are terminated if it the value contains any symbols like "",[],&
I am getting the values in the session and storing it in the page like this,
*<input type="hidden" name="description" id="description" value="${sessionScope.description}"/>*
When the variable value (description) is having termination characters like /" & its breaking there.
I am getting the description from one page and storing it in session and returning back to the page in this way.
Is there any fix to this problem?

Use the <c:out > tag in place of the inbuilt EL evaluation capabilities of the container. With c:out, xml is escaped by default, so any " will be replaced by &quot; and so on.
{code}
<input type="hidden" name="description" id="description" value="<c:out value = "${sessionScope.description}">">
{code}
ram.

Similar Messages

  • Language problem in JSP please help

    Hi all java guru;
    Altough I tried all different way I can not solve the my problem.
    My problem is Turkish language problem in JSP.
    If my jsp page use database applications such as push or pull data to my SQL 2000 database or call some datas from database, some data which contains turkish caracter are seen wrong. suc as ����� is to ??????
    what is the problem?
    But important point is that; this is only Database data which come from sql database. But I can see JSP data or HTML data truly.
    I try different method to solve in JSP page;
    1-request.setEncoding("iso-8859-9");
    or
    request.setCharacterEncoding( "windows-1250" );
    2-
    @contentType="text/html; charset=iso-8859-9"
    @page pageEncoding="iso-8859-9"
    3-
    <meta http-equiv="Content-Language" content="tr">
    <META http-equiv="Content-Style-Type" content="text/css">
    4-
    ISO-8859-9 is turkish charecter spefications
    String TR_tlp = new String(NEW_TALEP.getBytes(),"ISO-8859-9"); // this parm is inserting database but problem is go on.
    5-
    for the database...
    Properties props = new Properties();
    props.put("user","login");
    props.put("password","password");
    props.put("charSet","UNICODE");
    6-
    url= "jdbc:microsoft:sqlserver://IP_NO:1433;databasename=database;TRUSTED_CONNECTION = true;CHARSET="+sun.io.ByteToCharConverter.getDefault().getCharacterEncoding();
    or
    url= "jdbc:microsoft:sqlserver://IP_NO:1433;databasename=database;TRUSTED_CONNECTION = true;CHARSET=ISO-8859-9"
    con= DriverManager.getConnection(url, kulad, sifre);
    I am using tomcat 5.0.19,
    is there any way to solve this problem... Please help......

    Were you ever able to solve your problem?
    I have a similar problem.
    My database is storing the characters correctly and they can be viewed in Java, but when I try to convert them to unicode using:
    String inputUtf8 = new String(input.getBytes(),charset);
    it works for almost all characters, but some come through as noncharacter "boxes."
    The characters that come through as boxes in iso8859-1 are the ones that are in the "supplementary" character range of that set, such as:
    - curved left and right quotes
    - "TM" symbol
    - bullets
    - m dash and n dash
    (see this table: http://www.csgnetwork.com/htmlchrset.html for a more complete list of the supplementary characters )
    Any idea what I need to do to have these characters show up properly?

  • How to display ArrayList of Vectors using Expression Language in a JSP

    I have added all my values in a vector and this vector is then added to a List. How can I loop through this List, Vector and values in Vector using EL on JSP side. If you have any idea, pl. help with sample code.

    Hi Kavita,
    Well to display each employee information on jsp, you can use following code sceanarion.
    <%
    Iterator it= list.iterator();
    while(it.hasnext()){
       Employee emp=(Employee) it.next();
    %>
    <tr>
    <td><%= emp.getName()%></td>// In the similar fashion you can display other attributes of employee in other td's.
    </tr>
    <%
    }%>Hope this would be helpful to you.
    Regards,
    Gaurav Daga

  • Expression language problem

    <c:set var="test" value="${20+1}"/>
    <c:if test = '�{param.page = 21}'>
    </c:if>hi i have to do some calculations when param.page equals 21. but it never reaches the code inside teh if condition although the parameter im using is 21 but still not working.
    where im going wrong.
    thanks

    perhaps there's a problem with the pound(�) symbol you put un the test instead of a $
    and the equality operator in java is == not = which is an assignment
    hope it helps

  • Expression Language not getting evaluated

    I am trying a sample on tomcat 5.03. The expression Language construct is not getting evaluated.
    for eg
    <c:out value="${customer.age}" />
    simply prints the text ${customer.age} .
    Whats wrong ?
    Thanks
    Ashwani

    You probably have an old doctype for your web.xml file.
    Your web.xml needs to start like this:
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">It should NOT have this
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">Basically if it sees anything less than version 2.4 in the web.xml file, it will disable EL expression language for your JSP pages. This is for backwards compatibility with existing web apps.
    To fix - remove the doctype definition, and use the new one.
    alternative: put this on your jsp page:
    <%@ page isELIgnored="false" %>That will fix it for this page. Fixing the web.xml should fix it for all pages.
    Cheers,
    evnafets

  • JSP/Expression Language in Web AS 6.40

    Hello
    We are trying to port a Servlet/JSP Application from Tomcat to SAP Web AS. It's based on Spring/Hibernate and we are heavily using JSP with Expression Language and JSTL.
    The first problem i had with the "c:forEach" tag, was solved by using the "core" taglib instead of the "core_el" taglib (which means JSTL without Expression Language seems to work)
    As i found out SAP Web AS 6.40 complies to the J2EE 1.3 Standard. Therefore it supports JSP 1.2 and not JSP 2.0 with Expression Language EL.
    Despite not supporting the current JSP Standard, is there any possibility to get JSP Pages with Expression Language running on Web AS 6.40?
    If no, is it planned to support JSP 2.0 in future versions of Web AS and when is it scheduled?
    Thanks for answers
    Sigmar

    Sigmar,
    there is already released light version of J2EE engine including J2EE1.4...You can have a look at the begin page of the SDN, or directly download it by link :
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/webcontent/uuid/64919927-0b01-0010-e9bf-d1570518023d [original link is broken]
    As bonus it includes Java EE 5 preview
    Regards
    Bojidar

  • Help needed in JSP Expression Language

    Hi all,
    I have been working for JSP Expression Language Sample execution since past 5 days. I am using the application server as "Jboss Server" and web server as "Tomcat".
    I have been included the jsp-api.jar file in my lib directory of application server as well as source folder's lib directory.
    When i am trying to build the source code, i am getting this build error.
    [javac] D:\eclipse\workspace\esolvProject\development\src\com\esolv\taglibs\
    web\classes\SetSupport.java:186: cannot resolve symbol
    [javac] symbol : method getExpressionEvaluator ()
    [javac] location: class javax.servlet.jsp.PageContext
    [javac] ExpressionEvaluator evaluator = pageContext.getExpressionEvaluator();
    In my jsp-api.jar , there are two classes called,
    PageContext and JspContext, Both are abstract classes.
    PageContext inherits JspContext class. JspContext class have the method getExpressionEvaluator() , returns ExpressionEvaluator.
    PageContextImpl - class . it has been called internally when we are trying to call PageContext class. In PageContextImpl class, there is one comment before, the method's definition. that is
    " Since JSP 2.0 "
    But we have the JSP 2.0 version. But it won't work.
    Please help me ont this.
    Thanks in Advance,
    Natraj

    >
    If the pblm was due to setting the classpath.
    The error should be showed for all files in the jar
    file.
    why i am getting the error for particular method ?
    it is accessing the other methods of same class
    'JspContext' . but it is not accessing that method.
    Thats my question.
    Just check that your .jar file is 2.0 compliant and that you do not have any other jars(for servlet or jsp api) in the classpath.
    Probably you have an older version of .jar file in your path. So the errors will appear only for those methods that have been added since 2.0, all other methods would compile fine.
    Please tell me the jar files to work out the
    expression language. so that i can cross check my
    list of jars.Hmmm...I dont use jboss. In tomcat the jar file name is jsp-api.jar. But it would have been the same even for jsp1.1, going by jar file names wouldnt help. Just look at your cp as if with a microscope to identify redundant jars.
    cheers,
    ram.

  • JDeveloper ADF Faces Problem: Expression language

    Error(): Expression Language not supported in compile time attribute test
    I have followed an ADF Faces example from the Oracle Website. Concerning a database + ADF Faces
    http://www.oracle.com/technology/pub/articles/cioroianu_jsfadf_v4.html
    I followed the tutorial correct but everytime i try to run it. I get following error:
    Error(): Expression Language not supported in compile time attribute test
    It has something to do with following line of code
    <c:if test="${subscriber == null || !subscriber.loggedIn}">
    The error appears on every page where "<c:" appears.
    I have imported the right class library
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    Does anybody have any idea what i can do?

    Dear Tim,
    What a chance!!! I've got the same problem as you?!
    I've tried almost everything, but still haven't succeeded to solve it!
    Hopefully someone can help us.
    Greetings

  • Unified Expression language framework in another context than JSP/JSF

    Hi
    +(I hope this is the right place for such question)+
    We are building some RCP apps and we are in need, for our frameworks, of a expression language that allows to get and set values, and other things, and it seems that the Unified Expression Language Framework meets our need.
    However, as I said, this is a RCP app, not a web app. So my question is
    Is this framework designed to be used outside of the web app context (jsp, jsf, etc) ? Or is there any dependencies that would prevent or make it difficult to use it in a GUI RCP application?
    Thanks for your help
    cd

    BalusC wrote:
    It's so cool that you can change the way to read your sentence. I never read it any other way. I probably shouldn't have posted a double meaning statement but saying that I'm changing the way I read it is incorrect. I'm not doing that.
    BalusC wrote:
    It's also a great coincidence that you mention exactly the references which are implicitly available in the scriptlet world.Not sure what that's intended to mean. I was exposing to the OP the part of EL that deals with objects that require/assume a j2ee container.

  • JSP 2.0 Expression Language

    Quick question on EL:
    - I noticed in the J2EE 1.4 Tutorial that the Expression Language syntax can be used outside of any JSP tag, for example
    ${name.lastname}is valid, even if used anywhere in the page, i.e. outside of any tag.
    Is this a new feature of JSP2.0, or is this possible using JSTL with prior versions of JSP?
    Thanks, Kevin

    JSP 2.0

  • Problem in accessing object using Expression Language

    Hello All,
    Im using Tomcat 5.5 and I am learning Expression language.Im using one servlet page as login.java i.e,
    package common;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import Database.DatabaseObject;
    import valueobjects.login1;
    public class login extends HttpServlet {
         public static final long serialVersionUID = 8707690322213556804l;
         public void doPost(HttpServletRequest req, HttpServletResponse res) {
              String name = req.getParameter("username");
              String password = req.getParameter("password");
              RequestDispatcher dispatch = null;
              ResultSet rs=null;
              Statement st=null;
              login1 log=null;
              Connection con = null;
              String sql=null;
              try
              con=new DatabaseObject().getConnection();
              st = con.createStatement();
              sql="select * from login";
              System.out.println(sql);
              rs=st.executeQuery(sql);
              while(rs.next())
                   log=new login1(rs.getString("User_Name"),rs.getString("user_Password"));
              req.setAttribute("login",log);
              req.setAttribute("username",name);
              req.setAttribute("password",password);
              dispatch = req.getRequestDispatcher("/jsps/el.jsp");
              dispatch.forward(req, res);
              catch(Exception e)
                   e.printStackTrace();
    That login1 customized object is set as ,
    package valueobjects;
    public class login1{
         String Name;
         String Password;
         public login1(String name, String password) {
              super();
              // TODO Auto-generated constructor stub
              Name = name;
              Password = password;
         public String getName() {
              return Name;
         public void setName(String name) {
              this.Name = name;
         public String getPassword() {
              return Password;
         public void setPassword(String password) {
              this.Password = password;
    then im using one jsp as el.jsp that is,
    <%@ page isELIgnored="false"%>
    <%@ page import = "java.util.*,valueobject.*"%>
    <html>
    <jsp:useBean id="login" class="valueobjects.login1">
    <jsp:setProperty name="login" property="name" value="username"/>
    <jsp:setProperty name="login" property="password" value="password"/>
    </jsp:useBean>
    <body>
         <center>
         username=${login.Name}<br><br>
         </center>
    </body>
    </html>
    but when i execute this code it is giving error as
    /jsps/el.jsp(4,0) The value for the useBean class attribute valueobjects.login1 is invalid.
    But that login1.java is in correct package that is valueobjects.but im not getting why it is giving such error.Plz help me.

    hi
    to use java bean u MUST follow the two conviosions:
    1. the class u want to make a bean from it must have no-argument constructor
    2. u must provide setter and getter for every instance variable , the name of instance varible must begin with small letter and its setter and getter must be like setXxx() and getXxx()
    the correct bean is :
    package valueobjects;
         public class login1{
         String name;
         String password;
         public String getName()
                   return name;
         public void setName(String name)
                   this.name = name;
         public String getPassword()
                    return password;
         public void setPassword(String password)
                    this.password = password;
         }where is my duke's $ ???

  • How to check arraylist size greater than 1 using expression language in jsp

    I want to remove the scripplet in jsp, so i am using jstl tags with expression language in it.
    My scripplet is
    <% if (arraylist.size() > 1) {
    ---do something ----
    %>
    i wanted to change this to
    <c:if test="${ somecondition }">
    ---do something ----
    </c:if>
    here "somecondition" is exactly i need to check whether my arraylist size is greater than 1.
    so please can anyone help me how can i do that.

    If you do not mind, you can create a function and package it into a tag library of your own. Then you can use the function just as the existing expressions language construct. You may take a look at the article use functions in jsp expression language.

  • Expression Language in JSP w/ JSTL

    Does expression language decrease performance on the page?

    I was browsing the forums and i came across
    http://forum.java.sun.com/thread.jspa?threadID=349876&messageID=1450081
    The only difference is that I'm using Tomcat 5.0...
    Our pages are running slow and we can't figure out what's wrong...

  • JSP expression language

    Hello,
    When I edit .JSP file with JDeveloper 10.1.3.1, the tag is underlined with the yellow line
    <jsp:include page="${param.content}" />. I am sure it's very easy to fix, does anyone know how?

    Hi, Chris Muir:
    The <jsp:include> tag documentation says the page attribute requires round brackets
    around the value, as follows:
    <jsp:include page="({$param.content})"/>That understanding is wrong. You are referring to the following documentation in JDev online help, right?
    JSP syntax <jsp:include page="(relativeURL | <%= expression %> | ${ Expression })"
    [flush="true | false"]
    [jsp:param]>
    </jsp:include> Here the round brackets "( )", together with the vertical lines "|" is just to indicate several choice are available. The page attribute does not require round brackets. If you do include round brackets, they will become part of the value for the page attribute, which is certainly not what one want. The same can be said about the square brackets around flush or jsp:param.
    Alternatively a yellow/orange line in the JDev editor usually indicates a warning, not an
    error. On the left hand side of the editor, is the code assist icon showing (a lightbulb),
    and selecting it, does it reveal any useful info?
    Alternatively (x 2) on the right hand side of the editor, is there a yellow box showing,
    and hovering your mouse over the yellow box for a second or two, does any useful
    information show?These are nice suggestions. Still another alternative. Hover your mouse right above the yellow line, a small message window pops up. It shows the relevant reason for the yellow line. That at least works for me.
    Moreover, the warning is, "${param.content} is not found under root C:\jdev\studio10131\jdev\mywork\Application1\Project1\public_html\". It is just a warning. This warning is as much as JDev can do since ${param.content} is a runtime expression that can not be resolved at design time. One can safely ignore it as long as one remembers to create the alluded page.

  • {Expression Language} not working tomcat5 j2se 1.5_beta

    I m new to JSP technology. I m trying to use expression language in my application and it's not letting me do the job.
    simple program
    <head> <body>
    Hi there! 3 + 3 is ${3+3}
    </body></head>
    It just shows " Hi there! 3 + 3 is ${3+3} " as the output. I tried google search. it seems the problem is across many networks like in bea weblogic etc.,
    when i used <%@page isELEnabled="true" > i get an error saying attribute isELEnabled not recognised or something like that. My web.xml hasn't got any setting for jsp so I don't know where the "*.jsp" section is available, just in case that needs any touchup.
    I have installed JSTL under /common/lib dir. but i think this library is not required for using basic EL.
    So, can anyone help me configure my JSP page so that i can use EL tags in them.
    OS: Windows 2000
    Tomcat ver: 5
    J2Se: 1.5 beta

    Hmmm. Looks like I didn't make myself clear enough.
    You still have the declaration DTD for servlet 2.3 at the top of your web.xml.
    To enable EL using Tomcat 5 you only need to do ONE of the following:
    1 - update your web.xml file to have the header for the 2.4 version (note its not a DTD anymore)
    2 - if your web.xml uses the DTD from version 2.3, include the page directive <%@ page isELIgnored="false" %> on any pages
    Basically the rules for executing EL are as follows:
    1 - Is there a directive on the page? If yes, then enable/disable according to the directive.
    2 - Is there an entry in web.xml for handling EL? If yes then enable/disable according to the setting
    3 - Is the web.xml file for the Servlet 2.4 spec? (ie does it start have the version 2.4 header) Yes = enable EL No = disable EL
    The easiest way of enabling EL is updating your web.xml to be compliant with the latest servlet spec.
    Cheers,
    evnafets

Maybe you are looking for

  • My smart watch just works when it's connected to the charger

    Hi, I bought my smart watch just 2 months ago, and left it in my car charging.. well, the next day when I saw that the battery was fully charged, disconnected the watch and puted it on the armband it doesn't turned on anymore, no vibrations, no displ

  • 2 Seperate iTunes accounts on 2 seperate computers?

    I hope someone is able to help. I have 2 computers (1 Mac, 1 Windows Laptop) Both computers have an individual iTunes Account (1 mine, 1 my girlfriends) Can we share our libaries with each other via Home Sharing? If so please provide directions. Than

  • Share content between sites SharePoint 2013

    Hi folks, I have 2 sites on sharePoint 2013 (intranet site + Internet site), each one has its own content (lists, master page, etc...) except some pages like "about us", "daily news"...  My problem is the following: The content administrator is doing

  • Nokia 5300 cabel error

    I have nikia 5300. And I have any problems with cabel connection all the time. But now i bougt new pc. I was connected my phone one time to it and it was everything fine, but now it's stopped working. I connect my phone and select "data transfer" mod

  • InitialContext problem when using classloader

    Hi I tried to do a client (stand alone not EJB bean) that make lookup for connection factory, which i define via the weblogic console. When I used simple client (not using class loaders) the Initial Context work fine, but when I try it from a client