-1

create_PaperAction.java

package Actions;

import Beans.create_paperBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class create_paperAction extends org.apache.struts.action.Action {

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        create_paperBean val = (create_paperBean)form;        
        String result = val.createDB();
        request.setAttribute("table_name", val.getTable_name());
        return mapping.findForward(result);
    }
}

我正在使用 struts,这是页面被转发到 createQues.jsp 我想要做的是将 setAttribute 的值放入 createQues.jsp 上的输入文本框中。我怎么做?

4

1 回答 1

2

您可以像使用表达式语言一样获得它。

  <input type="text" name="someX" value="${requestScope.table_name}">

其他方面也一样scriplets(不推荐)

<%= (String) request.getAttribute ("Error_Message") %>
于 2013-08-03T11:49:49.553 回答