易截截图软件、单文件、免安装、纯绿色、仅160KB

JSP自定义标签调用spring注入的bean

JSP自定义标签中如何才能调用spring注入的JavaBean?

按照http://topic.csdn.net/u/20080716/11/92f124e3-b51d-4610-9cfe-744317726604.html的方法做了
但是要报异常java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?

求达人解惑

代码:
public class CreateTree extends org.springframework.web.servlet.tags.RequestContextAwareTag {
        /**
* 树菜单数据访问对象
*/
private PopedomBiz popedomBiz;
        public void setPopedomBiz(PopedomBiz popedomBiz) {
this.popedomBiz = popedomBiz;
}
/**
* 输出流
*/
private JspWriter out;

@Override
protected int doStartTagInternal() throws Exception {
popedomBiz = (PopedomBiz)this.getRequestContext().getWebApplicationContext().getBean("PopedomBiz");
out = pageContext.getOut();
pageContext.getResponse().setCharacterEncoding("utf-8");
try {
out.print(getJSFunction());//写入数据
out.print(getTreeData());//写入JS文件
out.flush();//压出数据
} catch (IOException e) {
throw new JspException(e.getMessage());
}
return SKIP_BODY;
}
}
这种方式也不行:
ApplicationContext ac = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletCon


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

Unable to compile class for JSP - Java / Web 开发

<%@page language="java" contentType="text/html;charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="db" class="wang.connectDB"/>
< ......

jsp页面中字体变色问题 - Java / Web 开发

<html><head><title>[@title]</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<script language='javascript'>
function diyCheck ......

关于AJAX和JSP的一些小问题~ - Java / Web 开发

我JSP的页面是:
<%@ page language="java" contentType="text/html; charset=gb2312"
  %>
<script>
function Save(){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==nul ......

jsp页面如何保存成html格式 - Java / Web 开发

我在jsp页面查询到数据库中的一笔数据,并以table循环的形式显示,但需要下载保存成html格式,请问应该处理?代码有没有特殊要求?是不是需要特别的jar包?
你这是把报表保存为HTML格式,不知有什么用处,
要是 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号