File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Dynamic Variable Declaration or get values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Dynamic Variable Declaration or get values" Watch "Dynamic Variable Declaration or get values" New topic

Dynamic Variable Declaration or get values

Sankar Nadar

Joined: Sep 15, 2012
Posts: 3

I am New for JSP. I tried some code but it not works.. can you please help me or atleast confirm is that possible or not.

Hope most of them understood my problem.
Actually the issue is i want to get the value "Oldopprice1(10)" instead of "Oldopprice1"..
Is that possible or is there any other way to get that.
Thanks In Advance.


"Dont Knock d DOOR. Jus Brk IT.."
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

If you are new to JSP you should be made aware that putting Java code into a JSP is an obsolete and discredited practice since 2002 when JSP 2 was introduced. You should be using the JSTL and EL in your pages, not Java scriptlets.

I also recommend that newcomers to JSP read the following articles:
  • The Secret Life of JSPs
  • The Front Man

  • And to answer your question: no you cannot reference scripting variables by creating their names at run-time. This is possible, however, using the more modern EL with scoped variables.

    [Asking smart questions] [About Bear] [Books by Bear]
    I agree. Here's the link:
    subject: Dynamic Variable Declaration or get values
    jQuery in Action, 3rd edition