• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

JavaBean Component in jsp running in Weblogic Server

Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dear all,
so far i have covered Database , EJB access in servelet.in this thread i am going to give you example for JavaBean used in jsp page running under weblogic server.


JavaBean Class code(jspBeanTest.java)
package example;
import java.io.Serializable;
public class jspBeanTest
implements Serializable{
private String size = "Medium";
public void setSize(String size){
this.size = size;
}//end setSize()
public String getSize(){
return size;
}//end getSize()
public String exposedMethod(){
return "The size is " + size;
}//end exposedMethod()
}//end class jspBeanTest

JSP page code(size.jsp)
<P> Create or locate an instance of the<BR>
bean named:<BR><BR>
class="example.jspBeanTest" />
<P>Display default size property of the <BR>
bean using the getter mehod.<BR><BR>
<%= theBean.getSize() %>
<P>Set the size property of the bean to<BR>
Large using the setter method.<BR><BR>
<% theBean.setSize("Large"); %>
<P>Get and display the size property<BR>
again using the getter method.<BR><BR>
<%= theBean.getSize() %>
<P>Invoke an exposed method on the bean.
<%= theBean.exposedMethod() %>
<P>Have a good day.

1. create Directory structure like this :
App root -
2.put your compile class file of JavaBean in example directory.
3.put your jsp file in root directory.as jsp does not required entry in deployment desc. your work is over.

run the server and type in address bar :
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What a daily treat!!!
I'm thinking about a new battle cry. Maybe "Not in the face! Not in the face!" Any thoughts tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic