Using web beans in JSP

I would like to know how create a tree using Web Beans that Jdeveloper provides. Using the web object editor I could add two Beans which mapped to JSTree and JSTreeData(in oracle.jdeveloper.jsp.wb package), though I don't know the difference between them. I tried to include Both these beans in the JSP(which appear as tags) but I am unable to render the tree. Let's say I have a parent node (text: row1, url: url1, 3 childs) and 3 child nodes (text: row2..row4, url: url2..url4, each with no childs). How do I write it in the JSP to render it properly
-Rajeev

I would like to know how create a tree using Web Beans that Jdeveloper provides. Using the web object editor I could add two Beans which mapped to JSTree and JSTreeData(in oracle.jdeveloper.jsp.wb package), though I don't know the difference between them. I tried to include Both these beans in the JSP(which appear as tags) but I am unable to render the tree. Let's say I have a parent node (text: row1, url: url1, 3 childs) and 3 child nodes (text: row2..row4, url: url2..url4, each with no childs). How do I write it in the JSP to render it properly
-Rajeev

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.

  • How to use JavaScript in Web bean generated JSP

    I want to do some simple JavaScript validations (for example, checking if a particular field is empty) in the JSP page rendered by the data web bean. Because the HTML is rendered by the bean, I'm not able to refer to the HTML controls in the JSP page. I'm not even able to refer to the form with the following standard piece of JavaScript code - "document.forms[0].control_name".
    Is anybody aware of how to use JavaScript with these rendered JSP pages?

    You just have to add it like and applet , including this line in your JSP or JSF
    <script src="http://dl.javafx.com/dtfx.js"></script>Then add the applet
    <script>
        javafx(
                  archive: "./resources/jar/Draw.jar",
                  width: 400,
                  height: 200,
                  code: "Draw",
                  name: "Draw"
    </script>./resources/jar/Draw.jar - is the path and the name of the jar

  • Problem using a bean in JSP on Tomcat 5.0.28

    Hi,
    I'm new to JSP, I've installed Tomcat 5.0.28 and I'm able to run JSP but when I try an asp wich uses a bean it gives me this error, the directory structure is
    testingProject with the first.jsp
    testingProject\WEB-INF\classes\myPackage with the test.class
    the first.asp
    <%@ page import="myPackage.Test" %>
    <html><head><title>Test</title></head>
    <body bgcolor=white>
    <jsp:useBean id="list" class="myPackage.Test"> </jsp:useBean>
    <jsp:getProperty name="list" property="value1" />
    <%=list.value1%>
    <p>
    </body></html>
    the Test.java
    package myPackage;
    public class Test{
    String value1="testinggggggggg";
    public void Test(){
    public String getValue1(){ return value1}
    the error
    thanks in advance
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 6 in the jsp file: /first.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 5.0\work\Catalina\localhost\testingProject\org\apache\jsp\first_jsp.java:60: cannot resolve symbol
    symbol : variable value1
    location: class myPackage.Test
    out.print(list.value1);
    ^
    1 error
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)

    There are two ways of getting info from the bean.
    1) the jsp:getProperty tag, which seems correct in your code
    2) the <%= ... tag. In that case you must write a valid java expression. In your case: list.getValue1()

  • 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.

  • 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.

  • 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 session bean in JSP

    Dear All
    I write a BorrowList session bean and tested OK in console mode. I can't use it in the JSP, Dose any body tell me How can I create this bean in the JSP and when should I place the bean classes(Home, Bean and Remote).
    I'm now using the BEA Weblogic 7.0
    I'm appreicate if anybody can help me.
    Best Regards
    YU

    U may be used the code similar to following :
    Context context = new InitialContext.();
    Object obj = (Object)context.lookup("Your JNDI name");
    YourHome home = (YourHome)obj.portableRemoteObject.narrow(obj,
    YourHome.class);
    YourRemote remote = home.create();
    System.out.println("your Business methods : "+remote.businessMethod1());
    Put this code or whatever code used in ur console client in JSP and invoke the businessMethods using remote object.
    I worked with BEAWeblogic 5.1, I think similar case may be there with BEA Weblogic7 also.
    First, make a jar file with ome.Remote and Bean by using the deploymenttool, then compile with ejb compiler, the new Jar is the complete deployable file. Take this file and register in weblogic.properties file that is specify the path of the Jar file in the weblogic.properties file. and put the JSP in public-html directory and start the server. if the bean is deployed successfully, open JSP file in a browser then it will work.... if the bean is not deployed you won't get any result.
    I can say, just placing the initialContext part of code on the JSP and running the JSP. I think, this may helps u...
    Ramana

  • Using BI Bean in JSP

    Hi,
    Can anyone please provider some pointers on using BIBeans in a JSP page. There are few options in my knowledge.
    1)Using BI-Beans API for writing our own JSP tags.
    2)In Jdev(10g) there seems to be some support for Graphs through ADF.
    3)JSP and UIX tags provided BI-Graph beans.
    thanks
    Rahul

    U may be used the code similar to following :
    Context context = new InitialContext.();
    Object obj = (Object)context.lookup("Your JNDI name");
    YourHome home = (YourHome)obj.portableRemoteObject.narrow(obj,
    YourHome.class);
    YourRemote remote = home.create();
    System.out.println("your Business methods : "+remote.businessMethod1());
    Put this code or whatever code used in ur console client in JSP and invoke the businessMethods using remote object.
    I worked with BEAWeblogic 5.1, I think similar case may be there with BEA Weblogic7 also.
    First, make a jar file with ome.Remote and Bean by using the deploymenttool, then compile with ejb compiler, the new Jar is the complete deployable file. Take this file and register in weblogic.properties file that is specify the path of the Jar file in the weblogic.properties file. and put the JSP in public-html directory and start the server. if the bean is deployed successfully, open JSP file in a browser then it will work.... if the bean is not deployed you won't get any result.
    I can say, just placing the initialContext part of code on the JSP and running the JSP. I think, this may helps u...
    Ramana

  • Using web service in jsp

    i am designing simple jsp page in which user can request their new account. they have to fill their first name, last name and intranet id and then when they click on submit. those values will come in the bean that i have made called requestaccount.java and frm that it will have to call webservice and search whether the values matches with user values. if matches then send mail to my manager and return jsp with message" ur details has been submitted. if it fails to serach in webservice then return error messge according like details doesnt exist or first name is empty, lastname is empty or intranetid is empty. how can i call webservice in jsp? any ideas?
    thanx

    Hi,
    What did you use to write your web service? I have been using Axis2. Typically, you write a client to access your webservice using the same framework that you used to generate the service. I would recommend writing a standalone client. Once you have that code written, you can move into a servlet and then use a JSP as a front end.

  • 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.

  • 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;
      

  • 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

  • Using Web Service from JSP

    hi all,
    i must read a html form and send these value to a web service and get return value (XML) from web service but i can't find how it has been done so i need help.
    Thanks.
    ps : my english is not too good. (i think you know this before.)
    : i'm very very tiro :)

    i must read a html form and send these value to a web
    service and get return value (XML) from web serviceHi,
    Check out Jakarta AXIS to create Web services and clients.
    http://ws.apache.org/axis/
    Understanding your situation, I think you can.
    1. Create a web service using AXIS. Deploy this in a web application say TESTAXIS in a container say TOMCAT. "Publish" the web service.
    2. Create another web application and have a servlet read the form code. Embed the client code in the servlet and send the data to the web service.
    Bingo !!! Your job is done !!!
    Regards.

  • Use web bean problem

    I work with BusinessComponent and DataWebBean for create JSP page.
    I want change the whereClause at run time for the View Object as code:
    <jsp:useBean class="oracle.jbo.html.databeans.NavigatorBar" id="nbc" scope="request" >
    <%
    nbc.setShowNavigationButtons(true);
    nbc.setReleaseApplicationResources(false); nbc.initialize(pageContext,"bcPackage_BcPackageModule.DeptView");
    nbc.render();
    %>
    </jsp:useBean>
    <jsp:useBean class="oracle.jbo.html.databeans.RowSetBrowser" id="rsb" scope="request" >
    <% rsb.setUseRoundedCorners(true);
    rsb.setShowCurrentRow(true);
    rsb.setVisibleRows(10);
    rsb.setAlternateColors(true);
    rsb.setShowRecordNumbers(false);
    rsb.setReleaseApplicationResources(false);
    rsb.initialize(pageContext,"bcPackage_BcPackageModule.DeptView");
    rsb.getRowSet().getViewObject().setWhereClause("DeptNo=20 ");
    rsb.getRowSet().getViewObject().executeQuery();
    rsb.render();
    %>
    </jsp:useBean>
    Afther this operation, the NavigatorBar don't respond correctly (if I go next and then go prev it fails)
    idem with:
    <jsp:useBean class="oracle.jbo.html.databeans.NavigatorBar" id="nbc" scope="request" >
    <%
    nbc.setShowNavigationButtons(true);
    nbc.setReleaseApplicationResources(false);
    rsb.getRowSet().getViewObject().setWhereClause("DeptNo=20 ");
    rsb.getRowSet().getViewObject().executeQuery(); nbc.initialize(pageContext,"bcPackage_BcPackageModule.DeptView");
    nbc.render();
    %>
    </jsp:useBean>
    <jsp:useBean class="oracle.jbo.html.databeans.RowSetBrowser" id="rsb" scope="request" >
    <% rsb.setUseRoundedCorners(true);
    rsb.setShowCurrentRow(true);
    rsb.setVisibleRows(10);
    rsb.setAlternateColors(true);
    rsb.setShowRecordNumbers(false);
    rsb.setReleaseApplicationResources(false);
    rsb.initialize(pageContext,"bcPackage_BcPackageModule.DeptView");
    rsb.render();
    %>
    Where's the problem?
    Thanks you
    Andrea

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Susan Shen ([email protected]):
    Thanks Laura! It's done.
    But I found this problem happens every time when restart my computer. Is there any solution?
    Regards
    Susan<HR></BLOCKQUOTE>
    null

Maybe you are looking for

  • Why does iphone 5 email my photos as png? i need jpg file.

    I'm trying to email photos, save to my PC then download to a photo website. This particular website only recognizes jpg as images. I've never had this problem before. Is there another way to change setting to email photos as jpg instead of png? thank

  • Problem after a hard reset

    I recently had a ecard problem (can recall what number) with my palm so I did a hard reset and now it wont pas from the part were it asks to tap the center of the target. What can I do.  Thank you for your help.  Sincerely Jose Roberto Castaneda   Po

  • Export to excel problem from EP reports

    Hi Friends, When I export the reports from EP to excel, I am not getting the Financial year period and the week that I entered in the variable screen. can anyone advice me how to get financial year period and the week that I entered in the variable s

  • Ctx.lookup to access Portal System in EP

    I have defined a new JDBC System in System Administration --> System Configuration on EP I want to be able to access it in a JSPDyn page. I know I can access a jdbc database via the JDBC Connector However I would like to take advantage of the UserMap

  • Adobe Reader prompts for font package add-on

    Adobe Reader prompts to install a font package in order to view the document I have been working on without problems for the past week.  I need to click OK to be redirected to the download area, but when I click OK nothing happens.