易截截图软件、单文件、免安装、纯绿色、仅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 ......

js在jsp中不能调用问题。

我的程序如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv=&q ......

关于jsp 引入后页面跳转的问题 - Java / Java EE

问题是这样的:
   
我有一个文件nagiv.jsp 另一个文件failure.jsp包含他,同时nagiv文件中有一个可以跳转到yy.jsp的commandButton,但是我将failure中点击nagiv中的哪个commandButton,也面不会跳转 ......

jsp编码问题 - Java / Java EE

HTML code:

<%@ page language="java" import="java.util.*,com.test.model.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePa ......

在JSP页面中怎么获得Struts2在action中配置的request

在jsp页面中怎么获得Struts2在action中配置的request。
我在后台的配置如下:
List list = new ArrayList(); 
list.add(users);
ActionContext ct= ActionContext.getContext();
HttpServletRequest requ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号