在struts中使用${},但是myeclipse中显示有错误:<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>
    <constant name="struts.devMode" value="true" />
    <package name="user" namespace="/user" extends="struts-default">
    
    <action name="user" class="com.wyz.UserAction">
     <result type="redirect">/user.jsp?t=${type}</result>//错误在此行,加上$就显示错误!
    </action>     
    </package>
    
</struts>

解决方案 »

  1.   

    EL表达式,只能用在JSP中,不能用在配置文件里面如果你要传递参数,可以用request.setAttribute()
      

  2.   

    不好意思说错鸟
    跳转的地址如果有参数的话,可以用${yourParameter}表示参数,不过这个type要是你的class里面的一个字段,要有get,set方法的。所以检查下是不是你的类没有该get方法?
      

  3.   

    我的UserAction文件中有get,set方法!
    代码:
    package com.wyz;import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport {
    private int type;

    public int getType() {
    return type;
    } public void setType(int type) {
    this.type = type;
    } public String execute() throws Exception {
    return "success";
    }}
      

  4.   

    另外就是:MyEclipse时有误报,所以可以实际运行起来去测试下。
      

  5.   

    吓尿了,楼主可以试试保存后点project-->clean-->选中你当前项目