Ok i'm writing some code that will hopefully go on a jsp page but I need some help getting it there. I first of all am stuck on part of it where I put it the information into the array to then generate the form. Then obviously how do I put this java code into a jsp page.

here:s the code:
Java Code:
<%
    StringBuffer info = new StringBuffer(request.getParameter("productInput"));
    int break1 = (new String(info)).indexOf('\n');
    int break2 = (new String(info)).indexOf(",");
    int i = 0;
    while (break1 > 0) {
        break1 = (new String(info)).indexOf('\n');
    }
    while (break2 > 0) {
        break2 = (new String(info)).indexOf(",");
    }


    String values[];

    //Not sure what to do here 


%>

<form action="index.jsp?path=quickpadsummary" name="quickform" method="POST" onload="myfunc();" onSubmit="loading(); return true;">
    <%
        int k = 0;
        int j = 0;
        int l = 1;
        while (k <= values.length) {
            out.print("<input type=\"hidden\" name=\"prod" + k + "\" value=\"" + values[j] + "\">");
        }
        out.print("<input type=\"hidden\" name=\"price" + k + "\" value=\"" + values[l] + "\">");
    %>


</form>

<!-- java script to submit the form as soon as it loads. -->
<script type="text/javascript">
    function myfunc () {
        var frm = document.getElementById("quickform");
        frm.submit();
    };
    window.onload = myfunc;;
</script>
any help or pointing in the right direction would be much appreciated.