How do I change or access the setProperty of useBean from the Java class?

I'm learning JSP beans. Let's say I've got this JSP:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!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>
     <h1>Hello World!</h1>
     <jsp:useBean id="b" scope="page" class="consumidor.BuscaItems">
          <jsp:setProperty name="b" property="what" value="something"/>
     </jsp:useBean>
     <p><jsp:getProperty name="b" property="what"/></p>
</body>
</html>And this BuscaItems.java class :
package consumidor;
public class BuscaItems {
     public String what="Not defined";
     //Constructor
     public BuscaItems(){
          what="THIS IS WHAT I WANT";
     public void setWhat(String a){
          what=a;
     public String getWhat(){
          return what;
}But the website returns "something" and not "THIS IS WHAT I WANT", Is this possible?

I'm sorry for my ignorance about what a constructor is. Thank you for clarifying me the things.
package consumidor;
public class BuscaItems {
     public String what="Not defined";
     //Constructor
     public BuscaItems(){
     public void setWhat(String a){
          // Imaginary process to get what I want
          String result="This is what I want";
          what=result;
     public String getWhat(){
          return what;
}

Similar Messages

  • How choose between post and get when calling a servlet from a java class ??

    Hi !!
    I have an urgent question : in fact some java programs that call servlets are published on the web, and the principle is to make an url.openconnection() to reach the servlet.
    What I don't understand is how we choose if we want to call the get or the post method on the servlet ?????
    please answer very fast.....
    thanks...

    from the URL documentation of openConnection():
    "If for the URL's protocol (such as HTTP or JAR), there exists a public, specialized URLConnection subclass belonging to one of the following packages or one of their subpackages: java.lang, java.io, java.util, java.net, the connection returned will be of that subclass. For example, for HTTP an HttpURLConnection will be returned, and for JAR a JarURLConnection will be returned."
    Obviously, in case of a http servlet, normally an instance of HttpURLConnection will be returned. If you don't change the request method, GET is the default.

  • G'day.  I am using iMovie 11 and need to clear disk space.  How can I do that using an external drive, leaving me the option to go back and make changes or access old events or projects from that external drive?

    G'day.  I am using iMovie 11 and need to clear disk space.  How can I do that using an external drive, leaving me the option to go back and make changes or access old events or projects from that external drive?

    The slightly bigger question is whether you want to move all movie content to the external drive (essentially meaning that drive will always need to be attached when you're working with your videos), or whether you just want to archive older videos off to the external drive.
    If you want to move all videos, then just move the 'Movies' folder in your home directory to the external drive, then create an alias of the external 'Movies' back in to your home directory. Now the 'Movies' icon in your home directory will point to the external drive and everything will just work (as long as the external drive is attached when you launch iMovie)
    If you want to archive older movies then each Movie should have its own subdirectory within your Movies folder. These can easily be moved off to the external drive, and moved back should you ever need to work on those movies again.

  • How and where do I access the most recent backup of my iTouch's calendar PRIOR to my auto-sync?

    How and where do I access the most recent backup of my iTouch's calendar -- prior to the recent auto-sync which lost 5 yrs. of info. on my calendar? I want to retrieve it.

    All you can do is restore from backup. To do that see the restore topic of:
    iOS: How to back up
    Also, turn off autosyncing so that when you reconnect the iPod to yuor computer the old backup does not get overwritten . To turn off go iTunes>Preferences>Devices and check the box that says "Prevent iPods...".
    iTunes only retains the most recent backup and updates it with the changes.

  • Can someone plz confirm me that how i can change or update the security questions related to my apple id? as i have been never put them since i create my apple id but now due to some security reasons its asking me again and again the answers. i am unable

    can someone plz confirm me that how i can change or update the security questions related to my apple id? as i have been never put them since i create my apple id but now due to some security reasons its asking me again and again the answers. i am unable to go through the process. thanks.

    Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities

  • I have two iPhones and an iPad under same Apple ID. How can I change one of the iPhones to a separate id?

    I have 2 iPhones &amp; an iPad under 1 Apple ID. How can I change 1 of the iPhones to a separate account?

    Sign out of the Apple ID on the device in question, making sure to disable the Find My iDevice feature.
    Sign in with the new Apple ID.
    If the intent is to sell the device, simply restore as new after disabling the Find My iDevice and signing out.

  • HT204053 I bought the iPhone 5 today.  I have 2 apple IDs.  I entered the wrong one when I set up the phone.  How can I change it to the other ID?

    I bought the iPhone 5 today.  I have 2 apple IDs and I entered the wrong one when I set up the phone.  How can I change it to the other one?

    Start Over...
    ERASE / Clear All Data
    See  Erase your device  Here  >  http://support.apple.com/kb/HT4137
    Go to Settings > General > Reset > Erase all content and settings

  • The app store on my laptop is asking for my husband's apple id and password to update my apps, but he is not a user on my computer.  How do I change that?  The apple id email is grayed out, so I cannot select it.

    The app store on my laptop is asking for my husband's apple id and password to update my apps, but he is not a user on my computer.  How do I change that?  The apple id email is grayed out, so I cannot select it.

    Delete and redownload those applications.
    (120219)

  • I recently changed my apple id and both my iphone 3Gs and Ipad 2 when synced went straight back to my old id name for my app store how do I change it to the new one and keep it that way?

    I recently changed my apple id and both my iphone 3Gs and Ipad 2 when synced went straight back to my old id name for my app store how do I change it to the new one and keep it that way?

    Try going into your account details on iTunes, change your info there, then sync your devices.

  • I recently purchased an external hard drive to back up my iMovies. When I try to open the movies on the backup I get a message "you may not have permission to modify that folder" How do I change permissions on the backup?

    I recently purchased an external hard drive to back up my iMovies. When I try to open the movies on the backup I get a message "you may not have permission to modify that folder" How do I change permissions on the backup?

    Hi
    One Must NEVER move or alter any folders named
    • iMovie Event's - or -
    • iMovie Projects - or - alike
    on DESKTOP/FINDER - Ever ! - ONLY Within the iMovie Program ! else all connections are broken and hard to impossibly to mend !
    but rather do as described here under
    Moving Event's and Project's
    Connection - Either connect one Mac in Target mode to the other via FireWire. Or use an external hard disk !
    (Target-Mode - Start one Mac e.g. laptop - BUT keep T-key down during full up-start - Now a FW-symbol is jumping around the screen and it will work as an external hard disk when connected to the other Mac)
    A. The External Hard Disk - MUST BE - Mac OS Extended (hfs) formatted to work for Video. UNIX/DOS/FAT32/Mac OS Exchange works for most other things but not for Video whatever program is used (iMovie or FinalCut)
    B. Should be a FireWire one as USB/USB2 performs badly to me and especially when filling up
    C. Do never Move or Alter any folder named
    • iMovie Event's - or -
    • iMovie Project's
    on DeskTop/Finder - as this will result in iMovie losing connections to them and repair can be anything from hard to impossibly
    D. Moving and Copying must be done within iMovie application and Events to Events - and - Project's to Project's.
    E. Moving Project's to Event's - Do not work for me - I have to export project as a QuickTime movie then Import this into Events.
    Event's window can show two faces
    Like this
    or like this
    from one hard disk Event - You can move it to the other hard disk
    You can not (at least not me) move Event to Project or other way around only
    Event to Event and Project to Project
    Yours Bengt W

  • HT204088 For some reason I am in the US store, how do I change back to the Australian App Store?

    FOr some reason I am in the US App Store, how do I change back to the Australian App Store on my iPad as I can't make purchases? It keeps telling me my account is not with the US store and to change to the Australian store.

    Settings > iTunes & App Stores > tap your Apple ID: > View Apple ID > Country/Region
    If you find that it is set to the correct region, log out of your iTunes Store account, restart your iPad, and sign into your account again.
    Regards.
    Forum Tip: Since you're new here, you've probably not discovered the Search feature available on every Communities page, but next time, it might save you time (and everyone else from having to answer the same question multiple times) if you search a couple of ways for a topic, both in the relevant forums and in the Apple Knowledge Base, before you post a question.

  • I adobe acrobat 7.0 professional. When I open or save a PDF it reverts to Adobe Reader XI. How can I change that to the pro as it has far more editing options.

    I adobe acrobat 7.0 professional. When I open or save a PDF it reverts to Adobe Reader XI. How can I change that to the pro as it has far more editing options.

    You may want to keep Reader. You may want to select Acrobat as your default, but be able to click on a PDF (or PDF link) to open in Reader when needed. There are likely some PDFs that will not open correctly in AA 7 because of new features folks add. Just because it opens in Reader XI does not mean it is in the new format, but just that is the default opening you have. To tell the type of file, you have to open the PDF and check the properties (ctrl-D) and check Description>PDF version.

  • How do I change font in the whole document at the same time?

    How do I change font in the whole document at the same time?

    Menu > View > Show Styles Drawer
    Menu > Help > Pages User Guide
    Download and read page 27 on creating and using Styles, which is done largely by example ie you make the text what you want then save it as a Style to be applied wherever you want in the document from the Styles Drawer.
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=180&mforum=iworktips ntrick
    Peter

  • I'm trying to download a song on the iTunes app but some how I'm in the US store, how do I change back to the Australian store?

    I'm trying to download a song on the iTunes app but some how I'm in the US store, how do I change back to the Australian store?

    Change App Store
    1. Tap "Settings"
    2. Tap "iTunes & App Stores"
    3. Tap on your Apple ID
    4.Tap "View Apple ID"
    5. Enter your user name and password.
    6. Tap "Country/Region."
    7. Tap "Change Country/Region"
    8. Select the country/region where you are located.
    9. Tap "Done".
    Note: If the change doesn't take effect, sign out of account and sign in again.

  • My messages won't say the contact name only shows the phone number, how do you change this when the contact is in my phone under that number already?

    My messages won't say the contact name only shows the phone number, how do you change this when the contact is in my phone under that number already?

    I thought that at first, but I have text this person before and had received responses in a timely manner. Its just weird that it all of a sudden removed their name.
    Would this affect the delivery of the text message?

Maybe you are looking for