cancel
Showing results for 
Search instead for 
Did you mean: 

How to access environment entries in SURF?

sujaypillai
Confirmed Champ
Confirmed Champ
I have an entry in web.xml as

<env-entry>
<description>welcome message</description>
<env-entry-name>message</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>Welcome to My Site</env-entry-value>
</env-entry>

and i access this in my .jsp page as -

<%
        javax.naming.Context context = new javax.naming.InitialContext();
        javax.naming.Context msg = (javax.naming.Context)context.lookup("java:comp/env");
        java.lang.String mesg = (java.lang.Boolean)msg.lookup("message");
        out.println("The message is : "+  mesg);
%>

How can this be done in SURF?
1 REPLY 1

kevinr
Star Contributor
Star Contributor
No not from a WebScript JS backed component. You can do any Java operation in a Java bean backed WebScript component though - so that would work, also you can use JSP components, but they are more limited in other ways.

Kevin