how should I use bean with Jsp & Servlets in an web-application?

Discussion in 'Java' started by sujay.jana@gmail.com, Jun 20, 2005.

  1. Guest

    how should I use bean with Jsp & Servlets in an web-application?
    plz let me know immediately.
     
    , Jun 20, 2005
    #1
    1. Advertising

  2. Andrew Thompson, Jun 20, 2005
    #2
    1. Advertising

  3. RC Guest

    wrote:
    > how should I use bean with Jsp & Servlets in an web-application?


    Assume you are use Tomcat server.

    1. Create a directory under

    $TOMCAT_HOME/webapps/your_project/WEB-INF/classes/your_bean
    cd $TOMCAT_HOME/webapps/your_project/WEB-INF/classes/your_bean

    vi YourBean.java
    javac YourBean.java

    2.
    cd ..

    vi YourServlet.java
    insert a line

    import your_bean.YourBean;

    javac YourServlet.java

    3.

    cd ..
    vi web.xml

    insert lines

    <servlet>
    <servlet-name>YourServlet</servlet-name>
    <servlet-class>YourServlet</servlet-class>
    </servlet>
    ....
    <servlet-mapping>
    <servlet-name>YourServlet</servlet-name>
    <url-pattern>/servlet/YourServlet</url-pattern>
    </servlet-mapping>

    4
    cd ../jsp

    vi yourJSP.jsp

    insert a line

    <jsp:useBean id="yourJSP_ID" class="your_bean.YourBean" scope="page" />

    5.
    The URLs will be

    http://your.host.domain:8080/your_project/servlet/YourServlet

    http://your.host.domain:8080/your_project/jsp/yourJSP.jsp

    Your can omitt :8080 if you know how to config Apache httpd.conf

    > plz let me know immediately.


    Who do you think you are???!!!!!
    Please learn the polite way.
     
    RC, Jun 21, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Benjamin Stewart

    To bean or not to bean...

    Benjamin Stewart, Jun 30, 2003, in forum: Java
    Replies:
    0
    Views:
    829
    Benjamin Stewart
    Jun 30, 2003
  2. David Thielen
    Replies:
    2
    Views:
    835
    Marek Lange
    Sep 12, 2003
  3. Markku Salminen
    Replies:
    3
    Views:
    5,891
    Michael Borgwardt
    Jan 21, 2004
  4. kumar
    Replies:
    1
    Views:
    577
    Wendy S
    Feb 13, 2004
  5. Ramon
    Replies:
    1
    Views:
    317
    Arne Vajhøj
    Jan 4, 2009
Loading...

Share This Page