EL and jsp:usebean..type/class

I have two doubts... 1) In the code snippet shown in page 384 of HF, to get the request method, it has been shown like pageContext.request.method which when called using a JSP shows like GET or POST. If i want to get a servlet initialization parameter from config, i used like pageContext.config.ininParam but the code threw error saying.. there is no property as config in tomcat 5.5.9. Where can i see the property like request in pageContext.request.method. I couldn't find that under javax.servlet.http.jsp. How can i get the init parameter for a jsp using config? Is that container implemented?

2) In the bullet points in page 414 of HF, the last but one shows that when jsp:useBean is used along with jsp:setProperty only properties on type can only be set not the property on class. Listed below are the classes

This page shows whatever i enter in the form like name and empID. I should be able to set the name only. Pls. clarify. Thanks. SAM [ November 06, 2005: Message edited by: Kuppusamy Venkatasubramanian ]

1. There is no map or bean object available for "servlet init" params. You need to pass init param name ("string" argument) to get init param value, but there is no mechanism available to pass argument on EL!

2. I got following servlet code on tomcat 5.5.7 version inside _jspService() method.

From above code, we can understand that there is no existing object of Person available in the request scope, so container assigned a new object of Employee class. While printing properties, casting back to original object (Employee). I think container using introspection mechanism to identify the object type.

JSP's config parameters should be available from the implicit object "config" that is available in JSPs.

So you could call config.getInitParam(string) method to get to the initParam you are looking for.

Umesh Adtani
Greenhorn

Joined: Nov 09, 2005
Posts: 5

posted Nov 09, 2005 22:00:00

0

I just realized you may be looking to access these init parameters using EL.

Well, there is no implicit map available, so you should have to pass those in as attributes or paramters. Basically JSP would need to create a Map of init-param-values from config object and then call it a 'bean'. EL then can use configBean.paramName to get to initParam's value. It is tedious though. I wonder why there is no straightforward way from pageContext to get to initParams.

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com