所以基本上我想弄清楚是否可以将 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=""/>
最佳答案
所以我设法解决了这个问题。经过反复试验,我发现我可以将脚本注入(inject)到如下所示的值中。
<jsp:setProperty name="myBean" property="type" value="<%= type %>"/>
关于java - JSP:setProperty 将值设置为变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61501235/