Я пытался понять это сам, но не повезло, поэтому я здесь, чтобы попросить о помощи.
Попытка передать параметр модальному, который находится на той же странице.
Вот код:
......
<!-- Table -->
<table class="table table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td><%=resultSet.getString("Id") %></td>
<td><%=resultSet.getString("name") %></td>
<td><%=resultSet.getString("description")%></td>
<td>
<div>
<a href='' data-target='#updateProduct?u=<%=resultSet.getString("product_code")%>' data-toggle="modal">Update</a>
</div>
</td>
</tr>
</tbody>
</table>
<!-- Table end -->
<!-- Update Modal -->
<%
try{
connection = DriverManager.getConnection(connectionUrl+database, userid, password);
statement=connection.createStatement();
String u = request.getParameter("u");
int productNumber = Integer.parseInt(u);
String searchVal = request.getParameter("searchCostume");
String sql = "Select * from product where product_code = '"+productNumber+"' ";
//String sql ="Select * from product where admin_id = '"+session.getAttribute( "adminID" )+"'"; ;
//String sql ="Select * from post JOIN customer USING(FirstName) where FirstName="+session.getAttribute( "Name" );
int i=0;
resultSet = statement.executeQuery(sql);
while(resultSet.next()){
%>
<div class="modal fade" id="updateProduct" tabindex="-1" role="dialog" aria-labelledby="Modal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Update Costume</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body"><form action="insertRegistration.jsp" method="post">
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<label for="inputEmail">Id</label>
<div class="form-label-group">
<input value='<%=resultSet.getString("id")%>' type="text" name="prodCode" class="form-control" autofocus="autofocus" readonly>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<label for="inputPassword">Name</label>
<div class="form-label-group">
<input value='<%=resultSet.getString("id")%>' autocomplete='off' type="password" name="prodName" class="form-control" required="required">
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<label for="firstName">Description</label>
<div class="form-label-group">
<input value='<%=resultSet.getString("description")%>' maxlength="20" autocomplete='off' type="text" name="firstName" class="form-control" required="required">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<%
i++;
}
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
%>
<!-- Modal end -->
Я пытаюсь передать параметр обычным способом, когда вы передаете параметр в ссылке (test.jsp?=u=<%request.getParameter("test"))
, но он не работает
любая помощь приветствуется
Заранее спасибо.