Have you tried changing the bean's scope to request? That's where the
parameters being passed via http live.
Scott Evans
SI&I Training Development
46833 (Ramat Gan)
> -----Original Message-----
> From: Nwalal Mi Nyom Martin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 16, 2000 7:31 PM
> To: [EMAIL PROTECTED]
> Subject: How to pass parameter from html file to Bean with JSP
>
>
> I am new in JSP, I havve a probleme to pass values from
> login.html(below) to loginBean (below) by using JSP file.
>
> please help i was already passed a lot of times without succes.
>
>
> > login.htm
> >
> --------------------------------------------------------------------==
> > <html>
> > <body bgcolor="white">
> >
> > <br>
> > <form method="get" action= "checkLogin.jsp" >
> > <center>
> > <br> Username:<input type="text" name="username" size="25">
> >
> > <br> Password:<input type="text" name="password" size="25">
> >
> > <br> <input type="submit" Value="OK" size="10">
> > </center>
> > </form>
> > </body></html>
> > ----------------------------------------------------------------
> >
> >
> > checkLogin.jsp
> > -------------
> > <%@ page import="projet_pack1.*;" errorPage="errorpge.jsp" %>
> > <jsp:useBean id="loginBean" scope="page"
> > class="projet_pack1.loginBean"/>
> > <jsp:setProperty name="loginBean" property="*" />
> >
> >
> > <%
> > String display="login.html";
> > User user=loginBean.authentification();
> > if(user!=null){
> >
> > display="browser.jsp";
> >
> > }
> >
> > %>
> > <jsp:forward page="<%=display%>" />
> > ----------------------------------------------------------
> >
> > loginBean.java
> > --------------
> >
> > package projet_pack1;
> >
> > public class loginBean{
> >
> > private String username;
> > private String password;
> >
> > public void setUsername(String username){
> > this.username=username;
> > }
> >
> > public void setPassword(String password){
> > this.password=password;
> > }
> >
> > public String getUsername(){
> > return username;
> > }
> >
> > public String getPassword(){
> > return password;
> > }
> >
> > public User authentification(){
> > if (username.equals("projet")&&password.equals
> > ("jsp"))
> > return new User("projet");
> > else
> > return null;
> >
> > }
> > }
> >
> > -----------
> >
> > User.java
> >
> > package projet_pack1;
> >
> > public class User{
> >
> > private String userId;
> >
> > public User(String userId){
> > this.userId=userId;
> > }
> >
> > public String getUser(){
> > return userId;
> > }
> >
> > public String toString(){
> > return userId;
> > }
> > }
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts 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
===========================================================================
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