• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't get familiar with Expression Language

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear forum users,
I wish to understand why the expression <c:if test="${!empty taskVersion}"> in the following code returns always true



thanks for any suggestion!
 
Sheriff
Posts: 67746
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
Not enough info. What is taskVersion and how is it created?

Also, mixing the EL with scriptlets is a recipe for disaster. The JSTL and EL are meant to replace scriptlets and Java code in a JSP -- they are specifically designed not to work together.
 
Renato Bobbio Calogero
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply . I'll try to explain myself better. I am trying to include a jsp in another one, and I wish to use the <jsp:useBean> tag in to let my first jsp pass a PcTask object , which details should be details in my "son" jsp.

How should I do that ? I think I should put that object in the session scope with something like :



And I supposed that, to retrieve my object in my "son" jsp , included in my first one , the following


and then I should be able to access to the attributes of my PcTask object ( for which I already defined accessors -getters and setters- for the fields I'm trying to retrieve )



which taskType is one of the PcTask's field , which got a getTaskType() method.

Am I doing this wrong ?

Thanks a lot for any hint !
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"tasktype" is not an attribute declared in scope. It is a property of a bean declared in scope.
Just because you have got a "useBean" tag on your page, doesn't make that bean anything special.

try: value="${task.taskType}"
 
Renato Bobbio Calogero
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much for your answer. It was clearifying. I have to deal with inherited code, so I can't go too much off path, even if I know there are many ways to do this better.

Just to be clear, as you said my attribute is not in scope,

but if I define



and the in my jsp



I should see my variable ...

then I did this, because I tried as you said but it did not worked just like that ... so I did



maybe it's not smart... but it is working fine...
thank you so much again, You gave me the correct hint...
 
It was the best of times. It was the worst of times. It was a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic