How to call a simple bean from jsp in weblgic 6.1

Hi All,
Can any one help me , my problem is i have a jsp that is calling a simple bean method for displaying a message .
When im trying to call the beans methods it conntinusly giving me error unable to resolve the Beans' name
my jsp content is:
<%@ page language="java" import="com.Arvind*"%>
<jsp:useBean id="mybean" scope="session" class="com.Arvind" />
<%
     out.println("Hello"+mybean.callMe());
%>
beans is :-
package com;
public class Arvind
     private String st ="This Is Me??";
     public String callMe(){
          System.out.println("Hello World!");
          return st;
     public static void main(String[] args)
          System.out.println("Hello World!");
i have tried it a lot but all time it fails resolve the class name itself ??
can anyone please help me urgently
thanks in advance
rgds
Birendar

It might compile perfectly well, but the message suggests that you didn't deploy it properly. The class loader can't find it.
That .class file should appear with its package directory structure under the WEB-INF/classes directory or in a JAR in your WEB-INF/lib directory in some WAR file. Does it?

Similar Messages

  • How to call java script function from JSP ?

    how to call java script function from JSP ?

    i have function created by java script lets say x and i want to call this function from jsp scriplet tag which is at the same page ..thanks

  • How to call custom Login Module from JSP

    Hi,
    I am stuck with the following issue:
    1) Exactly as presented in help.sap.com (http://help.sap.com/saphelp_nw04/helpdata/en/3f/1be040e136742ae10000000a155106/content.htm) I created custom login module and deployed it as a library on J2EE server. When I configured it to be used for my applications in the Security provider but I am getting "No user name provided" exception everytime when my applications use this custom login module.
    2) I realized that I would need to call my custom module somewhere within my application (simple JSP) using LoginContext class and then use MyLoginContext.login() spec to initiate login process. But I am not able to pass CallbackHandler parameters from JSP application to my custom login module.
    So I have the following questions:
    1. Can I pass parameters using LoginContext and CallbackHandler from JSP to my custom login module (created as exact copy of HELP.SAP.COM example) or this module cannot be used this way.
    2. How to pass CallbackHandler correctly to my custom login module from JSP. When I am trying to use CallbackHandler, I am getting "Abstract Class cannot be called" error.
    I'd appreciate any little help on this matter.
    Thanks and regards,
    Mike

    You have two alternatives to do this:
    You can declare your JSP as a protected resource with the use of the deployment descriptors of the application (web.xml) and add the custom login module in the authentication stack of the application. This way, you will use container-based authentication, i.e. the Web Container will enforce the authentication and it will call the custom login module before it dispatches to the JSP. I recommend you this approach because it requires less coding and it makes the whole thing a matter of configuration. The configuration can be later on enhanced or changed runtime without the need to re-build and re-deploy the application. If you choose this approach you can go to the documentation of the server for help on how to modify the login module stack of the application.
    You can also use programmatic authentication by using JAAS API. To do this you need to create a custom security policy configuration with login module stack containing the custom login module, and then use the standard JAAS mechanism - new LoginContext(<configuration>, <callback-handler>).login(). This approach requires that you write your own callback handler and handle any LoginException.
    Let us know which approach you prefer and whether you have difficulties implementing it!

  • How to use the same bean from Jsp and Servlet

    I want to use the same bean instance from both the servlet and jsp.
    for eg. if a create a bean using the jsp:useBean in servlet and if a modify some values, that values should be reflected while i access the same bean from the servlet. But instead of that the servlet is creating a new instance of the bean.
    is it possible?
    Thanks in advance

    Hi,
    When you call jsp:useBean you inform a scope (session, request, page...)
    This means the bean instance will be stored in that scope.
    So, if the informed scope is session, then, in the servlet you could get the bean instance back from the session, this way:
    HttpSession session = request.getSession();
    Bean b = (Bean) session.getAttribute("bean_id");
    Regards,
    Filipe Fedalto

  • How to call Generic Page flow from jsp

    Hi All,
    I have some links in my home page(jsp file).Based on user's selection, i need to show another JSP page using pageflow(JPF).
    thanks in advance
    vandana

    i have function created by java script lets say x and i want to call this function from jsp scriplet tag which is at the same page ..thanks

  • How to call java class file from jsp

    hi
    we need to call java classes (which are written separately in .java file )from jsp file. we need it for our project if anyone knows about please reply us.
    bye
    siva sankari

    you can call the methods in a lot of ways. you could use scriptlets with the
    <%@ page import="package.class"%> and then inside instantiate an object
    <%
         MyClass mc = new MyClass(parameters if any);
         mc.theMethodYouWantToCall();
    %>or as Madathil has stated,
    or use the JSP tags
    <jsp:useBean id="anyname" class="classname"/>and then use the getProperty tag
    or even Custom Tags

  • How to call an ejb method from jsp?

    Hi, everyone!
    Inside my JSP, I4m using scripts in order to show and receive information, that is, a form.But I don4t Know if I can use the same variables from the script in order to call the 'set' methods from my EJB.
    Could anyone show me an example?
    Thanks in advance,
    Silvia

    InitialContext ctx = new InitialContext();
         GeneralEditor editor = (GeneralEditor) ctx
                        .lookup("GeneralEditorBean/remote");
              GeneralService service = (GeneralService) ctx
                        .lookup("GeneralServiceBean/remote");
              LanMu lm = new LanMu();
              lm.setName("shdfkhsad");
              editor.add(lm);

  • How to call A Seesion Bean from a standalone java program

    i want to call a session bean vis a standalone java program on the same machine. i am having some problem with CORBA. i really do not understand what is going on.
    help me please.
    Thank you

    You are shooting in the dark......explain the problem

  • How to call a esb service from jsp

    Hi,
    Please help me in achieving this, i would like to call have a simple UI developed in JSP which has 3 radio button namely select, update and create.
    I have 3 more fields namely NAME and DESIGNATION. I have created a table with 2 columns namely NAME and DESIGNATION.
    If i select the select radio button and key in name of any guy to query his designation i should be able to get the answer.
    Same for create and update as well. I guess i have given you the overview.
    How to connect the JSP page with the ESB which i have deployed in the ESB Console.
    Please some body help me.
    Regards,
    Vijay.B

    Hi All,
    Here is an example which does that.
    http://iadvise.blogspot.com/2007/06/invoke-esb-service-in-your-user.html
    Regards,
    Vijay.B

  • Trying to call a data bean from jsp

              I get the following error:
              C:\bea\user_projects\infologic1\.\myserver\.wlnotdelete\extract\myserver_BibleApp_BibleApp\jsp_servlet\__menu.java:146:
              cannot resolve symbol
              probably occurred due to an error in /menu.jsp line 27:
              Enumeration.categoryIds = categories.keys();
              code:
              menu.jsp
              <%@page import="java.util.*"%>
              <jsp:useBean id="DbBean" scope="application" class="showMeItNow.DbBean"/>
              <%
              String base = (String) application.getAttribute("base");
              %>
              <table width="150" cellpadding="5" height="75" cellspacing="0" border="0">
              <tr>
              <td>
              <form>
              <input type="hidden" name="action" value="search">
              <input type="text" name="keyword" size="10">
              <input type="submit" value="go">
              </form>
              </td>
              </tr>
              <tr>
              <td>category</td>
              </tr>
              <tr>
              <tr valign="top">
              <%
              Hashtable categories = DbBean.getCategories();
              Enumeration.categoryIds = categories.keys();
              while (categoryIds.hasMoreElements()) {
              Object categoryId = categoryIds.nextElement();
              out.println("<a href=" + base + "? action=browseCatalog&categoryId="
              + categoryId.toString() + ">" + categories.get(categoryId) + "</a><br>");
              %>
              web.xml
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
              "http://java.sun.com/dtd/web-app_2_3.dtd">
              <web-app>
                   <servlet>
                        <servlet-name>ControllerServlet</servlet-name>
                        <servlet-class>ControllerServlet</servlet-class>
              <init-param>
                   <param-name>base</param-name>
                   <param-value>http://localhost:7001/BibleApp/</param-value>
              </init-param>
              <init-param>
                   <param-name>imageURL</param-name>
                   <param-value>http://localhost:7001/BibleApp/</param-value>
              </init-param>
              <init-param>
                   <param-name>dbURL</param-name>
                   <param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
              </init-param>
              <init-param>
                   <param-name>usernameDbConn</param-name>
                   <param-value>dinesh</param-value>
              </init-param>
              <init-param>
                   <param-name>passwordDbConn</param-name>
                   <param-value>passs</param-value>
              </init-param>
              </servlet>
              </web-app>
              DbBean.class
              package showMeItNow;
              import java.util.*;
              import java.sql.*;
              import showMeItNow.Poll;
              public class DbBean {
              public String dbUrl="";
              public String dbUserName="";
              public String dbPassword="";
              public void setDbUrl(String url) {
              dbUrl=url;
              public void setDbUserName(String userName) {
              dbUserName=userName;
              public void setDbPassword(String password) {
              dbPassword=password;
              public Hashtable getCategories() {
              Hashtable categories = new Hashtable();
              try
              Connection connection = DriverManager.getConnection(dbUrl, dbUserName,
              dbPassword);
              CallableStatement cstmt = connection.prepareCall("{? = call dbo.categoryListing()}");
              //register the stored procedure's output paramater!!!
              cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
              cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
              ResultSet rs = cstmt.executeQuery();
              while (rs.next()) {
              categories.put(rs.getString(1), rs.getString(2) );
              rs.close();
              cstmt.close();
              connection.close();
              catch (SQLException e) {  }
              return categories;
              

    You might want to look at whether there is any data being fetched from
              the DB. Use some System.out.println()'s in the code where you fetch the
              data from the stored proc.
              Another way might be to comment out the database code, add some dummy
              values into the hastable and make sure that the page comes up as you
              expect.. and then go ahead with the database thingy..
              Nagesh
              dinesh wrote:
              > Thanks, the page is loading up. But, it is just blank. It is not displaying the
              > hastable data. Any ideas?
              >
              > thanks again,
              > Dinesh
              >
              > Nagesh Susarla <[email protected]> wrote:
              >
              >>>Enumeration.categoryIds = categories.keys();
              >>
              >>try replacing the dot '.' with a space and it should be all fine ..
              >>maybe a typo.
              >>
              >>Enumeration categoryIds = categories.keys();
              >>
              >>--
              >>Nagesh
              >>
              >>
              >>dinesh prasad wrote:
              >>
              >>>I get the following error:
              >>>
              >>>C:\bea\user_projects\infologic1\.\myserver\.wlnotdelete\extract\myserver_BibleApp_BibleApp\jsp_servlet\__menu.java:146:
              >>>cannot resolve symbol
              >>>probably occurred due to an error in /menu.jsp line 27:
              >>>Enumeration.categoryIds = categories.keys();
              >>>
              >>>
              >>>code:
              >>>
              >>>menu.jsp
              >>>----------
              >>><%@page import="java.util.*"%>
              >>><jsp:useBean id="DbBean" scope="application" class="showMeItNow.DbBean"/>
              >>>
              >>><%
              >>> String base = (String) application.getAttribute("base");
              >>> %>
              >>>
              >>>
              >>><table width="150" cellpadding="5" height="75" cellspacing="0" border="0">
              >>><tr>
              >>><td>
              >>><form>
              >>><input type="hidden" name="action" value="search">
              >>><input type="text" name="keyword" size="10">
              >>><input type="submit" value="go">
              >>></form>
              >>></td>
              >>></tr>
              >>><tr>
              >>><td>category</td>
              >>></tr>
              >>><tr>
              >>><tr valign="top">
              >>>
              >>> <%
              >>> Hashtable categories = DbBean.getCategories();
              >>> Enumeration.categoryIds = categories.keys();
              >>> while (categoryIds.hasMoreElements()) {
              >>> Object categoryId = categoryIds.nextElement();
              >>> out.println("<a href=" + base + "? action=browseCatalog&categoryId="
              >>>+ categoryId.toString() + ">" + categories.get(categoryId) + "</a><br>");
              >>>}
              >>>
              >>> %>
              >>>-------------------------------------------------------------------------------------
              >>>
              >>>web.xml
              >>><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              >>
              >>2.3//EN"
              >>
              >>>"http://java.sun.com/dtd/web-app_2_3.dtd">
              >>>
              >>><web-app>
              >>>     <servlet>
              >>>          <servlet-name>ControllerServlet</servlet-name>
              >>>          <servlet-class>ControllerServlet</servlet-class>
              >>>     
              >>><init-param>
              >>>     <param-name>base</param-name>
              >>>     <param-value>http://localhost:7001/BibleApp/</param-value>
              >>></init-param>
              >>>
              >>><init-param>
              >>>     <param-name>imageURL</param-name>
              >>>     <param-value>http://localhost:7001/BibleApp/</param-value>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>dbURL</param-name>
              >>>     <param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
              >>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>usernameDbConn</param-name>
              >>>     <param-value>dinesh</param-value>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>passwordDbConn</param-name>
              >>>     <param-value>passs</param-value>
              >>></init-param>
              >>> </servlet>
              >>></web-app>
              >>>     
              >>>          
              >>>-----------------------------------------------------------------------
              >>>DbBean.class
              >>>
              >>>package showMeItNow;
              >>>
              >>>import java.util.*;
              >>>import java.sql.*;
              >>>import showMeItNow.Poll;
              >>>
              >>>public class DbBean {
              >>> public String dbUrl="";
              >>> public String dbUserName="";
              >>> public String dbPassword="";
              >>>
              >>> public void setDbUrl(String url) {
              >>> dbUrl=url;
              >>> }
              >>>
              >>> public void setDbUserName(String userName) {
              >>> dbUserName=userName;
              >>> }
              >>>
              >>> public void setDbPassword(String password) {
              >>> dbPassword=password;
              >>> }
              >>>
              >>> public Hashtable getCategories() {
              >>> Hashtable categories = new Hashtable();
              >>> try
              >>> {
              >>> Connection connection = DriverManager.getConnection(dbUrl,
              >>
              >>dbUserName,
              >>
              >>>dbPassword);
              >>>
              >>> CallableStatement cstmt = connection.prepareCall("{?
              >>
              >>= call dbo.categoryListing()}");
              >>
              >>> //register the stored procedure's output paramater!!!
              >>> cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
              >>> cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
              >>> ResultSet rs = cstmt.executeQuery();
              >>> while (rs.next()) {
              >>> categories.put(rs.getString(1), rs.getString(2) );
              >>> }
              >>> rs.close();
              >>> cstmt.close();
              >>> connection.close();
              >>> }
              >>> catch (SQLException e) {  }
              >>> return categories;
              >>> }
              >>>
              >>>}
              >>>
              >>>
              >>>
              >>
              >
              

  • How to call PL/SQL function from JSP ?

    We have the JSP application developed using the JDeveloper 3.0. I am trying to call the PL/SQL DB function. I'm trying to use the method of ApplicationModule:
    .getTransaction().executeCommand(sCommand)
    The problem is that I can not get the function result back to JSP. The executeCommand() does not seem to accept any host variables.
    What to do ? Did anyone manage to get the feedback from DB ?
    Here is the code in the JSP page:
    <%! String res=" ";%>
    <jsp:useBean id="rsn"
    class="oracle.jbo.html.databeans.TRSRowSetNavigator"
    scope="request" >
    <%
    rsn.initialize(application,session, request,response,
    out,"theIMO_trs_bc4J_Bc4JModule.AuctionsListView");
    rsn.setReleaseApplicationResources(true);
    // this is the ID to be copied
    String copy_id = request.getParameter(TRS.LOOK_UP_PK_FIELD);
    if( copy_id != null) {
    // call the PL/SQL procedure to create copy of this auction
    String sCommand = "DECLARE a NUMBER; BEGIN :res:=Copy_Auction("
    copy_id"); END;";
    rsn.getRowSet().getApplicationModule().getTransaction().executeCommand(sCommand);
    rsn.getRowSet().getApplicationModule().getTransaction().commit();
    I receive the following error:
    Error Message: JBO-27121: SQL error during statement execution. Statement: DECLARE a NUMBER; BEGIN :res:=Copy_Auction(45); END;
    JBO Error:JBO-27121: SQL error during statement execution. Statement: DECLARE a NUMBER; BEGIN :res:=Copy_Auction(45); END;: ORA-01008: not all variables bound
    What criteria has the host variable meet to be used in the executeCommand(sCommand) method ?
    Thanks,
    Michael
    null

    I could be wrong there, but I have experienced similar problem on tru64 unix, with sticky bit not in place for the following files: $ORACLE_HOME/bin/oracle and $ORACLE_HOME/bin/oracleO. Once you restore those files via tar command (this is what happened to me), the sticky bit disappears, and you have to re-introduce it by issuing unix command: chmod 1777 on those files.
    What it does for you - it allows you to execute the sql statements as an oracle user & group!
    Otherwise, if this bit is lost, whenever you try to connect to sqlplus via user / password it hits you back with:
    ORA-01034 ORACLE not available
    ORA-27121 unable to determine size of shared memory segment
    Compaq Tru64 UNIX Error: 13:Permission denied
    This should not be a problem if you try and execute the same sql statements using listener (connecting to the server by using @ statement).
    I could be late in response to you, but maybe not for other people.

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

  • Create Form Beans from JSP/HTML forms

    In the Builder certification objectives, there is one called "Create Form Beans from JSP/HTML forms". How can I do that? How can I create a form beam starting from the JSP form or HTML form?

    Guys, no one from forum can answer this question?

  • How to call Java Beans from JSP (eg.put them in a WAR or package)

    Can anyone explain to me what are the steps and ways to call java beans from JSP?

    1st, put the javabean classes in the right place:
    the web-inf/classes/your_bean.class directory of corresponding web application
    2nd in your jsp page:
    <jsp:useBean id="obj_var_name" class="your_bean"/>
    <jsp:setProperty name="obj_var_name" property="smthg" value="smthg_calue"/>
    Micheal

  • How to call a .jar file from a java bean?

    any body knows how to call a .jar file from a java bean?

    Crosspost!
    http://forum.java.sun.com/thread.jspa?messageID=4349619

Maybe you are looking for