Using Java Bean in JSP to show database record

I have links in my Tomcat container that if someone clicks on a specific link it should go to a Record page (Show.jsp) with all the values associated with a record from a database.
For example if someone clicks on a specific link like this:
LinkExample
it would take you to a jsp with database info for someone named Jones and show you his info:
Lastname = Jones
Firstname = Mike
City = San Diego
I would like to do this using a Java helper class and bean so I dont have any database connection or Java code in my JSP.
I created Java class file that has Database connection that works with a Java bean. I just dont know how to get the Show.jsp to work with the Java Bean and Java helper class file.
Here is what I have for Show.jsp and this is the part I have been working on the longest but cant get it to work because it doesnt seem to work with the database:<jsp:useBean id="user" class="num.UserDB"/>
//do I call getUser(lastname) here and if so how?
<jsp:setProperty name="user" property="*"/>
Last Name: <jsp:getProperty name="user" property="lastname"/><BR>
First Name: <jsp:getProperty name="user" property="firstname"/><BR>
City: <jsp:getProperty name="user" property="city"/><BR>My Java Helper class that compiles and connects to database:
package num;
import java.io.*;
import java.sql.*;
import java.util.*;
import num.User;
public class UserDB
public User getUser(String lastname)
User user = new User();     
        try          
     Class.forName...//database connection stuff here
    ResultSet results = stmt.executeQuery("SELECT * from user where lastname = '" + lastname + "'");
     if(results.next() == true)
     results.next();
     user.setLastname(results.getString("lastname"));
     user.setFirstname(results.getString("firstname"));
        user.setFirstname(results.getString("city"));
     catch(Exception e)          
               System.out.println("Exception...");               
   return user;
}My Java Bean that compiles here:
package num;
public class User
  private String firstname;
  private String lastname;
private String city;
  public User()
     //no arg constructor
  public User(String firstname, String lastname, String city)
       this.lastname = lastname;
          this.firstname = firstname;
          this.city = city;
  public String getLastname()
          return lastname;
  public void setLastname(String lastname)
     this.lastname = lastname;
  //more bean methods for all fields here
 

Sorry if I wasnt specific enough. I have a link that passes a value (field that is passed is called lastname) to a JSP where I want to show record info for that value that is passed.
My question is how do I show the database record info on Show.jsp for the lastname field value of Jones where I want to use a Java Bean and Database helper class in Show.jsp
Here is the message I get when I hit the link (LinkExample) and it goes to Show.jsp:
org.apache.jasper.JasperException: Cannot find any information on property 'lastname' in a bean of type 'num.UserDB'
.....My UserDB class:
public class UserDB
public User getUser(String lastname)
User user = new User();     
        try          
     Class.forName("org.gjt.mm.mysql.Driver");
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/dbconnone?user=smitherson&password=abcdefg");
    Statement stmt = conn.createStatement();
    ResultSet results = stmt.executeQuery("SELECT * from user where lastname = '" + lastname + "'");
     if(results.next() == true)
     results.next();
     user.setLastname(results.getString("lastname"));
     user.setFirstname(results.getString("firstname"));
                     user.city(results.getString("city"));
     catch(Exception e)          
         System.out.println("Exception..." + e);          
   return user;
}Bean class:
package num;
public class User
  private String firstname;
  private String lastname;
  private String city;
  public User()
     //no arg constructor
  public User(String firstname, String lastname, Sting city)
      this.firstname = firstname;
       this.lastname = lastname;
this.city = city;
  public String getFirstname()
          return firstname;
  public void setFirstname(String firstname)
     this.firstname = firstname;
  public String getLastname()
          return lastname;
  public void setLastname(String lastname)
     this.lastname = lastname;
  public String getCity()
          return city;
  public void setCity(String city)
     this.city = city;
  

Similar Messages

  • Using java bean with jsp

    hello friends,
    i'm new to jsp. i want to create an html form that accepts username and a value from four radio buttons and display back the entered name and checked radio button's value using java bean.
    i use the <jsp:setProperty id="" property="*"> method. i don't know how to access the radio buttons value from the html.
    also when i use an additional field other than username the jsp page is showing error.
    Please give me the correct method to use java bean with jsp in this circumstance.
    thank you.

    thank you, but i have a problem left. the case is like this.
    i got the jsp and bean worked fine when i have a sinle input text field.
    but when i added a second text field i recieved the following error.
    javax.servlet.ServletException: basket.newbean.getUserPass()Ljava/lang/String;
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
         org.apache.jsp.newform.process_jsp._jspService(process_jsp.java:69)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    where userPass is the new form element. I have made the subsequent chanes in my bean program and jsp file.
    pls hlp.

  • Using java beans in jsp using tomcat

    hi i have made a form to enter user first name and last anme with html and then i have made a value javabean in which i want to store the information filled bu user. i want to display the information stored in java bean in jsp page i have made the full application and i have made class file of java bean as well as jsp file but when i try to run this web application in tomcat i am getting class not found exception.
    could anybody tell me that where i should store the bean class in tomcat and do i need to make any package in which i have to place my java bean file plz tell me complete procedure along with code if possible

    whew thats a lot of questions... All of this is pretty basic stuff. I would recommend you take a look at the web services tutorial: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
    lets see.
    Starting a package name with com is just a generic standard which is followed.
    It is most correct when creating commercial packages to create packages like com.companyName.project
    http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
    You should not need a page import directive unless you are using classes in scriptlets: ie <% %> tags in your JSP. Your jsp:useBean tag will automatically import necessary classes - you don't need to import classes for beans specifically
    <jsp:useBean id="myClass" scope="session" class="com.myPackage" />
    Your directory structure should be something like this
    webApplicationRootDirectory
    - page1.html
    - page2.html
    - page3.jsp
    - page4.jsp
    - WEB-INF
         - web.xml
         - classes
           - com
             - myPackage
               - myClass.classerrrm. Thats about it I think.

  • How can i use JAVA BEAN and JSP?

    well, i have developed all my web apps by using pure JSP only, i know this sucks, but i dont know how to start on using beans... what directory should i put them into... etc... what are the good programminmg practices/standards/techniques when incorporating beans in jsp???

    Standards are pretty loose, but generally, Beans hold a lot of the backend logic for your JSP. This can include data validation before entering into the database, database inserts, queries, data manipulation. The JSP should really only contain code that will retrieve the data from the bean and appropriately output it.
    As far as using them, you can use the <jsp:useBean> tag in your JSP. As long as the bean is stored somewhere that your classpath points to, you're all set. From then on, you can use it like any other object in your JSP.

  • Problem in Using Java Bean in JSP

    Hi,
    I have a bean called BankAccount.....I tried to use it in a jsp file called Usebean.jsp like this <jsp:useBean id="BA" class="BankAccount" scope="application" /> I tried in both tomcat and j2ee1.3 server... but when i run the jsp file i get an error saying..... Class.org.apache.jsp.BankAccount not found...... But i have put the class file properly inse classes folder.....
    Can anyone help me soon..... i am new to JSP........
    Thanks,
    Akshatha

    Well u need to have your class in a package
    like mypackage.BankAccount
    and put your class in classes/mypackage
    <jsp:useBean id="BA" class="mypackage.BankAccount" scope="application" />

  • Using java beans in jsp

    Hi, I need to do this, can any one help me.
    In the signup form, i have some text frields like this
    HTML
    <form action=http://localhost:8080/servlet/Signup.jsp">
    <input type=text name=name>
    <input type=text name=phone>
    <input type=submit value="Submit">
    </form>
    JAVASP
    req.getParameter("name");
    req.getParameter("phone");
    i am doing some validation here like if the user name exists in the database i am diverting him to the html page like this
    rs = st.executeUpdate("select * from regi where user="+name+"");
    if(rs.next())
    here i need to call the html page in the from of a bean and with the old values intact to it
    else
    insert into regi values('"+name+"','"+phone+"')
    this is how i am doin my html in the form of a bean
    <%!
    public void beans()
    %>
    <form action=http://localhost:8080/servlet/Signup.jsp">
    <input type=text name=name value=<%=name%>>
    <input type=text name=phone value=<%=phone%>>
    <input type=submit value="Submit">
    </form>
    <%!
    %>
    but this is giving me error, can any one help me please?
    Thanks
    Uma

    Hai Uma,
    I read ur code like this.
    <%!
    public void beans()
    %>
    <form action=http://localhost:8080/servlet/Signup.jsp">
    I think here is the mistake. <%! %> - for declaring variables. But for writting codes we have to use <% %> tags only. Can u try the same program by removing "{" in this tags or remove "!" from tag...
    I hope this may helpful to u to solve ur problem
    With Regards
    Siva

  • Problem in using java bean with jsp

    Hi,
    This is my code and i get this error. Not able to trace the mistake.
    bean.html
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Fname</title>
    </head>
    <body>
    <form method="POST" action="http://localhost:8080/beanjsp.jsp">
         <p>Fname: <input type="text" name="T1" size="20"></p>
         <p>Lname: <input type="text" name="T2" size="20"></p>
         <p> </p>
         <p> </p>
         <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
    </form>
    </body>
    </html>
    beanjsp.jsp
    <jsp:useBean id="bean" class="beans.FirstBean" scope="application" />
    <jsp:setProperty name="bean" property="fname" param="T1" />
    <jsp:setProperty name="bean" property="lname" param="T2" />
    THE FIRST NAME IS <%=bean.getFname() %>
    THE LAST NAME IS <%=bean.getLname() %>
    FirstBean.java
    //CREATING A BEAN
    package beans;
    import java.io.*;
    public class FirstBean
         private String fname;
         private String lname;
         FirstBean()
              fname="";
              lname="";
         public void setFname(String fn)
              fname=fn;
         public void setLname(String ln)
              lname=ln;
         public String getFname()
              return fname;
    public String getLname()
              return lname;
    error report
    org.apache.jasper.JasperException: /beanjsp.jsp(2,0) The value for the useBean class attribute beans.FirstBean is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1223)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3270)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)I have placed the beans package folder containing FirstBean.class inside classes folder of ROOT directory.
    I don't know what s wrong with my code :( ... Plz help asap.
    Thanks,
    Akshatha

    I have placed the beans package folder containing FirstBean.class >inside classes folder of ROOT directory.Place it in the WEB-INF/classes folder
    ram.

  • What's the difference between using java directly in JSP and java bean

    What is the difference if I use java code directly in JSP or use java bean in JSP?
    Which class to use for receiving the passed parameter from html or java script? Any difference for java code and java bean in the way receiving the passed data?
    How can I pass string from jsp to html or java script?

    1 Cleaner pages
    2 you have to write the class and use set and get methods
    3 What do you mean when saying passing string from jsp to html??, do you mean the value you can use <%=variablename%>

  • What is the difference between java direct or java bean in JSP?

    What is the difference if I use java code directly in JSP or use java bean in JSP?
    Which class to use for receiving the passed parameter from html or java script? Any difference for java code and java bean in the way receiving the passed data?
    How can I pass string from jsp to html or java script?

    it's generally accepted as better design to separate presentation from logic. meaning, the java code in the jsp should be used to support displaying data, as oppsoed to implementing the application - like database access, etc.
    when the logic is separated from the presentation, it allows you to reuse logic components within several jsp pages.
    if you decide to change the presentation layer in the future (to support wap, for example) you don't need to rewrite your entire application, since the "guts" of the application is outside of the jsps.
    it is also a good idea to separate your business logic from your data layer. adding a "buffer zone" between these layers helps in the same manner as in separating presentation from logic. if you're using flat files for storage now, upgrading to a database wouldn't require rewriting all your business logic, just the methods which write out the data to a file, for example.
    once you feel comfortable with separating the various layers, check out the struts framework at http://jakarta.apache.org/
    to answer your second question, to get parameters passed in from HTML forms, use ServletRequet's getParameter() method.
    in tomcat:
    <% String lastName = request.getParameter( "lastname" ); %>
    to answer your third question: when displaying the HTML from withing a jsp, print out the string to a javascript variable or a hidden form element:
    <% String firstName = "mike"; %>
    <input type="hidden" name="firstname" value="<%= firstName %>">
    <script language="javascript1.2">
    var firstName = "<%= firstName %>";
    </script>
    this jsp results in the following html:
    <input type="hidden" name="firstname" value="mike">
    <script language="javascript1.2">
    var firstName = "mike";
    </script>

  • Calling Java Bean From JSP

    <%@ page contentType="text/html;charset=windows-1252" errorPage = "error.jsp"%>
    <%@ page import="java.sql.*,java.io.*,javax.sql.*, mypackage1.*"%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>Process</title>
      </head>
      <body>
          <P align="center">
            <STRONG><FONT face="Algerian" size="6" color="#0033cc">Result from the Query</FONT></STRONG>
          </P>
          <P align="center"> </P>
          <P align="center"> </P>
          <P align="center"> </P>
          <P align="center"> </P>
          <P align="center">
       <%
            int rowsChanged;
            Connection con;
            try
              String sql;
              sql = request.getParameter("query");
              System.out.println(sql);
              session=request.getSession(true);
              String name = (String)session.getAttribute("theID");
              String password = (String)session.getAttribute("paswd");
              String driver="oracle.jdbc.OracleDriver";
              Class.forName(driver);
              String url ="jdbc:oracle:thin:@minerva.humber.ca:1521:grok" ;      
              con = DriverManager.getConnection(url,name,password);
              if(sql.substring(0,6).equalsIgnoreCase("Select"))
                  Statement stat = con.createStatement();
                     ResultSet rs = stat.executeQuery(sql);
          %>
         <jsp:useBean id="myBean" scope="page" class="mypackage1.Table" >
               </jsp:useBean>
             <jsp:setProperty name="myBean" property="*" param="<%rs%>"/>
          <%
            myBean.setTable(rs);
            out.println(myBean.getTable());
         %>
          <%
           else
              Statement stat = con.createStatement();
              rowsChanged = stat.executeUpdate(sql);
              out.println("<h3><STRONG><FONT face=Algerian size=5 color=#0033cc>Number of rows affected are: "+rowsChanged+"</h3></Strong></Font>");
           }//End of Try
           catch(Exception e)
              System.out.println(e+ "gd"+ e.getMessage());     
          %>
          </P>
            <P align="center">
            <a href="check.jsp">Please Click Here to Return to Main Page</a>
          </P>
      </body>
    </html>Above is my JSP file, which is calling a Java bean class called Table. The thing is that Its not returning any Table from the Table Class. I dont know how to use Java bean as I m new to it. Following is my Table Class. So If anyone can plz help me then it would be great. I m suffering from 2 days just because of this class and JSP.
    package mypackage1;
    import java.io.Serializable;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    public class Table implements Serializable
      private ResultSet rs;
      public Table()
      public void setTable(ResultSet result)
        rs = result;
      public String getTable()
             String output=null;
             try
                    ResultSetMetaData metadata;
                    metadata=rs.getMetaData();
         // find the number of fields in customer table
                    int col=metadata.getColumnCount();
                    output = "<table/><tr/>";
                    for(int i=1;i<=col;i++)
                        output+="<td/><b/>"+metadata.getColumnName(i)+"</b/></td/>";
                    output += "</tr/>";
                    while (rs.next())
                           output="<tr/>";
                           for(int i=1;i<=col;i++)
                             output+="<td/>"+rs.getString(i)+"</td/>";
                           output += "</tr/></table/>";
                    }//End of While
               catch(Exception e)
        return output;
      }//End of Table method
    }//End of Class

    First reaction: yuck.
    This is not something you should be using a bean for.
    Beans are meant for storing data, not for generating HTML from.
    I don't really like queries on a JSP page either, but thats a different story again.
    I would recommend you use JSTL for this.
    1 - it provides a c:forEach tag for looping
    2 - it provides sql tags for doing queries in a database
    IF you are going to do database queries from a JSP page, I absolutely recommend you use the JSTL tags.
    (end rant)
    Your problem is probably caused by the fact that in your bean you have the following
    try{
      // code here
    catch (Exception e){
      // completely ignore exception and carry on as if nothing bad happened.
      // what you should be doing is something like:
      System.out.println("Error occurred " + e.getMessage());
      e.printStackTrace();
      return e.getMessage();
    }Cheers,
    evnafets

  • How can I using java bean to insert new record

    Hi everybody,
    I'd some problem when I insert a record using java bean. When insert a record, the resultset executeUpdate return 0 anc cannot add record to database. Would you please tell me what's wrong in my code?
    java bean
    package miniproj;
    import java.sql.*;
    public class Register{
    private String sql;
    private String username;
    private String usertype;
    private String password;
    private String blocknum;
    private int floornum;
    private String owner;
    private int rows;
    private String s;
    // set parameter to database
    public int setMember(){
    try{
    //load database driver
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    // Get a connection to the database
    Connection sqlConn = java.sql.DriverManager.getConnection("jdbc.odbc:WFBS");
    // Get a statement from the connection
    Statement sqlStmt = sqlConn.createStatement();
    sql = "INSERT INTO USERS(user_name, password) VALEUS ('aaa', 'aaa')";
    // sql = "INSERT INTO USERS(user_name, password) VALEUS (" + user_name + "," + password + ")" ;
    rows = sqlStmt.executeUpdate(sql);
    // sqlRst.close();
    sqlStmt.close();
    sqlConn.close();
    catch(SQLException se){
    catch(Exception e){
    return rows;
    // set user name method
    public void setUsername(String name){
    username = name;
    // set passwrod method
    public void setPassword(String pwd){
    password = pwd;
    // set block num mehtod
    public void setBlockNum(String block){
    blocknum = block;
    // set floor num method
    public void setFloorNum(int floor){
    floornum = floor;
    // set owner method
    public void setOnwer(String own){
    owner = own;
    // get user name method
    public String getUsername(){
    return username;
    // get password method
    public String getPassword(){
    return password;
    jsp code
    <%@ include file="Header.jsp" %>
    <%@ page errorPage="Error.jsp" %>
    <jsp:useBean id="register" class="miniproj.Register" />
    <jsp:setProperty name="register" property="*" />
    User name : <%=register.getUsername()%><br>
    Password : <%=register.getPassword()%><br>
    <%
    int i = register.setMember();
    out.println(i);
    %>
    Thanks a lot
    Chris

    Seems to me that executeUpdate() would throw an SQLException, which in turn would get caught by your empty catch. The SQL keyword VALUES is misspelled. Put a 'se.printStackTrace()' in your catch to confirm this.

  • Value cannot refresh using Java bean

    When I use java bean to get a value. It suppose to refresh and show new value but it doesn't. So any code can help to resolve this issue.
    here is my code
    (Testing.jsp)
    <html>
    <head>
    <title>Page 3</title>
    <link rel=stylesheet type="text/css" href="auction.css">
    </head>
    <table class="mainBox" width="200">
    <tr><td class="boxTitle" >
    Testing number 3
    </td></tr>
    <tr><td>
    <span class="headline">
         <jsp:useBean id="testing2" class="com.jsp.newsys.testing.Testing2" scope="request">
         <jsp:setProperty name="testing2" property="user" value="Hello World"/>
    <jsp:getProperty name="testing2" property="user2"/>
         </jsp:useBean>
    </span>     
    </td></tr>
    </table>
    </html>
    The bean file which is Testing2.java
    package com.jsp.newsys.testing;
    import java.beans.*;
    import java.util.*;
    public class Testing2 extends Object implements java.io.Serializable {
         private String user;
         private String test;
    public Testing2() {
    public void setUser(String user)
              test="";
              if (user.equals("Hello World"))
                   test="Hi dqwqwd";
         public String getUser2()
         return this.test;
    I need to restart my tomcat everytime then only the value will refresh. Please help.
    Message was edited by:
    wesleygch
    Message was edited by:
    wesleygch
    Message was edited by:
    wesleygch

    Your bean maybe have misspelling error
    look at test and test2 on the jsp file. But I couldn't find any bean property test2 in your bean. Maybe you should try
    ${testing2.test} instead of ${testing2.test2}
    I am a new bie also....:-)

  • Stepping into Java Beans from JSP

    I am trying to figure out how to step into the Java Source code for my beans that are used in my JSP pages. I need to be able to debug them by stepping into them, using break points, etc.
    I have Nitro installed and a sample JSP page with the import to my test Java Bean class. What I did was create two projects in my work space. One as a Web project application and one as a Java project. I referenced and opened both projects. Everything compiles fine and the syntax is correct.
    The problem is I can not make the link for importing the class.
    I get this error: Class com.BrianTest.MyBean not found in import com.BrianTest.MyBean
    Anyone got a clue or a good example? I did try and add the class path and I tried to put it in a Jar file and attach the source to the Jar, but same problem.
    Thanks :?

    Stepping into jsp:useBean is not possible, but you can step-into jsp getter & setter tag.
    Since you are using java bean from a dependent project you need to configure your server with DevLoader.
    And currently only Tomcat server can be configured with Sysdeo Devloader to handle this situation
    Download Sysdeo DevLoader for Tomcat from http://www.sysdeo.com/eclipse/tomcatPlugin.html
    NOTE: If the project is self sufficient and not dependent on other projects/locations for classess/libraries then NitroX picks up all the libraries & classes present within default WEB-INF/lib & WEB-INF/classes respectively. And in this case you need not modify server configuration.
    Sysdeo DevLoader is to allow your web project to use libraries/classes from dependent projects. All you need to do is extract DevLoader.zip present within tomcatPluginV3.zip inside your Tomcat/server/classes folder.
    For more information about DevLoader please refer to http://www.sysdeo.com/eclipse/readmeDevLoader.html
    This will solve your problem and you should be able to run/debug your application. And most important make sure you have the correct NitroX build that supports Sysdeo DevLoader, refer http://www.m7.com/whatsnew.htm document against your build id (Help > About NitroX > NitroX Icon)

  • How to use Java Beans In JSTL?

    Hi
    I want to know how to use Java bean in JSTL
    please explain this with giving any one example.
    Thanks-
    Swapneel

    A bean is obtain by <jsp:useBean> tag nd once bean is obtained we can get its property by using getProperty tag.

  • How to call java bean from jsp

    hi
    How to call a java bean from jsp page..
    Is any other way to call javabean from jsp page apart from this sample code...
    <jsp:useBean id="obj" class="com.devsphere.articles.calltag.TestBean"/>
    thnx in advance

    If you also use servlets, you can attach beans to the request or session and use them directly in your JSP's. So if you do:
    request.setAttribute("name", yourBean);and then forward to a JSP, you can reference the bean like:
    ${requestScope.name}

Maybe you are looking for

  • Background job scheduling popup msg

    Hello, We have a custom program calling the Function module "MRM_INVOICE_RELEASE_UPDATE". If we run the custom program in the foreground I'm getting a popup saying No entries made in reference field Now if we run the program in background, How will t

  • Error while creating SCSM 2012 sp1 self-portal on SP2013

    Hell to everyone today dive into SCSM installation and self-service portal setup. the environment i use is as following: Windows 2008 R2 Datacenter x64 SP1 SQL 2012 BI Edition Sharepoint server 2013 Enterprise Edition SCSM 2012 SP1 i have successfuly

  • CS6 Resize stopped working

    Hi all. I recently tried the 30 day Photoshop/Lightroom 30 day trial and as I already had CS6 and Lightroom5 I decided not to go ahead with CC as I could see little to no advantage and subsequently deleted the CC. Now however CS6 is refusing to work

  • Weather SOA required for Enterprise Manager Console

    i installed oracle 10g express edition in my system. I want to access Enterprise Manager Console.To access that console weather it is required to install SOA?

  • IllegalStateException using custom tag

    I'm receiving the following exception when trying to use a custom tag we are developing to allow us to provide localized content based on the users browser language/country settings:      java.lang.IllegalStateException: WEB3025: Cannot reset after r