簡體   English   中英

單選按鈕支柱1.3

[英]Radio Button Struts 1.3

我想創建一個單選按鈕以選擇在jsp頁面上顯示的值。 如何使用單選按鈕從此JSP頁面中選擇值?

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%! int i=0; %>

<h1 align="center">DOCUMENT INFORMATION CENTER</h1> 
<table border="12" align="center">

<tr><td>Employee ID</td><td>Document ID</td><td>Topic</td><td>Text</td><td>Files</td></tr>
<% int j=(Integer)session.getAttribute("i");
HttpSession session2=request.getSession();
for(i=0;i<j;i++)
{ out.println("<tr><td>"+session.getAttribute("eid"+i)+"</td><td>"+session2.getAttribute("id"+i)+"</td><td>"+session2.getAttribute("topic"+i)+"</td><td>"+session2.getAttribute("text"+i)+"</td><td>"+session2.getAttribute("files"+i)+"</td></tr>");
}

%>
</table>
</body>
</html>

您可以為此目的使用struts邏輯標記。 如果存在會話邏輯,則將特定單選按鈕的值設置為true。 出於迭代目的,您還可以使用邏輯:iterate標簽。 遵循以下代碼段可能會對您有所幫助。

<logic:present name="i" scope="session">
<logic:equal value="1" name="i" scope="session">
    <script>
        $('input[name=some_name][value=1]').prop("checked",true);
    </script>
</logic:equal>
</logic:present>

讓我知道這是否有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM