File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Using EL in normal java class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Using EL in normal java class." Watch "Using EL in normal java class." New topic
Author

Using EL in normal java class.

Arun Thulaseedharan
Greenhorn

Joined: May 07, 2008
Posts: 20
hi all,
im new to EL.Can anyone tell me how to use EL in normal java page(non jsp/jsf pages).My requirement is like this...we have a class A and it has a property b..i want the value of b and for that i want to use EL expression..

thanks and regards
arun
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

Originally posted by Arun Thulaseedharan:
hi all,
im new to EL.Can anyone tell me how to use EL in normal java page(non jsp/jsf pages).My requirement is like this...we have a class A and it has a property b..i want the value of b and for that i want to use EL expression..


First of all Is this normal class a Servlet???
Second you said b is a property..This means it is a field in that class.
If yes then why do you want to use EL for that???


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

The JSP expression language is implemented as part of the JSP container; it's not (normally) available in Java code. Now, it's possible that, with sufficient knowledge, you could use the JSP container's EL code from normal Java code, but I doubt it; it's almost certainly not written to support that use case.


[Jess in Action][AskingGoodQuestions]
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Yeah, your best bet would be to look into the java.beans.Intorspector API and reflection. By properly understanding the two you could emulate the simplicity of EL using method calls.


Steve
Arun Thulaseedharan
Greenhorn

Joined: May 07, 2008
Posts: 20
thanks a lot guys...actually i used JEXL for the same...guess that will the job for me...

thanks and regards
arun
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using EL in normal java class.