Hi there:

I am the beginner of JSP, I am learning to use POST to
forward the items to another  jsp page. But I never
succeeded and really feel frustrated.

Any one can help me or email me the whole thing which
include all files(*.jsp, *.html, *.java etc.) so I can
execute it and learn it?



Here I wrote a simplest testing *.html, *. jsp and
*.java files. Hope I can get detailed help.

How I write the *.jsp page so when some body click the
button, The item name will forward to another
jsp pages. For another jsp should the "id","scope",
"property" etc. be same as initial one?



( name: cart.html)
*************************************************
<html>
<head>
<title>carts</title>
</head> <body bgcolor="white">
<font size = 5 color="#CC0000">
<form type=POST action=carts.jsp>
<br>Number:
<SELECT NAME="item">
<OPTION>10
<OPTION>20
</SELECT>
<br> <br>
<INPUT TYPE=submit name="submit" value="Click">
</form>
</FONT>
</body>
</html>
****************************************************

My simple java ( Would you pls complete or correct it
for me?)
(name: DummyCart.java)

***************************************************
package sessions;

import javax.servlet.http.*;
import java.util.Vector;
import java.util.Enumeration;

public class DummyCart {
    Vector v = new Vector();
    String submit = null;
    String item = null;


    public void setItem(String name) {
        item = name;
    }

    public void setSubmit(String s) {
        submit = s;
    }

    public String[] getItems() {
        String[] s = new String[v.size()];
        v.copyInto(s);
        return s;
    }

  public String getSubmit() {
        String s = new String[v.size()];
        v.copyInto(s);
        return s;
......... etc.
}
******************************************

My jsp page like that( would you pls complete or
crrect it for me?)

(name:carts.jsp)

*********************************************
<html>
<%@ page import= "sessions.DummyCart" %>
<jsp:useBean id="cart" scope="session"
class="sessions.DummyCart" />
<jsp:setProperty name="cart" property="item" />
<%@ include file="carts.html" %>

.......etc.
<jsp:forward page="getCarts.jsp"/>
.......etc.
</html>
******************************************

Thanks a lot for your help.

Smart.


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to