Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EL expression evaluation  RSS feed

 
Maciek Falski
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks!
I'm invoking my servlet through link = http://localhost:8080/test.do?evalparam=duck.name .
test.do servlet adds an attribute "duck" of class Duck (JavaBean with "name" property) to request scope.
Then I forward a request to test.jsp page.
What I want to do is evaluate parameter evalparam=duck.name to EL expression.
I know that I could do this by spliting evalparam parameter to two parts part1="duck" and part2="name" and then invoke ${requestScope[part1][part2]} but I'd like to do it through some kind of evaluation mechanism, e.g. ${evaluate(evalparam)} to acces property. And I'd like this mechanism be property chain independent.
Do you have any suggestions?
I'm considering creating tag which would evaluate this expression but is there any easier way?
Thanks a lot,
Cheers,
Maciek
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"takaczapka" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy. User names cannot be obviously fake and must constist of a first name and a last name.

You can change your user name here.

Thanks! and welcome to the JavaRanch!
 
Maciek Falski
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! Done. Sory for that.

Could anyone help me with above issue, please?
Maciek
[ November 29, 2005: Message edited by: Maciek Falski ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm considering creating tag which would evaluate this expression but is there any easier way?


If you are using a JSP 2.0 engine you might consider writing an EL function rather than a custom action.

P.S. Why the levels of indirection? It's a rather odd way of doing things that I've never seen before.
 
Maciek Falski
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using a JSP 2.0 engine you might consider writing an EL function rather than a custom action.

Good point. Good advice.

P.S. Why the levels of indirection? It's a rather odd way of doing things that I've never seen before.

I'm not sure I understand corectly. You mean forwarding from servlet to JSP? It's part of MVC model.

BTW evaluating of EL expression could be useful way to dynamicly created content. Well, to be honest, it is was theoretical question, but "there are no dumb questions" .

Thx a lot!
Cheers,
Maciek
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!