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

Reply via email to