0

我需要将选择选项的值发送到另一个页面进行处理,但无法捕获该值。有任何想法吗?选择是从数据库中加载的,该部分有效,显示产品类别。

<%@page import="com.sun.xml.internal.txw2.Document"%>
<%@page import="java.util.ArrayList"%>


<%@ page import = "com.seminario.beans.categoria" %>
<%@ page import = "com.seminario.datos.DbCategoria" %>
<%@ page import = "com.seminario.beans.Producto" %>
<%@ page import = "com.seminario.datos.DbProducto" %>

<jsp:useBean id="dataProd" class="com.seminario.datos.DbProducto" scope="page"/>
<jsp:setProperty name="dataProd" property="*"/>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <link href="../stylo.css" rel="stylesheet" type="text/css" media="screen" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Alta Producto</title>

    </head> 

    <%

    categoria c = new categoria();
    DbCategoria bdc = new DbCategoria();
    ArrayList <categoria> myList = new ArrayList();
    myList = bdc.SelectAll();

    %>   
    <body>        
        <h1>Nuevo Producto</h1>
        <form name ='formulario' action='nuevoProducto.jsp' method='post' >
        Descripcion<input name='descripcion' type='text' size='20' required><br>
        Precio<input name='precio' type='text' size='20' required><br>
        Stock<input name='stock' type='text' size='20' required><br>

  **Categoria <select name="categoid" id="categoid">
        <% for(int i=0;i<myList.size();i++){%>
        <option value="<%= myList.get(i).getId() %>"  > <%out.print(myList.get(i).getDescripcion());%></option>
        <%}%>
        </select><br>** 


        Imagen<input name="imagen"  text="seleccionar archivo" type="file" size="10" accept="image/jpg" /><br>



         <input type ="submit"  value ='Guardar' />
         <!--  <input type="submit" value="guardar">-->
                </form>

        <br><br><a  href='menuAdmin.jsp'>Volver al menu principal</a>
    </body>
</html>
4

0 回答 0