Is this true about jsp:usebean?

Hi, let me explain this.....i have a Jsp, a business class and a business entity (Country)
Let's say that the business class connects to a database and retrieve some information (List of Countries with all their attributes)...so the business class instanciates a business entity (Country) with the variable "entityCountry" and encapsulates the information retrieved in the "entityCountry". Then in my JSP i want to display a list of countries....so i use
<jsp:usebean id="entityCountry" scope="session" class="Country"/>This catches the object, the business class previously instanciated, with all the information it was retrieved from the database? it doesn't create another object with null attributes? is it the same??

As described [url http://java.sun.com/products/jsp/syntax/1.2/syntaxref1217.html#8865]here
If the attribute is found in session scope, then it uses the value already created.
If it is not found, then it instantiates a new instance.
This code in a JSP
<jsp:usebean id="entityCountry" scope="session" class="Country"/>
translates to approximately this java code
Country entityCountry = session.getAttribute("entityCountry");
if (entityCountry == null) {
  entityCountry = new Country();
}

Similar Messages

  • Is this true about PS2 devices?

    I just got a new computer. I don't know a lot about hardware, etc.
    The Mainboard I got is an MSI K8N Neo4 S 939
    My PS2 devices are not working and the guy who sold me the computer told me that by unplugging the mouse and keyboard while the system was running, I may have shorted out the board.
    Is this true?

    Quote from: MGP on 18-December-05, 13:04:44
    It is possible that you shorted the keyboard controller, generally you can hot swap keyboard and mouse but some MB like the NEO versions are very sensitive to 
    I take it by your post that none of your PS2 ports are working, if this is the case then I would guess that the PS2 controller on the MB is shot.
    So... if I have indeed shot my PS2 controller on the MB, what can be done? Is this repairable? Do you think it could potentially cause other problems for me? I am using USB devices now but am concerned about future problems due to this happening.
    Also, do you think this should be covered under the 1 year warranty the shop gave me?
    Thanks,
    Charles

  • Is this true about iPhone vibrate feature?

    Is it true if you keep putting the virbate off and on it will break or ruin the vibrate in your iPhone?? Is this true? So if I turn it off and on like 4 times in a row will I break my iphone or iphone virbate motor or whatever?????
    THANKS for the help!

    Is it true if you keep putting the virbate off and on it will break
    So if I turn it off and on like 4 times in a row ... or whatever?????
    If you really mean compulsively flipping the switch, all hardware switches have a finite lifetime designed for rational use and you may eventually break it.

  • Is this true about Trade Ins?

    I called my local Best Buy and the rep told me that the trade in phone had to be originally purchased at Best Buy?  Does anyone know if this is true?

    Hello BRIVAEH226-
    There are city, county and state regulations that do control what we can take as a trade-in.  In some situations, we are required by those regulations to only take trade-ins that can be validated as purchased in a Best Buy store by the customer producing a Best Buy receipt.
    This is why all of our trade-in promotions as well as our Limitations and Restrictions of our trade-in program here call out that some stores may have additional limitations that prevent a trade-in.  Your local store should be able to provide you with more information around any particular regulations that they have to follow.
    Bill|Senior Social Media Specialist | Best Buy® Corporate
     Private Message

  • Is this true about installation disks??

    Is it true that certian OS cd's can only be loaded onto certain Mac's? Ex. Like a installation disk from a emac wont work on a powermac? What do the codes on the disks mean when it says "disk 1" and "disk 2" etc? I aquired a 2002 powermac G4 quicksilver and need to reinstall but dont have the disks. How will I be able to tell which installation disks to buy If i'm looking to install Tiger??
    -Thanks for your help

    funylinks2004, welcome to Apple Discussions.
    Tiger install DVDs are in short supply. Tiger is no longer available at the Apple Store but is still available for $129 by calling Apple Phone Sales @ 1-800-MY-APPLE (1-800-692-7753). For other sources, do a Google search for MA453Z/A and M9639Z/A . Also look on eBay. Be sure & buy a retail version (black with silver X) and not a model specific version (gray).
    Also check this web store http://www.lacomputercompany.com/cgi-bin/rpcart/index.cgi?command=dispitem&type= sku&sku=19521
     Cheers, Tom

  • Is this true about 4g?

    Since i got my TB, i can tether for free with my $29.99 unlimited plan and 4g?

    kyoakuma wrote:
    Since i got my TB, i can tether for free with my $29.99 unlimited plan and 4g?
    You can use it as a hotspot free until May 15th.

  • Need help with the jsp:useBean tag

    Dear Fellow Java/JSP developers:
    I am trying to use the <jsp:useBean> tag in a jsp that displays the values from a javaBean that gets populated by another class.
    <%@ page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ page import = "java.util.ArrayList"%>
    <%@ page import = "java.util.Iterator"%>
    <%@ page import = "salattimes.CalendarParse" %>
    <%@ page import = "salattimes.Salat" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
            <jsp:useBean id="test" scope="session" class="calendar.Time" />
            <% CalendarParse sTime = new CalendarParse();
                Time mytime = sTime.runExample();%>
            <%=mytime.getA() %>
            <%=mytime.getB() %>
            <%=mytime.getC() %>
            <%=mytime.getD() %>
            <%=mytime.getE() %>
        </body>
    </html>However, up to now, I am only able to display the values on my JSP page using the scriptlet
    <% CalendarParse sTime = new CalendarParse();
                Time mytime = sTime.runExample();%> to declare and create the object (the method call sTime.runExample(); populates the fields in the Java Bean), and the expressions:
    <%=mytime.getA() %>
             <%=mytime.getB() %>
             <%=mytime.getC() %>
             <%=mytime.getD() %>
             <%=mytime.getE() %>to present the values on the screen. What I would like to do is assign the object that I create to a javaBean reference declared in a <jsp:useBean> tag as follows:
    <jsp:useBean id="test" scope="session" class="calendar.Time" />
            <% CalendarParse sTime = new CalendarParse();
                test = sTime.runExample();%>and then present the values stored in the bean to the JSP page as follows:
    <jsp:getProperty name="test" property="a" />
            <jsp:getProperty name="test" property="b" />
            <jsp:getProperty name="test" property="c" />
            <jsp:getProperty name="test" property="d" />
            <jsp:getProperty name="test" property="e" />
            <jsp:getProperty name="test" property="f" />Is this possible? When I try the above, I get "null" as my output on the screen. When I try the first approach listed above, I get the values I am looking for. Is there a way to accomplish this using the <jsp:useBean> approach?
    Thanks to all those who reply.
    Sincerely;
    Fayyaz

    The code:
    <jsp:useBean id="calendar" class="calendar.CalendarParse" scope="session"/>
    <c:set var="time" value="${calendar.time}"/>Would be roughly equivalant to:
    calendar.CalendarParse calendar = new calendar.CalendarParse();
    Object time = calendar.getTime();I assumed that the CalendarParse object was in the calendar package because that was were your Time class was (when you used <jsp:useBean id="test" scope="session" class="calendar.Time" />"), but when I look back at your original post I see I was wrong and the use of calendar as both the incorrect package and the variable name was confusing. To make the code more similar to your original post the code should have read:
    <jsp:useBean id="sTime" class="salattimes.CalendarParse"/>
    <c:set var="myTime" value="${sTime.time}" scope="session"/>
    ${myTime.a}
    ${myTime.b}
    ${myTime.c}
    etc...Here is an explanation of the parts:
             /* name of the variable */  /* fully qualified class name, package.className */
    <jsp:useBean id="sTime"           class="salattimes.CalendarParse"/>
      /* name of the new object from bean */  /* source of object, variable.property */    /* Scope of new object */
    <c:set var="myTime"              value="${sTime.time}"             scope="session"/>
    /* data to display variable.property */
    ${myTime.a}Where a 'property' in a bean is defined as a method in the form of getProperty(). So the 'time' property is getTime() and the 'a' property is getA().

  • I recently had my computer stolen and not my purchases from I tunes store were backed up. I've been told there is a way that I can re-download my missing tracks from the store without having to pay for them again. Is this true, if so, how do go about it.

    I recently had my computer stolen and not my purchases from I tunes store were backed up. I've been told there is a way that I can re-download my missing tracks from the store without having to pay for them again. Is this true, if so, how do go about it.
    Many thanks
    Arkadi de Rakoff

    Unfortunately, redownloading of past music purchases isa still in beta test and only available in the US right now.
    It's due for everyone this fall.  Downloading past purchases from the App Store, iBookstore, and iTunes Store, http://support.apple.com/kb/HT2519
    If you can't wait, contact the iTunes Store Support Team at this link
    If you get lucky, they may be able to authorize another download now.

  • I just heard a news report that there is a problem with malware in mac computers that came through a recent java update. Is this true? If so, what should be done about it?

    I just heard a news report that there is a problem with malware in mac computers that came through a recent java update. Is this true? If so, what should be done about it?

    As usual those "news" reports mangled the facts and got most of the story completely wrong. This particular attack did not arise through a Java update, it was distributed through a fraudulent Flash download popup window, or malicious websites that Safari is designed to block.
    If you run Java on your Mac you may be vulnerable to this malware. If you do not run Java there is no risk. If you routinely keep your Mac up to date with Software Update the risk is greatly reduced.
    Shut off the mass market junk that masquerades as "news" and read this to learn some real facts:
      https://discussions.apple.com/docs/DOC-3271

  • Question about the jsp:useBean tag

    Hi, I'm a relative newcomer to jsp, but the following piece of javascript code has me very confused:
    <%@ page import="com.jinsoft.bank.web.*" %>
    <jsp:useBean id="account" class="AccountBean" />
    This will result in java.lang.ClassNotFoundException, and it complains that AccountBean cannot be found.
    However, when I fully qualify the class, it works:
    <%@ page import="com.jinsoft.bank.web.*" %>
    <jsp:useBean id="account" class="com.jinsoft.bank.web.AccountBean" />
    Am I doing something wrong?
    Isn't the import tag supposed to help?
    Thanks for any help!

    Hi Kim
    I'm really interested in the particular error that you are generating. I tried this out using Tomcat 3.2.3 and it doesn't seem to be a problem. What application Server are you using?
    Another way to find out if the problem is with the Application Server is to check the .java file that is created out of the jsp page before it is compiled. Individual Application servers have different ways of storing this intermediate .java file but most of them keep it if the compilation does not succeed.
    You may possibly have to file a bug if everything else checks out fine. Another point, are you able to import the same bean into a Servlet and use it there?
    Keep us posted.
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems inc
    http://www.sun.com/developers/support

  • Jsp:useBean giving error while compiling JSP's in JDeveloper

    Hello,
    I am having another problem with JSP's in JDeveloper 10.1.3. jsp:useBean and jsp:setProperty are all giving problems. I am not sure what I need to do to get rid of this error
    Thanks,
    Lakshmisri

    Your original post mentions issues with jsp:useBean and jsp:setProperty, now you're talking about tag libraries and directives. Can you be more specific about what you're trying to do? Are you having problems getting JDev to recognize a tag library or are you having problems with the tag library when running the app? What directive are you trying to use that causes the termination error?

  • The element type jsp:useBean must be terminated by the matching end-tag

    Hi, I have deployed an application under WLS 8.1 SP4 and I get this error, when I try to access a page. I searched through the BEA site and it does refer to solution id S-13709 which says issue has been fixed in WLS 7.0. Hence should I not be seeing this error?
              java.io.IOException: javax.servlet.jsp.JspException: The taglib validator rejected the page: "org.xml.sax.SAXParseException: The element type "jsp:useBean" must be terminated by the matching end-tag "</jsp:useBean>"., "

    It would be useful if you provided a little more information about what you're trying to do on your JSP page. For instance, are you using an include directive or include action on the page? Are you trying to start the "jsp:useBean" element in one file, and end it in another? That, in particular, would likely be rejected.

  • jsp:useBean... didn't create new bean?

    According to tutorial or specification (in my perception),
    the following tag will create a new bean if it doesn't
    exist:
        <jsp:useBean id="prodDetail"
            class="mycomp.model.ProductDetail"
            scope="request" />Say I put the tag in Product.jsp, and it is an entry form
    for insert and update a new product. For insert, I intend
    to access Product.jsp directly from browser. For update,
    I have clients to access a servlet that in turn, will
    dispatch {[Product.jsp + prodDetail to be updated)}.
    There was no problem with update, however, for insert
    (directly access Product.jsp via url), I got this exception.
    I am using Tomcat, and I wonder whether it's a "Java error"
    or "Tomcat error".
    Any help would be appreciated. Thanks...
    javax.servlet.ServletException
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
         at _0002fProduct_0002ejspProduct_jsp_0._jspService(_0002fProduct_0002ejspProduct_jsp_0.java:187)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    ...etc...
    Root cause:
    java.lang.NullPointerException
         at _0002fProduct_0002ejspProduct_jsp_0._jspService(_0002fProduct_0002ejspProduct_jsp_0.java:112)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
    ...etc...

    Whoops, sorry, I made a silly silly mistake, apparently
    there was an extra scriplet <% } %> I forgot to delete.
    It's works now....
    I figured that out when I was composing following posting
    about snipplet of the JSP..., so I guess this "embarassing"
    posting does help me too...., in a short time :D

  • Why use jsp:useBean?

    I got the below sample code in sun document. Here bookId is passed as a parameter in cart.remove method and sql query. I want to know why the statement "<jsp:useBean id="bookId" type="java.lang.String" /> " is used.
    <c:set var="bookId" value="${param.Remove}"/>
    <jsp:useBean id="bookId" type="java.lang.String" />
    <% cart.remove(bookId); %>
    <sql:query var="books"
    dataSource="${applicationScope.bookDS}">
    select * from PUBLIC.books where id = ?
    <sql:param value="${bookId}" />
    </sql:query>
    thanks,
    Vinodh

    The useBean tag has a side effect of creating a local scriptlet variable with the id "bookId"
    This variable is then used on the next line in the scriptlet code.
    In effect, it is executing the following code
    <c:set var="bookId" value="${param.Remove}"/>
    <%
    String bookId = (String)pageContext.findAttribute("bookId");
    cart.remove(bookId); %>which if you think about it, you could get rid of the <c:set> and have the scriptlet code access the variable directly.
    <%
    String bookId = request.getParameter("Remove");
    cart.remove(bookId); %>Mixing scriptlet and JSTL code in this fashion gets confusing.
    The scriptlet code here is part of the 1% of code that can't be replaced directly by JSTL (but could be replaced by a custom function/tag)
    However it more probably belongs in a servlet/bean.

  • This is about a game application!

    hi everybody, my name is Mario, i'm from Colombia, I'm studying electronic engenering and i'm doing my final project, it's about a bingo game for three players througt a telephone (obviusly everyoone has a phone) , using technologies like VXML, java and jsp, i'm really a newbie in this and i'm stucked!!!! about two things and maybe anyone can help me out!!! plez, how could i send the same page to these three users who before have submitted the valid card, not individualy, i mean, they before have to login the number of the bingo card before playing the game ( it just for validing the cards) but i need to show the same page (jsp) to them when the three users have valided their cards, automatically they get to the same page for starting to play, like a brocasting...!! that is beacuse they have to watch the same balls at the same time, like a bongo game... is that possible on jsp? the second one is, i also want to refresh only a part of that page ( beacuse i'm using a javabean that shows the balls that are created before and stored my DataBase !!! i have read about this is possible with ajax but it doesn't work in my JSP pages!!! what do i have to do ???? i have to include a special code on my jsp?? i just want to refresh a "div" beacuse before this code ( that gets the new balls) i have to put before a javabean that creates the balls and put them into my database (mysql) and if it refreshes again all the page with the tag "<meta content = "refresh".... >" it will create again the new balls anytime it refreshes the page just for getting the new ball, that is beacuse i have to refresh only a part of that page... just for getting a new ball... i'm attaching the jsp... it just the part that shows the balls, pplez help me out about these 2 things...
    <?xml version = "1.0"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <!-- BingoBalotas.jsp -->
    <%-- configuraci�n de p�gina --%>
    <%@ page errorPage = "PaginaError.jsp" %>
    <%@ page import = "java.util.*" %>
    <%@ page import = "beans.*" %>
    <%-- beans utilizados en esta JSP --%>
    <jsp:useBean id = "Balotica" scope = "page" class = "beans.BeanBalotas" />
    <html xmlns = "http://www.w3.org/1999/xhtml">
    <head>
    <s:head theme="ajax"/> 
    <s:url value="BingoBalotas.action">
        <s:param name="id" value="%{refpart}" />
    </s:url>
         <title>Bingo Interactivo Telefonico (JSP) </title>
       </style>
    </head>
    <body>
    /* it starts my div for refreshing this part */  
    <s:div theme="ajax" href="%{refpart}" updateFreq="5000" delay="0">
    <p class = "grande">Balota # </p>
              <tr>
         <td style = "background-color: black";>
              <p class = "grande" sytle = "color: cyan;">
              <% if(Balotica.getI()>10){ %>     
              fin de juego
              <%} else {%>
                   <%= Balotica.getBalotaa() %>  <---- this part gets the balls :) (there are 10 ones)
                   <%= Balotica.getI()%>
              <%} %>
         </s:div>
          </p>
             </td>
             </tr>
    </body>
    </html>plez help me out, i have googled but i didnt found anything yet for solve these things... i really aprecciate any information, about what i have to read or do...
    best regards...
    thanks in avance, and sorry for my english
    Mario
    grettings from Colombia.

    thanks for your response roaminggnome. I changed my password immediately after it happened and I have contacted i tunes to let them know of this dillemma.
    The I-tunes credit was a promotional thing by Apple to buy their laptop. So I didn't pay for the i-tunes credit in the first place. Do you think my bank will be able to reinburse Itunes credit then? I will ask support when they get back to me.

Maybe you are looking for

  • ITunes won't open  at all... only error messages

    hey guys, no idea what's going on with my iTunes its really annoying though here's the scoop i got a lot of bad crap on my comp. so i had it formatted by a guy at work came home installed itunes opened it up it worked great all the sudden it closes i

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code. 1. Excel File is on My PC. 2. And I want to write a Stored Procedure or Package to do that. 3. DataBase is on Other Server. Client-Server Environment. 4. I am Using Toad or PlSql

  • Change posting period

    Hello all, I am trying to to the good issue and system display tis message: <i>"Posting only possible in periods 2004/08 and 2004/07 in company code AB01"</i> What should I do. I am not FI then I need very detailed information. Many thanks, Barb

  • Project Server 2013: Remove Task Option Causing Orphaned Timesheet Lines

    We are experiencing a major issue with the "Remove Task" option in PS2013 that is leading to orphaned timesheet lines with no related assignment.  This can result in actuals in a project with no corresponding timesheet entry.  We are using SEM. The s

  • N73 Firmware upgrade- what changes?

    I have successfully upgraded my N73 firmware from 2.0628.0.0.1 to 3.0704.1.0.1 but nowhere on Nokia website or anywhere else can I find out what changes or improvements resulted from the upgrade. Does anyone know where to find a list of changes? TIA