Using ManagedBeans differently?

Hello, this is my first topic on this forum, my first topic about my JAVA activities also !
Sorry if my sentences have not a perfect English syntax or grammar, I'm not a English speaking person :)
Here we go :
My project consists of an Enterprise application, developed through NetBeans 6.7.1, using GlassFish 2.1 as my application server,...
I have my database and ejb working. I also have a war project containing some ManagedBeans and classic pages using them like :
        <h:form>
            <h:inputText value="#{testMB.testTmp.name}">
                <h:outputText value="name : "></h:outputText>
            </h:inputText>
            <h:commandButton value="add test" action="#{testMB.addTest}"/><br/>
         </h:form>This work very well, my test managedBean create and persist my test object into database...
Now what I'm trying to do is adding some ajax to my pages thanks to jQuery.
I've replaced this code by a simple html input and some JavaScript code.
I'm sending to ajax.jsp via a post request thanks to jQuery two parameters "action" wich has the value "addTest" and "testName" wich the value is the input value...
Here is the ajax.jsp code :
String action = request.getParameter("action");
if(action.equals("addTest")){
    TestMB testmb;
   testmb= new TestMB();
   testmb.createTestTmp(request.getParameter("testName"));
}and here is a part of the managedBean :
public class TestMB {
        @EJB
        MainSessionRemote  mainSessionBean;
  Test testTmp;
    public Test gettestTmp() {
        if(this.testTmp == null){
            this.testTmp = new  Test();
        return testTmp;
    public void createTestTmp(String str){
        this.testTmp.setName(str);
        this.addTest();
    public void settestTmp(Test tst) {
        this.testTmp = tst;
    public String addTest(){
        this.mainSessionBean.addTest(testTmp);
        settestTmp(null);
        return "ok";
    }...The problem while running the test :
org.apache.jasper.JasperException: java.lang.NullPointerException
Apparently the mainSessionBean is null...
Why in this case it doesn't work !?
I tried many alternatives, getting and manipulating data from a request and process them through the managed bean seams difficult, I didn't find examples of people trying to do this way. Is this way a good way !? I may have didnt get the concept of managed bean very well ...
Thanks for your time.

Those magical annotations like @EJB only work if the bean is created by the container, in this case by the JSF system.
This is not the way to do AJAX with JSF (as you have discovered). Find a JSF component library you like that provides AJAX capability to JSF, for example, RichFaces contains the ajax4jsf library. Also, the latest version of JSF, 2.0, includes some AJAX support out of the box.

Similar Messages

  • TS1717 Itune Match not happy as I have used 2 different email address ID's how do I combine them into one?

    Itunes unhappy, Match issues!  I think it is because I have used two accounts on different emails.  Can I pull the two together to make just one account?

    Open Accounts preferences in System Preferences. Click on the lock icon and authenticate. Under the user list click on the Add [-] button button to create a new user account for yourself or your father (whoever is not the existing account owner.) Configure the account with a separate username and password.
    Now each of you should have a separate account on the computer. You can each sync your iDevices into completely separate accounts using completely different Apple IDs.

  • How can I send email using two different email address that both link back to my one exchange account on my Ipad mini

    How can I send email using two different email address that both link back to my one exchange account on my Ipad mini? 
    On my PC I simply have a master return email address and use a POP for the secondary address.  Both are through the one exchange account without a problem.  I need to be able to do the same on my Ipad.

    Ah, I should have made that clear.  My domain didn't come from google.  It was purchased at and is hosted at dreamhost, but I haven't used their email servers in years - I just route everything through gmail.  I actually have a bunch of domains (with websites).
    Gmail has an option that lets someone with custom domains send (and receive) email through gmail using the custom domain once Google confirms proper ownership of the domain (to prevent spammers and such).  Gmail has a setting for "send email as" which allows gmail to be sent using a custom domain as the sender.  I'm pretty sure Apple's old mobileme had this feature too, but I didn't use it.

  • Using a different .Mac account in iPhoto

    We have a .Mac family pack. My wife and I each have a personal account and we would like to use a completely different .Mac account to post our web galleries, but I don't want to have to create a new user on my Mac just to use iPhoto. Is there a way that iPhoto can use a different .Mac account than the one associated with my user account on my computer to publish galleries?
    Thanks,
    Aaron

    For POP:
    The following mail server settings will work with all AT&T email domains: @ameritech.net, @att.net, @bellsouth.net, @flash.net, @nvbell.net, @pacbell.net, @prodigy.net, @sbcglobal.net, @snet.net, @swbell.net, @wans.net.
    Email Program Settings Field:
    Enter:
    Incoming (POP)
    inbound.att.net
    Outgoing (SMTP)
    outbound.att.net(requires authentication)
    Incoming mail server:
    POP3
    Incoming/Outgoing User Name:
    Full AT&T email address, including domain (e.g., [email protected], [email protected])
    Incoming mail port #:
    995, secure connection (SSL) checked
    Outgoing mail port #
    465, secure connection (SSL) checked
    I assume the settings you are refering to gives that delay for marking the messages as read when highlighted for that period of time. Probably for scrolling through the list without changing the unread status. Lion doesn't have that selection, so I can't test that at the moment.

  • HT201622 How do I install apps on a new iPhone 6 that uses a different Apple ID than the one used to purchase the apps?

    How do I install apps on a new iPhone 6 that uses a different Apple ID than the one used to purchase the apps?

    Sign in to the iPhone or connect the phone to the computer and sign into the store using the original ID and download the apps to the phone?

  • How do I use a different number for imessages than the one for my phone?

    I use two different phone numbers. My main number is not the one associated with my iphone. I want imessages to be sent from my primary number, not the one assigned by default by my phone. I see in settings where I can add another email address, but not where I can add another phone number. How can I change the default number to the one I actually want people to use?

    You can't add another phone number.

  • How do I use 2 different iTunes Stores?

    How do I use 2 different iTunes Stores simultateously? Active account in South Africa, but need to download apps from the German iTunes Store - which iTunes does not allow, as these apps do not appear on the South African iTunes Store.

    You cannot do this.

  • Is there an email account that will allow me to use a different from address with a POP account

    Need to be able to delete emails (I have an Optonline address) from iphone and ipad during the day, while retaining them on Mac Book Pro to view and file into folders in the evening. 
    Seemed like I could have my optonline emails forwarded to a Gmail account and just set up the Mac's mail to use my optonline account, while the iPad and iPhone used my Gmail account.  That worked, except for one issue - when I sent mail from the iPad or iPhone it would use my Gmail address and then people who used "reply" would have their replies sent back to my Gmail account.  I wanted to continue to use my optonline address since I have had this address for many, many years.  I saw that Gmail allows you to "send using a different from address", however because optonline is a POP account, they do not support the settings in Gmail and therefore I cannot get my optonline address to be verified by Gmail, meaning my emails continued to be sent from my Gmail address on my iPhone.
    I even tried setting up the Gmail account manually (using "Other" in the ipone settings) and putting in a comma with my optonline address in the address field, but still no success.
    Next, thought I'd try Yahoo mail - same thing - only sends mail with my Yahoo account.
    Then looked into iCloud since I use that for syncing Contacts and Calendars on all 3 devices - same thing - I can only send email using the @me.com address.
    Does anyone know of any other mail account that will work with my POP Optonline email address?  After 10+ years with this email address, having to announce to my world that I am changing my address (either to Gmail, Yahoo, or the iCloud's @me.com address) is something I really don't want to do.
    However, leaving just my optonline account on all 3 devices means I am constantly deleting the same emails on 3 devices everyday, which is also just not an effective use of my time.
    Please help!

    Here's one possibility:
    http://www.ideaflight.com
    The only way to keep students in the presentation, though, would be to lock the iPads to that app via the Guided Access mode:
    http://support.apple.com/kb/HT5509
    Whether you can do this remotely through one of the various mobile device management (MDM) soutions I don't know.
    Regards.

  • How can I associate 2 appleids with one account or use a different Appleid for imessage as described in another post?

    How can I associate 2 appleids with one account or use a different Appleid for imessage as described in another post?
    I have rejoined the iPhone community, not with one iPhone but with two. My wife agreed to move from the unenlightened!
    I have set up both under my apple account and want to keep it that way. But I do not want iMessages going to both phones. I would like separate message queues but share all apps and other purches from the store.
    I have created a separate AppleID for her but under Settings>Message>Receive At (it currently says 2 addresses) > ... will not allow me to change the current eMail address and when I add hers (her appleid) it errors out. The only thing I can do in the Apple ID field is to manage my account and not change it to hers.
    How can I have 2 iPhones (and my iPad) on the same account but have separate identies?
    Thanks,
    LpGrumpy

    1. Yes. Restart with the Option key held down as needed.
    2. No, it won't be a problem.
    (83373)

  • Use two different printer services in one web template?

    Hi!
    Is it possible to use two different help services for printing in the same web template (for the same table item)?
    Print1:
    <param name="HELP_SERVICE" value="HELP_SERVICE_PRINT"/>
    <param name="HELP_SERVICE_CLASS" value="ZCL_RSR_XLS_HELP_WINDOW_PRINT"/>
    Print 2:
    <param name="HELP_SERVICE" value="ZPRINTING"/>
    <param name="HELP_SERVICE_CLASS" value="ZBW_PRINT_HELP_SERVICE"/>
    I was thinking that you maybe could change the param name values for the "Help_service" and the "help_service_class" at runtime using the properties for the table item, so that you could choose which one to use, but I havne't been able to do that so far.
    Does anyone have an idea?

    This is not a problem. Just put the print service for the print to excel on an object other than the table web item. As long as these print services exist on any web item, you should be able to invoke them. I've tested this with putting the "Print with Excel" service on the Navigation Block Web Item and the other print service on the table web item. Hope that helps!
    Prakash

  • How to use two different network cards on RT?

    Hi everyone... I'm currently working on a project where I have to deal with the issue mentioned in the thread's topic: I have a PC with RT LabVIEW that has to be able to establish network connections using two different network cards. One will be used to connect via TCP/IP with a host computer that will show the data transmitted through shared variables; the other will communicate with another PC through Modbus protocol. The key is that each communication is done through a separate network card.
    So far I haven't been able to figure out how to configure both things to happen. Does anyone know how to do this? Any tips will help.
    For the RT communication I'm using a standard RT project, with the RT PC being given one of the IPs, and for the Modbus part, I created an I/O server with a master and a slave. Separately everything works fine, but when I get them together it simply won't work.
    Thanks for your help!
    Solved!
    Go to Solution.

    Sorry it took me so long to answer, I've been busy lately....I've found a solution to the problem I mentioned, and just in case anyone has similar problems in the future, I'll shortly describe what happened.
    As Caseyw suggested, it was necessary to enable both network cards through the Measurement and Automation Explorer. The cause of the connections malfunction was actually that I wasn't using the "right" protocol for the Modbus communication, which ran on the secondary adapter. The solution was to use the URL protocol with the correct path on the field, addressing the right IP address. To avoid making this post a mixture of topics, I won't elaborate futher, but I got the gist of it, so if anyone is having similar problems whether it is working with several network cards or with Modbus communication protocols, feel free to contact me, I'll be glad to help.
    Thanks

  • How to use two different versions of Firefox at the same time on Snow Leopard?

    I recently upgraded to Firefox 4.0 on my 27" iMac running Snow Leopard 10.6.7.
    Previously, I was using Google's "Page Speed" along with Firebug in Firefox 3.6.15 to optimize images in my web pages, and to find other areas to optimize.
    Page Speed is not yet compatible with Firefox 4.0. I wrote to Google about this some time ago -- no answer yet.
    If I run Firefox 3.6.15 in order to use Page Speed, I run into a few problems afterward when I start using Firefox 4.0 again, since they both use the same "Firefox" folder in my "Application Support" folder.
    How can I set it up so that I can have two separate "Firefox" folders in my "Application Support" folder?
    Or is there an easier way to use two different versions of Firefox simultaneously, even if one has extensions and/or plug-ins installed which are not compatible with the other version?
    Thanks for a great browser!

    Please disregard my question. I just conducted more web search and learned how to use Firefox's profile manager in order to make a separate profile for Firefox 3.6.15.
    You can find instructions on this page:
    http://support.mozilla.com/en-US/kb/Managing%20profiles#os=mac&browser=fx35
    '''A small tip:'''
    If your Firefox app is named anything other than "Firefox" -- say for example "Firefox 3.6.15" -- when you follow the instructions at the above link, make sure you escape the blank space that is before the version number by adding a backward slash before it, when you type the command string in the Terminal. In other words, in that string, you should use this:
    Firefox\ 3.6.15
    I hope that helps someone.
    WW

  • SBO - How to use two different Stock Account within the same Item Group

    Hi,
    I'm currently stuck within one of my implementation.
    I'm deploying the same solution worldwide which worked pretty well until now. All the items are connected to an item group, with a unique GL account, supposed to book at the same time the good receipt and the good issue (Balance-Sheet Account = 14xxxxx).
    My new unit is willing to use two different GL accounts when performing its stock entry (let say 14xxx10) and another GL account for the good issue, let say 14xxx20.
    Do you have any clue so i can please them and keep using at the same time the item group ?
    Thanking you in advance
    Stephane

    Hi,
    In fact, we use the GL account as the HQ Account (Reporting Account) while the "Export Code" will be used to store the local GL Account (greek account).
    As such, we can, somehow handle two different chart of accounts.
    In my reporting, i'm only using a single GL account for stock movements, while my greek counterparts want to handle two different accounts.
    Threfore, i have only two solution since there is normally a one to one relationship between a HQ account and a local account that are :
    1 - Duplicate the HQ accounts
    In that case, i do respect anytime the one to one relationship. I've got one HQ account for one local account. But how can i put this since i can only handle one single stock account.
    2 - I keep my single stock account like this but i won't be managing the possibility to get two different Export Codes.
    Regards
    Stephane

  • Can you use two different apple ID's on one Ipad?

    I would like to use two different apple id's on one IPAD.  One apple ID is for work and the other is for personal use.

    Read this.
    iTunes Store: Associating a device or computer to your Apple ID
    http://support.apple.com/kb/ht4627
     Cheers, Tom

  • Iam using 2 different i phones on the same itunes account, Can I keep the contacts seperate with syncing?

    I have one itunes account and am using 2 iphones, is it possible to keep all the "contacts" seperate from the two devices, so that I dont have to have all of my husbands contacts in the phone book?  Or do I have to use 2 different itune accounts?

    Your contacts are not part of your iTunes library.  iTunes only syncs contacts with your phone from a supported program such as Outlook or mac Address Book.  If you are trying to sync you contacts to the same program they will be merged.  You could, however, set up two contact groups within Outlook, one for your contacts and one for his.  Both groups would still besynced to both devices but you wouldn't have to look at the contact group you weren't interested in.  Another option would be for one of you to continue to sync with iTunes with, for example, Outlook and the other sync contacts with another service such as Google or iCloud (be sure to uncheck Sync Contacts on the Info tab of the the iTunes sync settings for this phone).

Maybe you are looking for

  • Download classical report to MS word with OLE

    hi experts,    I have a Classical HR Report that contains profile information of the employee.Now I have to Download the Report to Ms word through OLE . I tried some threads but they were just displaying the static text.I have to download the data fo

  • How to include one view into another view

    Hi SDN's,                Could any please tell me,How to include one view into another view. In my requirment.I want to create a 'Z' view for an interface .In that  view i have to take, 1) Ship-to-email adrr by                           LIKP-KUNNR ->

  • HP Laserjet CP1025nw Color Printer - printer prints two copies when only one is requested.

    pcwizard (HP) requested that I try Foxit Reader 5.1 to see if the printer will print properly.  I used the same previous document and printed it with Foxit Reader 5.1.  The printer printed two copies when only one was requested as it had done in the

  • Can't add numbers greater than 100 in the Data Editor for a column chart

    I'm trying to create a column chart in Keynote '09 but every time I add a data point with a value greater than 100 in the Data Editor it turns the number into a date. I have the Y Axis set to "Number" and it works fine for numbers less than 100 but I

  • Advanced Title Editing ( I need help)

    Ok so I'm working on a project of my own and need some help. I know how to make a see through title so that only my title shows and through the text shows my video but now I want to take that title with the video underneath and put that on top of ano