Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > how should I use bean with Jsp & Servlets in an web-application?

Reply
Thread Tools

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

 
 
sujay.jana@gmail.com
Guest
Posts: n/a
 
      06-20-2005
how should I use bean with Jsp & Servlets in an web-application?
plz let me know immediately.

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      06-20-2005
On 20 Jun 2005 05:01:52 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
....
> plz let me know immediately.


Please pay me lots of money.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
 
 
 
RC
Guest
Posts: n/a
 
      06-21-2005
(E-Mail Removed) 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_pr...et/YourServlet

http://your.host.domain:8080/your_pr...sp/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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP/Servlets: Where should the password be stored? Ramon Java 1 01-04-2009 01:58 PM
Java servlets: Hi All! I want to display xml file in browser using servlets datta.saru Software 0 05-15-2006 03:30 PM
How to re-use existing classes in JSP/JavaBeans/Servlets thecrow Java 24 05-27-2005 11:17 PM
useBean in JSP for bean within a bean kumar Java 1 02-13-2004 09:33 PM
To bean or not to bean... Benjamin Stewart Java 0 06-30-2003 12:34 AM



Advertisments