在tomcat服务的配置文件context.xml文件中加入如下代码 <Context> <Context> <Environment name="hao" va
在tomcat服务的配置文件context.xml文件中加入如下代码<Context><Context><Context><Environmentname="hao"va...
在tomcat服务的配置文件context.xml文件中加入如下代码 <Context> <Context>
<Context>
<Environment name="hao" value="hello hao" type="java.lang.String" />
</Context>
在jsp页面上写
<%
Context context = new InitialContext();
String ooString = (String)context.lookup("java:comp/env/tjndi");
out.println(ooString);
%>
会报一个 这样的错误
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.naming.NameNotFoundException: Name tjndi is not bound in this Context
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 展开
<Context>
<Environment name="hao" value="hello hao" type="java.lang.String" />
</Context>
在jsp页面上写
<%
Context context = new InitialContext();
String ooString = (String)context.lookup("java:comp/env/tjndi");
out.println(ooString);
%>
会报一个 这样的错误
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.naming.NameNotFoundException: Name tjndi is not bound in this Context
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 展开
2013-12-30
展开全部
String ooString = (String)context.lookup("java:comp/env/tjndi");
修改为:
String ooString = (String)context.lookup("java:comp/env/hao");
修改为:
String ooString = (String)context.lookup("java:comp/env/hao");
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询