0

所以基本上我正在尝试确定是否可以将 jsp:setProperty 函数中的值设置为在之前的 scriptlet 中声明的字符串变量。

我的代码如下。非常感谢你提前:)

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%
            String type = request.getParameter("type");
        %>
        <title><% out.println(type);%> </title>
    </head>

    <jsp:useBean id="myBean" scope="session" class="org.geeks.Second"/>
    <jsp:setProperty name="myBean" property="type" value=""/>
4

1 回答 1

0

所以我设法解决了它。通过反复试验,我发现我可以将一个 scriptlet 注入到如下所示的值中。

<jsp:setProperty name="myBean" property="type" value="<%= type %>"/>
于 2020-04-30T02:40:04.033 回答