• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Help in JSTL And EL

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
i am new at EL and JSTL

can anyone help me how to Access this attribute
This is JSP
if(request.getAttribute("UPDATE_PASSWORD") != null && request.getAttribute("UPDATE_PASSWORD").equals(true)) {


this is the JAVA static bean
and the code is public static final String UPDATE_PASSWORD ="UPDATE_PASSWORD";
and this is the setAttribute :
request.setAttribute("UPDATE_PASSWORD",true);

please am new in programming help me Please
[ December 18, 2008: Message edited by: Bear Bibeault ]
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Khaled abdo:
Hello
i am new at EL and JSTL

can anyone help me how to Access this attribute
This is JSP
if(request.getAttribute("UPDATE_PASSWORD") != null && request.getAttribute("UPDATE_PASSWORD").equals(true)) {


this is the JAVA static bean
and the code is public static final String UPDATE_PASSWORD ="UPDATE_PASSWORD";
and this is the setAttribute :
request.setAttribute("UPDATE_PASSWORD",true);

please am new in programming help me Please



So to access the request attribute "UPDATE_PASSWORD" from EL you could do:


Note that in this case the .UPDATE_PASSWORD refers to the value "UPDATE_PASSWORD" not the static constant String variable. So for example, if your constant was defined as:

the EL would still be:
and not

You ask about using a static constant as the name of the parameter in EL. This is typically not done, the Key names for values are typically directly used. Though using static constants is possible using Maps and/or Reflection the workarounds get to be a bit of a mess and seem a bit hard to manage when all you really are looking to do is prevent mis-typing.
 
Khaled abdo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Alot.
Do i have to write something in the .tld?
or shall i create one?
 
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There were a number of errors in Steve's post.

Firstly, the syntax to directly address request scope would be:
And secondly, you cannot directly address class constants with the EL. To do so, please see this article.

I also recommend using conventional naming for your scoped variables. Rather than UPDATE_PASSWORD< us updatePassword.
[ December 18, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Khaled abdo:
Do i have to write something in the .tld?
or shall i create one?


No. You don't need to do anything with TLDs.

To enable the EL, be sure that your web app is properly declared as outline in the JSP FAQs.

To use the JSTL, simply drop the jar files in WEB-INF/lib. This is also covered in the JSP FAQs. Be sure to use the correct version of the JSTL for the version of JSP that you are using.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic