首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

(急)EL表达式如何取动态作用域变量

2012-10-31 
(急~~~!)EL表达式怎么取动态作用域变量package com.strutsimport org.apache.struts.action.ActionMappin

(急~~~!)EL表达式怎么取动态作用域变量

package com.struts;import org.apache.struts.action.ActionMapping;import org.apache.struts.action.ActionForm;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.ActionForward;import org.apache.struts.action.Action;import java.util.*;import com.dao.*;import com.bean.*;public class detailsAction extends Action {    public ActionForward execute(ActionMapping mapping, ActionForm form,                                 HttpServletRequest request,                                 HttpServletResponse response) {        detailsForm detailsForm = (detailsForm) form;        String type = request.getParameter("type");//执行类型        String id = request.getParameter("infoid");//取得的参数变化        String typediv = "";//根据这个值确定一个页面显示的内容        if (type.equals("indexnotice")) {//显示所点击的公告信息            //调用方法返回结果List            List notPGroups = DAO_ParentGroups.doSelectParentGroups                              (" and Pg_Topic=(select Ct_Id from Topic  where Ct_Name='产品中心')");            List notInfo = DAO_DetailsInfo.doSelectDetailsInfo(" and di_Id=" + id);//显示点击的产品详细信息            for (int i=0; i<notPGroups.size(); i++){                int j = i + 1;                Vo_ParentGroups pgroups = (Vo_ParentGroups)notPGroups.get(i);//类型转换为一个数据Bean类                int diId = pgroups.getPgId();//取得Bean的一个编号                List subGroups = DAO_Groups.doSelectGroups(" and Cg_Parent=" + diId);//根据Id查找                request.setAttribute("subgroups"+j,subGroups);//动态的设置作用域            }            request.setAttribute("notgroupslist",notPGroups);            request.setAttribute("notinfo",notInfo);            typediv = "indextopic";        }        if (type.equals("indexsovle")) {//显示所点击的解决方案            typediv = "indexsovle";        }        if (type.equals("indexnews")) {//显示所点击的新闻信息            typediv = "indexnews";        }        if (type.equals("indexproduct")) {//显示所点击的产品信息            typediv = "indexproduct";        }        if (type.equals("indexsuccase")) {//显示所点击的成功案例            typediv = "indexsuccase";        }        request.setAttribute("typediv",typediv);        return mapping.findForward("topic");    }}



<%@ page contentType="text/html; charset=GB2312" %><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><table>  <tr>    <td width='205' height="500" valign="top" background="image/index_bg.jpg">      <P style="MARGIN-TOP: -5px; MARGIN-BOTTOM: 6px; WORD-SPACING: 0px; LINE-HEIGHT: 150%" align=center>&nbsp;</P>      <div id="PARENT">        <ul id="nav">          <c:choose>            <c:when test="${requestScope.notgroupslist!=null}">            <c:forEach var="parentgroups" items="${requestScope.notgroupslist}" varStatus="gnum">              <li>                <a href="#"  onclick="DoMenu('ChildMenu1')">                  <font items="${requestScope.subgroups[gnum.count]}">                    <li>                      <a href="#" target="_blank">                        <font align=center>&nbsp;</P>    </td>  </tr></table>


请教各位大侠~!在JSP中怎么取得在action中动态设置的request作用域变量~!急啊~!

热点排行