How to get java variable in jstl???

Hi,
I am wondering the way to retrieve or set java variable in jstl.
<%
String str="123";
%>
<c:set var='str'> <<?????
Edited by: gohgss on Oct 17, 2007 9:30 AM

No, they exist in different 'places'. The JSTL variables are in one of four scopes ( page, request, session or application ) while the scriptlet variables are simply local to the _jspService() method of the translated JSP.
It's not recommended to mix up scriptlets and EL/ custom tags.
But if you do need to you can do this:
<%
String str="123";
request.setAttribute("str", str);
%>
<c:set var='str'>  //now you can work with str, but it'll be happening via the requestScope----------------------------------------------------------------
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
----------------------------------------------------------------

Similar Messages

  • How to use Java Beans In JSTL?

    Hi
    I want to know how to use Java bean in JSTL
    please explain this with giving any one example.
    Thanks-
    Swapneel

    A bean is obtain by <jsp:useBean> tag nd once bean is obtained we can get its property by using getProperty tag.

  • How to get .java files in iStore

    Hi,
    I do have .class files in my server.How do i get .java files.
    Do i need to create a .java file in jDevloper ,copy the content of the .class and paste it in jDeveloper and compile on the linux server.
    Thanks,
    Sabitha

              Set the 'keepgenerated' parameter in weblogic.xml to 'true'
              <jsp-descriptor>
              <jsp-param>
              <param-name>
              keepgenerated
              </param-name>
              <param-value>
              true
              </param-value>
              </jsp-param>
              </jsp-descriptor>
              thanks,
              Deepak
              "Chris Cooper" <[email protected]> wrote:
              >Hi,
              >
              >I wanna read the .java file compiled from JSPs in Web applications
              >deployed in Weblogic server, and I know that Weblogic delete them
              >after compiles the JSPs. how to get the java file?
              >
              >TIA
              >
              

  • How to get java

    How do I  get java on my new apple?

    You can run Java apps and applets if you subscribe to remote desktop services like AlwaysOnPC. It runs them just fine. See http://www.iphonelife.com/blog/87/how-you-will-want-watch-flash-only-videos-and- use-dynamic-flash-content for more info.

  • How to call java class in jstl core

    Hi,
    Can any one guide me how to call a java method using jstl core library

    Read on about EL functions.

  • How to get Java on my mobile device.

    I pretty much only have one use for Java. I go to a game site that needs Java to run the game, but I don't know what Java program to put on my phone to make it work.
    I have a Palm Treo 700wx with Windows 6. The site I go to is http://wild.ffiends.com/DCourt/Game.stm
    To make that display on my phone's internet what is the best program? J2ME? And how to get it.
    Thanks up front.

    Hi,
    I would ask does the phone have an App for getting IMs ?
    Is the setting to Forward IMs to the Phone set in iChat > Preferences > Accounts ?
    Does your Phone Service support IMs from outside their Network ?
    I presume though that you are sending text to a number (+1234567890) rather than forwarding ?
    The UK T-Mobile site has this page But needs a teelphone number to run the tool and does not answer FAQs as such
    The FAQ Page is here (UK Site)
    I would also be looking for any settings on the my account page (if I had one) to see if Accepting IMs has to be set there (And costings)
    8:41 PM Thursday; April 2, 2009

  • How can get this variable ??????

    package murat;
    import javax.microedition.lcdui.*;
    public class TarihAyarla extends anaform{
    public static DateField tarih;
    public TarihAyarla() {
    super("Sms gonderilecek tarihi girin");
    tarih = new DateField("tarihi girin",DateField.DATE_TIME);
    append(tarih);
    a=tarih;
    public class main extends midlet{
    private DateField var(){
    //how can get the tarih object in here
    }

    First, buy a book on Java!
    Second, when posting code, please use the [ code ] tags, it makes it a
    lot easier to read code.
    Finnaly, how about:
    private DateField var(){
        //how can get the tarih object in here
        return TarihAyarla.tarih;
    jc

  • How to get the variable value of a step (ex : Step.TS.Data) with C#?

    I try hard but do not managed, I can't get the variable situaded inside a step?
    I have created my sequence object then my step object (I can get the right name of this one)
    but I didn't find in the help the method allowing to get any value of the step variables.
    Any idea? Thank you

    Hi,
    You obtain a reference to your step as an PropertyObject.
    Using this PropertyObject reference you can use the PropertObject.GetValString|GetValNumeric|GetValBoolean.
    Hope this helps.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to get java.sql.Timestamp data from database

    Hello, i'm new to EJB and i can't get java.sql.Timestamp data, but when i'm trying to get java.lang.String data it works fine.
    * @ejb.finder
    * query="SELECT OBJECT(c) FROM userSCHEMA AS c
    *      WHERE c.lastName LIKE ?1
    * AND c.firstName LIKE ?2
    * AND c.registeredDate < ?3"
    * signature="java.util.Collection findPatient * (java.lang.String lastName,
    * java.lang.String firstName,
    * java.sql.Timestamp)"
    <method-params>
    <method-param>java.lang.String</method-param>
    <method-param>java.lang.String</method-param>
    <method-param>java.sql.Timestamp</method-param>
    </method-params>
    Where i made a mistake ?

    The main problem that I'm faced with, is that the
    java.sql.Timestamp now has only one constructor, it
    takes "long", i.e., milliseconds.That's because a Timestamp is just an offset from a particular instant of time. It doesn't have a timezone.
    Please note that I'm not trying to "print", i.e., I'm
    not interested in using the SimpleDateFormat.Then what are you interested in? You appear to be trying to create a Timestamp with a particular timezone, which doesn't make sense as I already noted. Is there a reason for this?

  • How to get the variable set by c:set in Scriptlet ?

    Hello,
    I set up some variables by <c:set> and struts tag <bean:size>, and the values should be considered as integers. How can I use the variables in math expression?
    When I try to use the variables in scriptlets, I got compile errors in the getAttribute lines.
    My code:
    <bean:size id="listSize" name="list" /> <c:set var="pageSize" value="${20}" />
    <c:set var="pageBegin" value="${param.pageBegin}" />
    <%
    int ls = (Integer)pageContext.getAttribute("listSize");
    int ps = (Integer)pageContext.getAttribute("pageSize");
    int totalPages = (int)Math.ceil((double)ls / ps);
    %>

    xiaoxuan_li wrote:Hello,
    I set up some variables by <c:set> and struts tag <bean:size>, and the values should be considered as integers. How can I use the variables in math expression?
    When I try to use the variables in scriptlets, I got compile errors in the getAttribute lines.
    My code:
    <bean:size id="listSize" name="list" />
    <c:set var="pageSize" value="${20}" />
    <c:set var="pageBegin" value="${param.pageBegin}" />
    <%
    bq. int ls = (Integer)pageContext.getAttribute("listSize"); \\ int ps = (Integer)pageContext.getAttribute("pageSize"); \\ int totalPages = (int)Math.ceil((double)ls / ps);
    %>I finally find the errors, I change the getAttribute() lines to the following, and the program runs well, although I'm still curious of if there is a better way to get the value of totalPages by using JSTL tags, instead of scriptlets.
    <%
    bq. {color:#ff0000}Number {color}ls = {color:#ff0000}(Number){color}pageContext.getAttribute("listSize"); \\ {color:#ff0000}Number {color}ps = {color:#ff0000}(Number){color}pageContext.getAttribute("pageSize");
    %>

  • How to get a variable into another block?

    Hello,
    (I am from Germany, so be patient due my english please)
    We do a project at our University where we have to do with wordfrequencies. The app works fine, but it cannot works with the variable wich contains the information to analyse.
    Look, I am more or less new in Java and I found a code and modyfied that. So I had to initalize the variable with the data from another class. I did the following thing.
    Thats is the class, where the variable is come from:
    class Lesen extends HTMLEditorKit.ParserCallback                                        
         String zeile;                                                                           
         String fileName;                                                                
         Wortfrequenz aha;                                 // name of the class where I need the variable                                                                                                                                                                      public Lesen (String fileName)                                                          
              this.fileName = fileName;                                                      
    public void handleText(char[] data, int pos)                                            
                    String strom = new String (data);                                       
                    aha = new Wortfrequenz ();                                              
                    aha.verb(strom);                // "strom" is the variable here in this class which caontains the data
    ....and within the class "Wortfrequenz" I tryed to do the following thing:
    import java.util.*;                                                                     
    import java.io.*;                                                                       
    public class Wortfrequenz
         static String flus;                                                                     
         public void verb (String o)                                                             
              flus = o;                                                                       
    HashMap words = new HashMap();                                                         
    HashMap stopWords = new HashMap();                                                      
    String delim = " \t\n.,:;?!-/()[]\"\'";                                                 
    String file;                                                                            
    String word;               
    Count count;                                                            
                    try
                            FileReader kl = new FileReader("stopwords.txt");                
                            BufferedReader mk = new BufferedReader(kl);                     
                            String einlesen;
                            Lesen eins = new Lesen(flus);                                   
                            while ((einlesen = mk.readLine()) != null)                      
                                    stopWords.put(einlesen, einlesen);                      
                            mk.close();  if I test the app and do a "System.out" direktly after
    flus = o;then I can see that the information is within the variable, but when I test the variable within the next block where I need it, for example after
    Count count;or anywhere in this block, then I get
    null
    null
    null
    null
    null
    ...if anyone tell me how I can get the information of this variable into the nex block, that would be great.
    Thanks a lot for helping...
    Stephan

    This: public void verb (String o)                                                             
      flus = o;                                                                       
    }Is the whole verb method. That's all it does is assign the flus variable. This:{               
    HashMap words = new HashMap();   
    // etcIs an initializer, which runs as soon as the object is created, ie before the verb method.

  • How to get binding variables from request

    We are trying to use html-db to develop an application which need to get values from user request to use in the queries, i.e. we will have pages depend on several binding variables and the value of these variables will be provided by the user through get/post request. Because the request will be initialed by another application so to use a form to collect the values is not an option.
    I am a html-db newbie. Does anyone here know how to do that?

    you're right in thinking this is a bit of a newbie html db question. it's a pretty straightforward matter to set up a report in html db that runs off of bind variables that can be set from a URL. you can see a pretty simple example on the first page of our "Sample Application" that's available to install into your workspace. try taking a look at that to see what i mean. you can install the Sample Application by clicking the "Review Demonstration Applications" link that's available right after logging into htmldb.oracle.com. that resulting screen lets you create (or re-create) the Sample App in your workspace. once it's installed, take a look at how the report on page 1 calls the first report on page 201. that report on 201 is dependent on a bind variable, :P202_CATEGORY, that's set from the URL. this particular URL is generated from the report on page 1, but it could just as easily have been generated from your other application. when you look at this example, the two key points to pay attention to are the 1) syntax used in the URL to set the bind variable (which is explained in our online help at http://htmldb.oracle.com/i/doc/mvl_fund005.htm#sthref357) and 2)the way in which that bind variable is referenced in the first sql query region on page 201. take a look at those when you get a chance, and let us know if you have further questions.
    thanks,
    raj

  • How to get Java source in applet stack trace to debug Java security manager

    How can I get line numbers for Java source in stack traces for my applet? I'm having a problem with my code-signing certificate. On one of my applets, I consistently get a NullPointerException inside the security dialog code in the JDK. As a result, either the "trust this applet" dialog never appears, or even though it appears, it defaults to untrusted because of the exception, so I can't access any local files (and that's a bit of a problem for an applet whose sole purpose is to upload files to our server). I unzipped src.zip in my JDK directory and set the debug flag for my Ant <javac> task as well as set debuglevel to "lines." Anything else? Here's the trace that I'm getting so far. See that after the NullPointerException it assumes that the user has denied permission. If I could read this Java source maybe I could figure out why it hates my code-signing certificate (jarsigner, BTW, never complains when I verify my jar).
    security: Blacklist file not found or revocation check is disabled
    security: Accessing keys and certificate in Mozilla user profile: null
    security: Loading Root CA certificates from D:\Program Files (x86)\Java\jre6\lib\security\cacerts
    security: Loaded Root CA certificates from D:\Program Files (x86)\Java\jre6\lib\security\cacerts
    security: Loading Deployment certificates from C:\Users\Rich\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
    security: Loaded Deployment certificates from C:\Users\Rich\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
    security: Loading certificates from Deployment session certificate store
    security: Loaded certificates from Deployment session certificate store
    security: Validate the certificate chain using CertPath API
    security: Obtain certificate collection in Root CA certificate store
    security: Obtain certificate collection in Root CA certificate store
    security: Start to check whether root CA is replaced
    security: The root CA has been replaced
    security: No timestamping info available
    security: Found jurisdiction list file
    security: Start checking trusted extension for this certificate
    security: Start comparing to jurisdiction list with this certificate
    security: The CRL support is disabled
    security: The OCSP support is disabled
    security: This OCSP End Entity validation is disabled
    security: Checking if certificate is in Deployment denied certificate store
    security: Checking if certificate is in Deployment permanent certificate store
    security: Checking if certificate is in Deployment session certificate store
    java.lang.NullPointerException
         at com.sun.deploy.ui.UIFactory.showSecurityDialog(Unknown Source)
         at com.sun.deploy.security.TrustDeciderDialog.showDialog(Unknown Source)
         at com.sun.deploy.security.X509Util.showSecurityDialog(Unknown Source)
         at com.sun.deploy.security.TrustDecider.isAllPermissionGranted(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.isTrustedByTrustDecider(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.getTrustedCodeSources(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler$ParentCallback.strategy(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler$ParentCallback.openClassPathElement(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$700(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    security: User has denied the priviledges to the code
    security: Adding certificate in Deployment denied certificate store
    security: Added certificate in Deployment denied certificate store
    security: Loading certificates from Deployment session certificate store
    security: Loaded certificates from Deployment session certificate store
    security: Validate the certificate chain using CertPath API
    security: Obtain certificate collection in Root CA certificate store
    security: Obtain certificate collection in Root CA certificate store
    security: Start to check whether root CA is replaced
    security: The root CA has been replaced
    security: No timestamping info available
    security: Found jurisdiction list file
    security: Start checking trusted extension for this certificate
    security: Start comparing to jurisdiction list with this certificate
    security: The CRL support is disabled
    security: The OCSP support is disabled
    security: This OCSP End Entity validation is disabled
    security: Checking if certificate is in Deployment denied certificate store
    security: Checking if certificate is in Deployment denied certificate store

    Rats, now that I look at the stack trace and compare to what's in the JDK srce.zip, it appears that most of this code is not part of the JDK source. I don't see any com/sun/deploy, etc.

  • How to get Java 64-bit?

    In Java Preferences, I only see Java SE 6 32-bit. How do I get the 64-bit installed.

    You're right, of course.
    So, here's my situation. I've installed a network backup client (Connected for Macintosh) and I get a Java error when I try to run it. Their tech support said first that it didn't work because I only had the 32-bit component of J2SE 6. So I went to another Snow Leopard machine, fresh out of the box, that had both 32-bit and 64-bit components of J2SE 6. Still didn't work. Now they're saying it's because version 6 is not supported by their client, and I need J2SE 5.
    I tried installing various of the downloads available on the Apple servers, and all except the J2SE 6 versions said they couldn't install on Snow Leopard.
    So my question has now become: is there a way to install J2SE 5 in Snow Leopard?
    The problem app is Iron Mountain's Connected Backup.

  • How to get the variable value in description if I am writing a condition

    I have created a query for TOP N Customers and
    and for N  I am passing as a varaible
    & I want the same value to be displayed in the description
    I tried a lot but I dont  know how to do it
    can any one tell me the solution for this
    Thx & regards

    Hi,
    You have to define a Text Variable of type customer exit and pass the value of the Variable you have created for the condition in the Exit Code.
    You have to use the correct I_Step = *.
    Cheers.
    Ranga.

Maybe you are looking for

  • My iPod is not being recognized on my computer/iTunes

    Everything was fine until I synced my iPod, took it out, and then later, it got stuck in transition from playlist to "now playing". I plugged it in, and everything stopped working. Any help?

  • Access Denied Bug Opening PDFs from the DFS in Reader X

    Hi, Do you have any timelines for when a bugfix will be released for the Access Denied problems when opening PDFs from a DFS share with Protected Mode enabled? We were hoping to make use of the new sandboxing technology within the corporate environme

  • Function calling & Caching problem..

    hello all.. i hav made scenario of RFC as sender..and when i call the function module for the first time it gets executed and then from second time it doesnt and goes into short dump.. also even when the function gets called the message is not displa

  • Logic Express 7.2 Rewire Problem

    I have only had this problem since getting 7.2. Whenever I set a channel up to Rewire, I can only hear the sound from the channel while the song is playing. Used to, I could play my keyboard and hear sounds from Reason while in Logic. I don't know wh

  • Touch screen stopped working with Safari.  Works fine with everything else.

    So, all of a sudden this morning my Touch will not work in Safari. I can go to web pages via the bookmark button but cannot highlight or type in any links. Doesn't recognize my incredibly gentle touch:) Anyone else with this problem? Cheers mrjazz