Accessing variables from EL

In a JSP page, if I have the following:
<%! String str = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"; %>
${str}${str} does not display the String...
I thought that str is of Page Scope. So I changed ${str} to
${pageScope.str}, but it still does not work.
Does anybody knows how to display the Str.

You can't mix EL and RT code this way.
I think you need <jsp:useBean> and <c:set> to accomplish what you want. But it's either all EL or RT, but not mixed. - MOD

Similar Messages

  • Accessing variable from another JSP

    Friends,
    say, I have a Test1.jsp which has a variable "input". Is it possible to access this variable from other jsp "Test2.jsp"?
    any ideas?
    Thanks
    Hari V

    hi hari,
    there are essentially 3 ways of doing it....
    1).Usage of Hidden Values
    2).Using Cookies
    3).Storing attribute value within the scope of request/session/appln
    The choice is all urs....???
    Regards,
    RAHUL

  • Problem accessing variables from java file to JSP page

    Hello Everyone,
    I have small problem accessing my method variables from my java bean file to a JSP page. can some please take a look and tell me why I can't populate my JSP page, I've been trying all day to get this done!!!
    This is my Java file
    package dev;
    import java.io.*;
    import java.util.*;
    public class RoundDetail2
    public String string_gameID;
    public int string_card1;
    public String readDetail_topLayer;
    public static final String SUITS[] = {" ", "Clubs", "Hearts", "Spades", "Diamonds", "Joker", "FaceDown"};
    public static final String VALUES[] = {"Joker ","Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
    public static final String SuitVALUES[] = {" ","1","2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"};
    public RoundDetail2() throws FileNotFoundException
    DataInputStream inFile=
                 new DataInputStream(
                    new BufferedInputStream(
                   new FileInputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/WEB-INF/classes/dev/Data_452SY2.txt")));
    try { 
                 while((readDetail_topLayer = inFile.readLine()) != null)
              StringTokenizer tokenizer_topLayer = new StringTokenizer(readDetail_topLayer,"\t", true);
                   while  (tokenizer_topLayer.hasMoreTokens())
                        string_gameID = tokenizer_topLayer.nextToken();
         catch(IOException e)
                    System.out.println(e.getMessage());
         Thanks KT

    ......How are you declaring the class in your JSP? ... are you instantiating it as a bean using the useBean tag, or just instantiating it in your code like normal.
    Maybe you could post the relevant JSP code too?
    Hello again,
    Only the last string is populating after the file has be tokenized. What I'll like to accomplish is passing the very first string in the file. I did not get too far in the JSP file setup because the code is still in it's testing stage, but any help will be highly appreciated.
    Here is the JSP code
    <%@page import="dev.*" %>
    <%@page session="true" language="java" import="java.io.*" %>
    <jsp:useBean id="wagerhist" scope="request" class="dev.RoundDetail2" />
    <html>
    <head>
    <title>Round Detail</title>
    <body>
      <table width="530" bordercolor="#000000" valign="top">
        <tr>
              <td align="left"  width="19%">Game ID<%=wagerhist.string_gameID%></td>
              <td align="left"  width="30%">  </td>
              <td align="left"  width="20%">card1</td>
              <td align="left"  width="31%">  </td>
            </tr>
      </table>
    </body>
    </html>

  • Accessing variables from Child window from the parent window

    Hi All,
    I am in the process of integration of payment gateway, here I am opening payment gateway page as a new window, and after payment is done then I need access one variable which is hidden variable ...any ideas

    Have a hidden field/js variable in the parent page. Add a Javascript function in parent page which would take a value as parameter and set in the parent page hidden field/js variable. In the child window, you can invoke the method from script block as window.opener.setValue(document.getElementById('CHILD_WINDOW_HIDDEN_FIELD_ID').value)
    For Javascript related questions, please visit Javascript forums.

  • Accessing variable from another class

    Say I want to access String ABC from class XYZ from my main class. I have already created the object for the class I just don't know the syntax for accessing the variable.
    This is just an example. I figured this is just a problem of finding the right syntax so I didn't bother creating a compiling code.
    public class test{
    public static void main(String[]args){
         XYZ xyz = new XYZ ();
         String a = abc.XYZ(); // this is where i want to directly access the variable abc. i know this isn't correct and it's what im trying to find out how to do.
    public class XYZ{
         String abc = "hi";
    }Edited by: aznprdgy on Nov 3, 2009 2:13 PM

    No, that isn't possible.
    abc is said to be a local variable. And it's only useable within method().
    It's part of the job of the class Xyz to control the access to its state. As an example:
    public class Test {
        public static void main(String[] args) {
            Xyz xyz = new Xyz()
            String a = xyz.getSpecialValue();
    public class Xyz {
        private String a;
        public String getSpecialValue() {
            return a;
        public void method() {
            a = "hi";
    }Note that a won't be reference to the string "hi" until after method() has been called.

  • Access Variable from a dynamic name

    Hello,
    I have a the following example variable in a script defined
    as such:
    mcDrg05OriginalX = mcDrg05._x;
    I wish to access this variable data within a button script,
    but dynamically by assembling the actual variable name:
    newName = holdName[landingCount];
    relocateIDx = (newName + "OriginalX");
    newName accesses the original name from an array, and
    relocateIDx assembles the full variable name to be
    mcDrg05OriginalX. Now I wish to access the original numerical value
    from that variable name, but how?
    I tried:
    _root[newName]._x = (relocateIDx);
    _root[newName]._x = [relocateIDx];
    maybe the answer is out there.
    Thanks in advance.

    Never Mind. I should of searched before.
    If I use:
    relocateIDx = eval(newName + "OriginalX");
    this now gives the original number
    Thanks

  • How to access variables from other class

        public boolean inIn(Person p)
            if  (name == p.name && natInsceNo == p.natInsceNo && dateOfBirth == p.dateOfBirth)
                 return true;
            else
                 return false;
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phello,
    here am trying to compare the existing object with another object.
    could you please tell me how to access the variables of other class because i meet this error?
    name cannot be resolved!
    thank you!

    public class Person
        protected String name; 
        protected char gender;      //protected attributes are visible in the subclass
        protected int dateOfBirth;
        protected String address;
        protected String natInsceNo;
        protected String phoneNo;
        protected static int counter;//class variable
    //Constractor Starts, (returns a new object, may set an object's initial state)
    public Person(String nme,String addr, char sex, int howOld, String ins,String phone)
        dateOfBirth = howOld;
        gender = sex;
        name = nme;
        address = addr;
        natInsceNo = ins;
        phoneNo = phone;
        counter++;
    public class Store
        //Declaration of variables
        private Person[] list;
        private int count;
        private int maxSize;
    //constructor starts
        public Store(int max)
             list = new Person[max];//size array with parameters
             maxSize = max;
             count = 0;
        }//end of store
    //constructor ends
    //accessor starts  
        public boolean inIn(Person p)
           return (name == p.name && address == p.address && natInsceNo == p.natInsceNo);
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phope it helps now!

  • Accessing  variables from one layer.

    Hi all,
    I am new to falsh so please help. I have defined some
    variable at one layer say click origin and destination and i want
    to access that varibale on click event of a button.
    how to access that variable on another layer.
    Thanks in advance.

    'layers' are not referred to and cannot be referred to in
    action-script.
    have a look here

  • Best way to access variables from actionCommand

    Say I have a method which reads some data from a file, then stores it in a string. I have a button in this method with an ActionListener defined as follows:
                    btnOk.addActionListener(new ActionListener() {
                       public void actionPerformed(ActionEvent e) {
                           otherMethod();
                    });Now I need to pass the value of my string to this other method. What's the best way of doing this? Currently I have it declared at the top of the class but it seems a bit messy. I know I could declare the string final, but I need to set it conditionally depending on another variable, so I'd need to declare it before I initialize it's value. If it's declared final this won't work. Is the method I'm using now the usual way of doing this?

    Echilon wrote:
    Say I have a method which reads some data from a file, then stores it in a string. I have a button in this method with an ActionListener defined as follows:It's not great practice for a GUI event listener to call something that does file I/O. It'll lead to a sluggish interface, since I/O is slow.
    A better solution is to invoke code that will cause the I/O to happen in a different thread. I think that Swing actually has built-in support for that, but I don't use Swing much so I don't know.
    Now I need to pass the value of my string to this other method. What's the best way of doing this? Currently I have it declared at the top of the class but it seems a bit messy. I know I could declare the string final, but I need to set it conditionally depending on another variable, so I'd need to declare it before I initialize it's value.That doesn't necessarily mean that you can't declare it final. Final just means that once you assign it, you can't change it. You can still set its initial value conditionally.
    I agree that it's messy to use fields for no other purpose than to pass values between methods.

  • Accessing variables from a symbol?

    Hey there guys, sorry I'm not much of a coder and am a designer but here's my issue.
    I have a character who is a student who is going to enter a chemistry lab, but before he does, the user has a choice to put on a coat and goggles on the character, so when the goggles are chosen the gogglesVar == false, etc and then when you click on the door the character will walk through the door and then get to this code (which is inside a symbol)
    if( sym.getComposition().getStage().gogglesVar == false ){
    sym.play("goggles");
    if( sym.getComposition().getStage().coatVar == false ){
    sym.play("coat");
    }else{
    sym.play("noCoatNoGoggles");
    but no matter what i choose the code always goes to sym.play("noCoatNoGoggles");
    is that because it's in a symbol and doesn't see the gogglesVar == false anymore?
    Hope that makes sense, and thanks in advance.
    Ross.

    Thanks resdesign,
    yes you are correct, they are labels, but within the character's symbol timeline, I guess an image would help show what I want to do, so here it is...
    So the user can click on the coat, goggles or door. And here's what I want: if the user just clicks on the door then the character walks through the door and runs out on fire and his eyes melting (ie label  "noCoatNoGoggles"), if they click on the goggles only, then he walks through and runs out on fire (ie label  "goggles"), and if they click on the coat only, then he walks through and runs out with his eyes melting (ie label  "coat"). If the character clicks on both the coat and goggles, then the character walks through the door and the screen fades and goes to another scene.
    So at the moment I have the goggles and coat change to false when you click on them, and then when the character walks through the door it should then check to see what each variable is set at and then jump to the appropriate frame label and thus the appropriate animation. But unforunately it's not working.
    Unfortunately I dont think the code you gave me will work for what I'm after too because where do I place the false statement for the coat and goggles?
    I hope that explains what I'm trying to do better.

  • How to access variables from other classe through getter ?

    Hi !
    I have 10 classes
    Cau_1.java containing char Cau_1_Answer;
    Cau_2.java... Cau_2_Answer;
    Cau_10.java... Cau_10_Answer;
    and another class Resume_grammar.java with char[] AnswerList = new Char[10] used to hold cau_1_Answer, Cau_2_Answer...Cau_10_Answer.
    but I don't success to get them.
    In Cau_1.java, I do :
    private static char Cau_1_Answer;
    static char getCau_1_Answer() {
              return Cau_1_Answer;
         static void setCau_1_Answer(char cau_1_Answer) {
              Cau_1_Answer = cau_1_Answer;
    if (a.isChecked()) {Cau_1_grammar.setCau_1_Answer('a');}
    if (b.isChecked()) {Cau_1_grammar.setCau_1_Answer('b');}
    if (c.isChecked()) {Cau_1_grammar.setCau_1_Answer('c');}
    if (d.isChecked()) {Cau_1_grammar.setCau_1_Answer('d');}
    Cau_2, Cau_3...are the same way.
    in Resume_grammar.java :
         static char[] AnswerList = new char[10];     
    AnswerList[0] = Cau_1_grammar.getCau_1_Answer();
    AnswerList[9] = Cau_10_grammar.getCau_10_Answer();
    When I make AnswerList display, all is null (nothing displayed).
    Please help ! What I do wrong ?
    Thank you !

    Johnny.vn wrote:
    Cau_1 is Question_1 (Vietnamese).
    I am developing a academic test application with many question and finally display the result of the test.
    Thank you.Back to the original question: why do you need to define different classes for different questions? Do they really behave differently in a way that can't be captured by a single class?

  • Access a Connect By Level variable from subquery

       With curr_date_details as
        select   to_date('16-dec-09', 'dd-mon-yy') as businessdate 
              ,  trunc( to_date('16-dec-09', 'dd-mon-yy'), 'iw') as bow
              ,  to_date('23-nov-09', 'dd-mon-yy')  as bop
              ,  trunc(to_date('23-nov-09', 'dd-mon-yy'),'iy')  as boy   
              ,  3 as week_nbr
              ,  3 as per_week_nbr
              ,  12 as per_nbr
       from dual
       select  --== Week Number
                  case when level <= date_rec.per_week_nbr
                     then  level
                     when level = date_rec.per_week_nbr  + 1
                    then 6
                    when level = date_rec.per_week_nbr   + 2
                    then  7
                        when level = date_rec.per_week_nbr   + 3
                    then  0
                end as week_nbr
                --== Start Date
              , case when level <= date_rec.per_week_nbr
                     then  to_date('23-nov-23', 'dd-mon-rr')
                     when level = date_rec.per_week_nbr  + 1
                    then  date_rec.bop
                    when level = date_rec.per_week_nbr   + 2
                    then  date_rec.boy  
                         when level = date_rec.per_week_nbr   + 3
                    then  date_rec.boy  
                end as start_date
                --== End Date
               , case
                    when level <= date_rec.per_week_nbr
                    then   to_date('23-nov-23', 'dd-mon-rr')  + 6  
                      when level = date_rec.per_week_nbr  + 1
                    then  date_rec.bow + 6
                     when level = date_rec.per_week_nbr  + 2
                    then  date_rec.bow + 6
                            when level = date_rec.per_week_nbr   + 3
                    then  date_rec.bop - 1  
                 end as end_date
              --=== Dummy Column
              , case
                    when level <= date_rec.per_week_nbr
                    then ( select 1 + level as t  from dual)
                    else  100
                end as pesky_column
          from dual mydual
          inner join curr_date_details date_rec on  date_rec.businessdate = to_date('16-dec-09', 'dd-mon-yy')
          connect by level <= date_rec.per_week_nbr  + 3gives me error:
    Error at Command Line:9 Column:2
    Error report:
    SQL Error: ORA-01788: CONNECT BY clause required in this query block
    01788. 00000 - "CONNECT BY clause required in this query block"
    *Cause:   
    *Action:
    How can i access variable from subquery?
    this question was taken from another post
    Having trouble selecting from a table function

    Hi,
    Using a joiin:
    WITH     connect_by_query AS
       select  --== Week Number
                  case when level <= date_rec.per_week_nbr
                     then  level
                     when level = date_rec.per_week_nbr  + 1
                    then 6
                    when level = date_rec.per_week_nbr   + 2
                    then  7
                        when level = date_rec.per_week_nbr   + 3
                    then  0
                end as week_nbr
               --=== Dummy Column
           , LEVEL     AS lvl
           , per_week_nbr
          from curr_date_details date_rec
          connect by level <= date_rec.per_week_nbr  + 3
    SELECT       cb.week_nbr
    ,       case
                    when  cb.lvl <= cb.per_week_nbr
                    then  NVL (sd.sales, 0)
                    else  100
                end as pesky_column
    FROM           connect_by_query     cb
    LEFT OUTER JOIN      sample_data          sd     ON     sd.datakey = cb.lvl
    ORDER BY  cb.lvl
    ;You could also compute week_nbr in the main query, rather than the sub-query.
    Using a scalar sub-query:
    WITH     connect_by_query AS
       select  --== Week Number
                  case when level <= date_rec.per_week_nbr
                     then  level
                     when level = date_rec.per_week_nbr  + 1
                    then 6
                    when level = date_rec.per_week_nbr   + 2
                    then  7
                        when level = date_rec.per_week_nbr   + 3
                    then  0
                end as week_nbr
               --=== Dummy Column
           , LEVEL     AS lvl
           , per_week_nbr
          from curr_date_details date_rec
          connect by level <= date_rec.per_week_nbr  + 3
    SELECT       week_nbr
    ,       case
                    when lvl <= per_week_nbr
                    then NVL ( ( select sales from sample_data where datakey = lvl)
                    , 0
                    else  100
                end as pesky_column
    FROM       connect_by_query
    ORDER BY  lvl
    ;Notice that the sub-query connect_by_query is the same in both cases.

  • Can't access variables in specific S7-1200 DB's in LabVIEW project

    Hi all,
    I'm trying to establish a connection between LabVIEW and a Siemens S7-1200 though Ethernet and SIemens OPC Server.
    The physical connection is OK (I can ping S7-1200 with no problem).
    When I needed to access variables from specifics DB's inside S7-1200 ( I want to access variable DB190,X0.4), I called Siemens support and they said I had to modify the variable's definition when using OPC Scout, from "MX0.4" to "DB190,X0.4", and then it was possible to access this variable.
    Same solution (renaming the path) applies to NI OPC Client, I can read and write variables properly.
    My problem is that when I try to add variables in LabVIEW Project, I can't find those variables whose address were modified, so I can't access the correct variable in my program.
    I tried to change the variable path in Multiple Variable Editor, but it doesn't work either.
    Any suggestions on what I can try??

    First: Avoid the ODBC/JDBC Bridge if at all possible.
    It's the worst JDBC driver I've ever seen. It's buggy
    and a great hindrance both to learning and to
    producing usefull code.I agree that there might be problems with M$ Access, but there are problems with all databases, including MySQL (e.g., no referential integrity in free download version). It's capable enough for the query the OP is trying to execute.
    The problem is with his code, not Access or the bridge driver. He'll go through a lot of effort to switch databases and still have this problem. Better to understand what HE'S done wrong and fix it so he'll do it correctly for all databases, including Access.
    You just need to be more careful with your query, I'm sure.
    %

  • Setting variables from a testcase?

    Hello,
    How do I access variables from my BPEL flow from a testcase?
    I need to set some header variables and such that is not availible in the emulate tab so I am looking for a way to manualy in my testcase add/alter/read variables from the BPEL flow?
    I know this "could" be emulated by setting them in the normal flow but since it is test specific I would like to avoid adding thing to the flow and instead have them in my "test case".
    // MickeM

    shouldn't I also be able to access the outer classes methods? It doesn't seem to do this either.

  • How to access a variable from within a symbol.

    How do I access a variable set outside a symbol from within that symbol?
    Thanks

    If you set a variable on stage ,say
    sym.setVariable("stageVariable", "I am stage variable");
    You can access it from within  a symbol using :
    var myVariable = sym.getComposition().getStage().getVariable("stageVariable");
    Basically you need to get handle to the symbol in which the variable is defined.

Maybe you are looking for

  • BH-903 is a bad product

    Hi, BH-903 is a well designed headsed with great features but I am too disappointed with it. I bought it on january last year and received a non functional headset ( left and right keys were not working). I had to send it back to Nokia and received a

  • Closed lid MBP wakes up by itself

    I just bought a mid 2012 MBP OS 10.8.3 and it keeps waking itself up when the lid is closed at random times during the night. I never had this problem with the 2007 Black MacBook or the Late 2011 MacBook Pro. "Wake for networkaccess" is turned off, t

  • Itunes error there was a problem downloading 8275

    I am running Windows Vista Business 32-bit on a fresh installation of Windows.  I have reloaded iTunes 10 and updated my library from a backup I had on my server.  I continue to recieve the following error when I try to download a new album that I pu

  • Change Quality of Service Message

    Hello, I've a interface IDOC - JDBC. The quality of Service is EOIO. II want to change this quality to EO How can i do it? Where? thank very much,

  • Concurrency in Swing,  Multi-processor system

    I have two questions: 1. This is a classic situation where I am looking for a definitive answer on: I've read about the single-thread rule/EDT, SwingWorker, and the use of invokeLater()/invokeAndWait(). The system I am designing will have multiple Sw