Jsp:useBean   in a session

I'm going through a JSP tutorial and I've gotten to the Beans and Form Processing section. I'm having the Form submit a jsp page(SaveName.jsp), within this jsp the first line has problems
<jsp:useBean id="user" class="UserData" scope="session"/>
Looks like the "user" is not getting created into the session. I've compiled the UserData.java program and put the UserData.class file in the proper classes folder that is in my ClassPath.
Does anyone see anything that I'm missing here, or I can provide more info too.
Thanks,
KLWatter
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /SaveName.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\SaveName_jsp.java:42: cannot resolve symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
UserData user = null;
^
An error occurred at line: 1 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\SaveName_jsp.java:44: cannot resolve symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = (UserData) jspxpage_context.getAttribute("user", PageContext.SESSION_SCOPE);
^
An error occurred at line: 1 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\SaveName_jsp.java:46: cannot resolve symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = new UserData();
^
3 errors
     org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
     org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
     org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
     org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

Here is the java program or bean class that I'm using, UserData.java compiled into UserData.class:
public class UserData {
String username;
String email;
int age;
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
To put the data into the session, I used the following form:
<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
and SaveName.jsp is this:
<jsp:useBean id="user" class="UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
Continue
</BODY>
</HTML>

Similar Messages

  • Jsp:useBean : Missing value of String classed bean with 'session' scope

    Hi!
    I'd like to ask some help.
    I have these two JSP pages:
    1.jsp<jsp:useBean id="str" class="java.lang.String" scope="session"/>
    <html>
    <body>
    <% str="hello"; %>
    <a href="2.jsp">click</a>
    </body>
    </html>
    2.jsp<jsp:useBean id="str" class="java.lang.String" scope="session"/>
    <html>
    <body>
    <%=str%>
    </body>
    </html>When I open 1.jsp in my browser, then click on the link, the result is "nothing" (empty string). Why does the bean lose its value on the way?
    I use a Tomcat 5.5.9 server.
    Any help will be highly appreciated.

    You have to think of several scopes when working with JSP. The first is the local scope: the method _jspService() where all the work of the JSP is done.  This acts as a normal method and is where all the sciptlet code goes.
    When you use jsp:useBean you are creating two references to a new String object. One in the local scope accessible through <%= str %> and the other in the session scope.
    When you do <% str = "hello"; %> you are changing the local str variable to reference the String "hello" (this is equivalant to doing <% str = new String("hello"); %>). Only the local reference is changed, not the second reference in session.
    If you want the change to take affect, then you will have to store the new value in session with the same name:
    <% session.setAttribute("str", str); %>

  • Jsp:usebean How to get value of an object from a bean

    I am new to JSP and am struggling from past few days to solve a problem. Consider the below scenario
    Class Book{
    private String author;
    public void setAuthor(String author)
    public String getAuthor(){
    return author; }
    Class Rack{
    private Book []books;
    public []Book getbooks()
    return books;
    public void setbooks([]Book val){....}
    Suppose Books gets populated only using Rack and I have Rack populate in my session, using jsp:usebean or any other tag how can I get value of author? Does using tag handle null value check of books, if books are not set by any chance?
    Regards,
    Dhyan

    I got a way out to access the attribute, i feel it is
    <jsp:usebean id="myRack" class="settings.Rack"/>
    <c:foreach var="book" item="myRack.books">
    </c:foreach>
    I am not able to check if this is correct or not because myRack.books is not having any value set by me in the request scope. How do i get instance of Rack class set by another page in the current request? I can get the value if i use scriptlet but i dont want to use scriptlet.
    I am continiously trying, if I get an answer, I shall post, else pls somebody guide.

  • Why do we need jsp:useBean???

    Hi All,
    I am going over both the J2EE tutorial and JSP1.2 spec.
    As far as I read, it seems to me that "jsp:useBean" is a way of creating a bean object.
    <jsp:useBean id="local" scope="application" class="Mylocales">
    If I put the class file in the import statement, can I create the object in the scriptlet
    <% Mylocales local = new Mylocales(); %>
    and set/get properties by calling
    local.setName(); // assume these methods are in the class
    local.getName();
    without using "jsp:setProperty" and "jsp:getProperty".In this way, isn't it a redundancy to have "jsp:useBean" in JSP spec? We can always create any kind of objects in the scriptlets.
    Since "jsp:useBean" has been there for years, I believe something must be wrong with my rationale. However, both the spec and the tutorial couldn't answer this question. Can anyone clear it up to me?
    Thx in advance.
    Kevin

    There's nothing wrong with your rationale; useBean IS a redundant tag, but it does provide some compact functionality without having to write extra code.
    http://java.sun.com/products/jsp/tags/11/syntaxref1115.html covers the syntax of this tag; one advantage of using this tag is the 'scope' attribute, that allows you to define, at object creation, just how long the object will be around. You can limit an object's scope to the page that declared it, or allow it to be accessed by any page that shares the same session, or request, or application.
    I do believe that the main point of this tag comes in at the design level; one of the strongest reasons to use JSPs at all is to separate out the application logic from the page presentation. This means that anyone who can use HTML should be able to maintain the JSP pages in the application. Instead of having to teach a non-programmer a little bit of code, just demonstrate the use of a single tag that can be reused throughout the application. The logical extension of this idea is the tag library.
    Myself, I mix and match as needed, but there are never more than a few lines of scriptlet code in my JSP pages. If there's more code than HTML in my JSP page, I'll go ahead and use a servlet instead.
    Anyway, I guess my point is that JSP pages are flexible, you can pick the functionality that you want to use, and the useBean tag isn't quite superfluous.

  • jsp: useBean.. and c: coding

    I am trying to understand this coding.
    1. What does the <jsp: useBean .. class="coreservlets.ShoppingCart"> mean? Are we bringing in the content of the ShoppingCart class?
    If we use <% import="coreserlets.*"> at the top of JSP, wouldn't this work to apply all the class in the application?
    2.What is the <c:> coding? I have never seen this before (I am pretty new with Java). Is this new version of Java?
    Thanks.
    Here is coding sample.
    <jsp:useBean id="cart" class="coreservlets.ShoppingCart" scope="session"/>
    <c:choose>
      <c:when test="${empty cart.itemsOrdered}">
        <h2><i>No items in your cart...</i></h2>
      </c:when>
      <c:otherwise>
        <table border=1 align="center">
        <tr bgcolor="#FFAD00">
          <th>Item ID</th>
          <th>Description</th>
          <th>Unit Cost</th>
          <th>Number</th>
          <th>Total Cost</th>
        </tr>
        <c:forEach var="item" items="${cart.itemsOrdered}">
           <tr>
             <td><c:out value="${item.itemID}"/></td>
             <td><c:out value="${item.shortDescription}"/></td>
             <td><fmt:formatNumber value="${item.unitCost}" type="currency"/>        
           </tr>
        </c:forEach>
        </table>
      </c:otherwise>
    </c:choose>

    I am trying to understand this coding.
    1. What does the <jsp: useBean ..
    class="coreservlets.ShoppingCart"> mean? Are we
    bringing in the content of the ShoppingCart class?You're telling the JVM that you're going to use an instance of that class.
    >
    If we use <% import="coreserlets.*"> at the top of
    JSP, wouldn't this work to apply all the class in the
    application?No, that's not what import does.
    2.What is the <c:> coding? I have never seen this
    before (I am pretty new with Java). Is this new
    version of Java?It's the JSP Standard Tag Library, or JSTL. It has core tags <c>, xml tags <xml>, formatting tags <format>, and SQL tags <sql>
    <jsp:useBean id="cart"
    class="coreservlets.ShoppingCart" scope="session"/>Looks like there's a ShoppingCart object in session scope.
    >
    Check to see if the shopping cart has items.
    c:choose>If no items, say so.
    >
    <c:when test="${empty cart.itemsOrdered}">
    <h2><i>No items in your cart...</i></h2>
    /c:when>If there are items, display them in a table.
    >
    <c:otherwise>
    <table border=1 align="center">
    <tr bgcolor="#FFAD00">
    <th>Item ID</th>
    <th>Description</th>
    <th>Unit Cost</th>
    <th>Number</th>
    <th>Total Cost</th>
    /tr>
    <c:forEach var="item"
    items="${cart.itemsOrdered}">
    <tr>
    <td><c:out value="${item.itemID}"/></td>
    <td><c:out
    value="${item.shortDescription}"/></td>
    <td><fmt:formatNumber
    value="${item.unitCost}" type="currency"/>
    </tr>
    c:forEach>
    </table>
    c:otherwise>
    </c:choose>
    If you're new to Java, best to learn the base language before tackling JSPs.
    %

  • Jsp:useBean gives cannot be resolved to a type in Tomcat

    Hi, I am using Tomcat 5.5
    I have a simple JavaBean for test purposes :
    import java.io.Serializable;
        public class testBean implements Serializable {
            int number;
            public testBean() {
            public int getNumber() {
                return number;
            public void setNumber(int newValue) {
                number = newValue;
        }In a file called testBean.java
    I have successfuly compiled it and put the class file the WEB-INF/classes directory.
    I have the following JSP page :
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <jsp:useBean id="pub" scope="session" class="testBean" />
    <jsp:setProperty name="pub" property="number" value="1" />
    <html>
    <head>
    </head>
    <body>
    <jsp:getProperty name="pub" property="number" />
    </body>
    </html>When I open this jsp page I get the following error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 2 in the jsp file: /test.jsp
    Generated servlet error:
    testBean cannot be resolved to a typeThis example is pretty minimal and I don't understand why it doesn't work. The error seems to be coming from the first JSP statement.
    Any help would be greatly appreciated.
    Thanks in advance.

    1. Put your bean class in a package.
    package test;
    import...........2. Put the .class file in web-inf/classes/test/testBean.class
    3. Specify the fully qualified name of the class in the useBean declaration.
    <jsp:useBean class="test.testBean" .../>Note: You'd be better off following the java bean naming conventions. Specifically your class name should be TestBean (first letter caps).
    ram.

  • Jsp:useBean vs page import in JSP

    Hi,
    What is the difference between jsp:useBean vs page import in JSP?
    By using page import also I can call the method of the class, apart from jsp:useBean does have scope associated with it. I don't think there is any change between both the 2. Yes by using jsp:useBean we can set the property and get the property as well.
    Is there any major differences between the 2 and when to use which ? Please clarify.
    Thanks.

    797836 wrote:
    Hi,
    What is the difference between jsp:useBean vs page import in JSP?
    By using page import also I can call the method of the class, apart from jsp:useBean does have scope associated with it. I don't think there is any change between both the 2. Yes by using jsp:useBean we can set the property and get the property as well.
    Is there any major differences between the 2 and when to use which ? Please clarify.
    Thanks.Yes there is a difference.
    If you use import, then you have to create/use the reference object to use the class methods. And you can't define the scopes like session, page .. etc. Apart from this you will be using scriptlets <% %>.
    if you are using jsp:useBean , then you can skip the above activities. useBean takes care of it.
    or you can say jsp has provided a utility to access the beans without creating its object or using scriptlets.

  • Calling an inner class in a jsp:usebean tag

    Hi everybody !
    Here's my problem : working in my project on multiple pages, I'm using inner classes/beans to limitate my '.java' files but I'm stuck when calling that 'inner-bean' in my jsp:usebean tag.
    First, I tried to declare in the class parameter : 'class="MyPrincipalBean.theInnerBean" but jsp returns me a 'not found' message.
    I tried an other issue with this :
    'class="MyPrincipalBean$theInnerBean" but I encountered a 'Attempt to use a bean type without a void constructor in jsp:useBean tag (JSP 1.1 specification, 2.13.1)'. Since I can't find that specification, I'm sending an SOS.
    Am I on the good way ? If somebody as encoutered that sort of problem, it would be very kind of you to help me.
    Thanks for your help !
    [email protected]

    Thanks for your help!
    I must recognize that my explainations weren't really precise.
    My principal bean owns a table of my inner-class type :
    public class FirstBean extends EntityBean {
    private SecondBean[] tabSB;
    public SecondBean[] getTabSB() {...}
    public void setTabSB(SecondBean[] p_tabSB) {...}
    public class SecondBean {...}
    So I can call a specific bean from the tab in my Servlet for another page.
    But I think I have the solution and I need your advise :
    I tried this :
    <jsp:useBean id="FirstBean" class="<...>.FirstBean" scope="session" />
    <jsp:useBean id="SecBean" beanName="<...>.FirstBean$SecondBean" type="<...>.FirstBean$SecondBean" scope="request" />
    And would you believe it ? It seems to work ! But I have to test this farther to be sure. What do you think of it ?

  • Need help on jsp:useBean

    My JSP code that calls the bean is as follows:
    <%@ page import ="java.sql.*" %>
    <%! String loginId, logPassword; %>
    <% loginId=request.getParameter("LoginId");
         logPassword=request.getParameter ("LogPassword");%>
    <jsp:useBean id="simpleCon" scope="session" class="OSA_Java.SimpleConnection">
    <jsp:setProperty name="simpleCon" property="driver"
    value="sun.jdbc.odbc.JdbcOdbcDriver"/>
    <jsp:setProperty name="simpleCon" property="url" value="jdbc:odbc:OSA"/>
    <jsp:setProperty name="simpleCon" property="username" value=""/>
    <jsp:setProperty name="simpleCon" property="password" value=""/>
    </jsp:useBean>
    <%! Connection conObj; %>
    <% conObj=simpleCon.getCon();%>
    <% if ( conObj == null)
         { out.println ("Connection failed");return; }
    %>
    <jsp:useBean id="loginBean" scope="session" class="OSA_Java.LoginBean">
    <jsp:setProperty name="loginBean" property="con" value="<%=conObj%>"/>
    <jsp:setProperty name="loginBean" property="loginId" value="<%=loginId%>"/>
    <jsp:setProperty name="loginBean" property="logPassword" value="<%=logPassword%>"/>
    <jsp:setProperty name="loginBean" property="*" />
    </jsp:useBean>
    <html>
    <head>
    <title>Customer Orders</title>
    <h4><center>Customer Orders</center> </h4>
    </head>
    <body>
    <%
         String loginResults = loginBean.getCustomerName();
         if (loginResults != null)
              out.println ("Hello " + loginResults + "!! Welcome to this site" );
    %>
    <pre>
         Place Orders Track
    Orders Report Defects/Changes
    </pre>
    <% }
         else { %> 
              <%= "Error!!! Invalid User Name/Password" %>
              <%@ include file="Login.htm" %>
         <% } %>
    </p>
    <p>
    </p>
    <p>
    </p>
    <p>
    </p>
    </body>
    </html>
    My bean code for SimpleConnection is as follows:
    package OSA_Java;
    import java.sql.*;
    public class SimpleConnection
         public String driver, url, username, password;
         public String loginId,logPassword;
         public Connection con;
         public SimpleConnection () {}
         public void setDriver (String driver)
              this.driver = driver;
         public String getDriver ()
              return driver;
         public void setUrl (String url)
              this.url = url;
         public String getUrl ()
              return url;
         public void setUsername (String userName)
              this.username = username;
         public String getUsername ()
              return username;
         public void setPassword (String password)
              this.password = password;
         public String getPassword ()
              return password;
         public void setLoginId (String loginId)
              this.loginId = loginId;
         public String getLoginId ()
              return loginId;
         public void setLogPassword (String logPassword)
                   this.logPassword = logPassword;
              public String getLogPassword ()
                   return logPassword;
         public void setCon (Connection con)
              this.con = con;
         public Connection getCon ()
              System.out.println ("in get Con url" + con + " driver " + driver);
              if ( con == null) // Connect, if not already connected
                   try
                        //Load database driver.
                        Class.forName (driver);
                        // Establish network connection to database
                        System.out.println(driver);
                        con= DriverManager.getConnection (url, username, password);
                        System.out.println("in get url" + url);
                   } catch(Exception e)
                        System.out.println("in get Con" + e);
                   System.out.println("returning con" + con);
                   return con;
    When I load the JSP file, it prints a message "connection failed".
    and no message from SimpleConnection is printed on the server.
    Thanks
    newtojsp

    <jsp:useBean id="simpleCon" scope="session" class="OSA_Java.SimpleConnection">
    <jsp:setProperty name="simpleCon" property="driver"
    value="sun.jdbc.odbc.JdbcOdbcDriver"/>
    <jsp:setProperty name="simpleCon" property="url" value="jdbc:odbc:OSA"/>
    <jsp:setProperty name="simpleCon" property="username" value=""/>
    <jsp:setProperty name="simpleCon" property="password" value=""/>
    </jsp:useBean>
    Where is your .class file from the bean? Is it under /WEB-INF/classes/OSA_Java/SimpleConnection.class?

  • Not getting sets for jsp:useBean bean when in request scope

    I have a JSF (JSP) page in which I have a bean that I declare using jsp:useBean.
    The bean implements Map. I have a h:inputText and an h:inputHidden with a value referencing the bean.
    The odd thing is that if in jsp:useBean, I set the scope to session, everything works as I expect. However, if I change the scope to request, the put method on the bean never gets called.
    Can anyone explain why this is happening?
    Thanks,
    ken clark

    Yes, I understand that old data I had is gone -- that is fine, I expect that.
    My question is, why do I not get calls on the put method of my Map implementation when the screen is submitted? (I have a breakpoint in the method in the debugger, so I know when I get hit.)
    If the scope is session, I get put calls (yes, the old data is there, it gets overwritten).
    If the scope is request though, I simply never see the calls made at all, and my application errors out for lack of data.

  • JSP:useBean in Tomcat with external libraries

    Hi!
    I would like to use netbeans 4.1 for developing jsp-pages, but are facing a problem when trying to use the built-in jsp compiler.
    in my code I use something like:
    <jsp:useBean id="id" class="package.Classname" scope="application" />while package is an external package initially created from JAXB. To include it into netbeans, I have put the directory containing all the classes into the build libraries and also into the test libraries. In the 'Projects'-Explorer it shows all the classes contained.
    When I try to run the jsp-File, I get an error like this:
    Compiling 1 source file to C:\Develop\ApplicationDescriptionGenerator\build\generated\classes
    C:\Develop\ApplicationDescriptionGenerator\build\generated\src\org\apache\jsp\general_jsp.java:48: cannot find symbol
    symbol: class Classname
    location packageI do not understand this behaviour, especially, as the 'web' folder created by netbeans includes all necessary classes, and when I copy it to my tomcat installation, it works fine.
    Does anybody know, what I have to change, so that I can test it from inside netbeans?
    Thanks a lot!

    Here is the java program or bean class that I'm using, UserData.java compiled into UserData.class:
    public class UserData {
    String username;
    String email;
    int age;
    public void setUsername( String value )
    username = value;
    public void setEmail( String value )
    email = value;
    public void setAge( int value )
    age = value;
    public String getUsername() { return username; }
    public String getEmail() { return email; }
    public int getAge() { return age; }
    To put the data into the session, I used the following form:
    <HTML>
    <BODY>
    <FORM METHOD=POST ACTION="SaveName.jsp">
    What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
    What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
    What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
    <P><INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>
    and SaveName.jsp is this:
    <jsp:useBean id="user" class="UserData" scope="session"/>
    <jsp:setProperty name="user" property="*"/>
    <HTML>
    <BODY>
    Continue
    </BODY>
    </HTML>

  • Why do you use jsp:useBean?

    Hi,
    I have one "simple" question :) : When or why do you are using <jsp:useBean>,<jsp:getProperty> and <jsp:setProperty>?
    For practice, I am creating a form, sends the data to a servlet and the servlet "packs" the parameter into a Bean and put this Bean into a request- or SessionScope. After that, my resultpage could access the property name of the bean with (for instance) sessionScope.Bean.name.
    I wanted to use the 3 tags above first, but after I realised the way I describes above I didn't have to use these three jsp tags. Therefore I wonder when you are using these tags.
    Thnx
    Alex

    hi
    The component model for JSP technology is based on JavaBeans component architecture. JavaBeans components are nothing but Java objects which follow a well-defined design/naming pattern: the bean encapsulates its properties by declaring them private and provides public accessor (getter/setter) methods for reading and modifying their values.
    Before you can access a bean within a JSP page, it is necessary to identify the bean and obtain a reference to it. The <jsp:useBean> tag tries to obtain a reference to an existing instance using the specified id and scope, as the bean may have been previously created and placed into the session or application scope from within a different JSP page. The bean is newly instantiated using the Java class name specified through the class attribute only if a reference was not obtained from the specified scope. Consider the tag:
    sun site

  • Unable to use jsp:useBean tag

    when I use
    <jsp:useBean id="addressBean" class="AddressBean" scope="session"/>
    I get the following error
    Exception Details: org.apache.jasper.JasperException
    Unable to compile class for JSP No Java compiler was found to compile the generated source for the JSP. This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK to the common/lib directory of the Tomcat server, followed by a Tomcat restart. If using an alternate Java compiler, please check its installation and access path.
    So my question is how to use the <jsp:useBean> tag in JSC

    Please see my message How to set developer's mode for oracle jsp engine.
    As a very early warning of the future, this way of setting configuration paramemter in web.xml for oracle jsp engine will be deprecated in the next major version of oc4j and desupported probably later on. Yes, it is still supported in 10.1.3 and the next major version, though.

  • Jsp:useBean scope!!!!

    If you declare
    <jsp:useBean id="test" scope="session" class="test" />
    how can you release the session when you finish using the class???
    or what is the ideal scope to used in send and response???
    for example...
    page A:
    input form
    page B:
    process form
    page C:
    success process form...
    user fill in input and press submit
    page A send information to page B to process
    if page B encounter error
    responde back to page A with the current value input
    else
    send to page C inform user the successed process....
    what scope should i use???
    i cant use scope="page" cause the amount of field is too much...
    is there a way to destroy the scope declared if i used session???
    help!!!!!!
    programmer in BIG Distress!!!! :~(

    maybe you should declare like below:
    <jsp:useBean id="test" scope="request" class="test" />

  • jsp:useBean  class="  expression "   .......

    I need to put the class value of the <jsp:useBean> and take it from a java class on the server.
    I use a method with this signature:
    public String getClassname(...){
    return newclass.toString();
    and put it in the jsp element like:
    <jsp:useBean id="bean1" scope="session" class="<%=utility.getClassName()%>" />
    It does not work while had never problems with a forward element instead like this:
    <jsp:forward page="<%=util.getPage()%>" />
    Did somebody suceed or any suggestions?
    best regards
    Joan

    thanks gray man.
    the
    beanName="=<% classfactory.getHandler()%>"
    inserted in a usebean tag compiles
    but when i call a
    <jsp:setProperty name="bean" property="*"/>
    on this bean I find that all the values are set empty
    like if it is the parent class that gets called and not
    the real subclass that I am casting to with the dynamic
    beanName="=<% classfactory.getHandler()%>" .
    Not found a solution yet wether casting to an interface
    or to a superclass.

Maybe you are looking for

  • Customer Opening Or Closing Balances

    Moderator message: do not offer points Hi, Can anybody tell me the Table or T.code where the Customer Opening/Closing Balances are maintained. <<Text removed>> Thanks. Kamal Edited by: Matt on Nov 22, 2008 6:04 PM

  • Frozen image with video out to HDMI

    I have my iMac connected via an HDMI adaptor through a 10' HDMI cable into a Hi Def TV. It was working well but suddenly froze with an image that happened to be a photo from iPhoto. That image remains whenever the cable is connected into the TV. When

  • Tabs in a list

    I frequently use lists within documents, e.g. writing an exam using a format like the following: 1. --- question --- multiple lines used for long questions . a. choice 1 . b. choice 2 etc. I use shift-enter to go to an additional line within the same

  • How to transfer Painter 12 with my custom brushes from old iMac to a new iMac both running Mavericks

    Hi, I just purchased a new iMac. Have Painter 12 on my older iMac and want to be able to transfer Painter 12, with my custom brushes to my new iMac. Tried Airdrop but got a message that it was damaged and that I should trash it. Does any know how to

  • Can't play a track that I downloaded from iTunes.

    I just downloaded an audiobook from iTunes. For some reason I'm not able to play the third track. It won't sync to my iPod either. The error that I get when I try to add it to my iPod is: "Track Name" was not copied to the iPod "Jack's iPod" because