(See code below)
Why won't this url initialization work in the declarative section of a jsp?
Why can't we access the request object w/in this section?
If the url initialization is placed out this section, f(x)s declared w/in this section cannot access them.
Thanks for your help.
<%!
String url = request.getServerName() + request.getServerPort();
// Declaring a Java class
public Context getInitialContext() throws Exception {
...
}
%>
-
JSP and declarative section ( (1 messages)
- Posted by: Chris Wall
- Posted on: August 23 2001 18:37 EDT
Threaded Messages (1)
- JSP and declarative section ( by Praveen Balakrishnan on August 24 2001 15:25 EDT
-
JSP and declarative section ([ Go to top ]
- Posted by: Praveen Balakrishnan
- Posted on: August 24 2001 15:25 EDT
- in response to Chris Wall
You wont be able to use the request object while declaring member variables.
request, response objects are not member variables and will not be available to method declarations unless passed as parameters..
Probably you can change it as follows...
<%
String url = request.getServerName() + request.getServerPort();
Context ctx = getInitialContext(url);
%>
<%!
// Declaring a Member method
public Context getInitialContext(String url) throws Exception {
...
}
%>