When exactly are request-scoped beans evicted from memory?

Hi,
I have a question about request-scoped JSF-managed beans and request-scoped HibernateFilter. It seems to me that request-scoped JSF beans actually outlive an HTTP request. Here's what I mean. Let's say I have a page backed by a request-scoped bean #{myBean} which displays a dataTable. a user can click on a row to perform some operation on row data.
I always thought the following to be true about lifecycle of JSF request-scoped bean:
1.User makes initial page request
-HTTP Request 1 (R1) comes in
     1. RestoreView encounters #{myBean} in page and constructs MyBean
     2. RenderResponse renders the page
-R1 is terminated, page is displayed, myBean is evicted from memory
2.User looks at the dataTable and clicks on a specific row (via commandLink). Now MyBean.action() is supposed to be
executed and perform some operation on row data:
-HTTP R2 comes in
     1.MyBean is constructed again (e.g. not using same instance as in R1). (THIS IS KEY!)
     2.myBean.action() is executed
-R2 is terminated, myBean is again evicted from memory
Is the above understanding correct?
Or does myBean instance (and its' properties) remain in appserver memory between R1 and R2 and R2 actually uses the
same instance of myBean?
If scenario above is correct, then I have a strange problem:
-when performing myBean.action() during R2 on rowData (which is instance of MyHibernateBean) I get a
HibernateException stating that bean isn't associated with a Hibernate Session. This can only happen if the lifecycle of the object and its' parent myBean exceeded that of R1. That is because I have a Hibernate Servlet
Filter that a) start a Hibernate Transaction on incoming request and b) commits it on the way out.
Here's pseudo-code for myBean:
public class MyBean {
    public static String HANDLE = "#{myBean}";
    //getters setters omitted
    //used as 'value' in dataTable
    private List<MyHibernateBean> dataBeans;
    //dataTable binding
    private UIData tableData;
    public MyBean() {
    public String action() {
        //read children & modify state of a hibernate bean
        MyHibernateBean dataBean = (MyHibernateBean) this.tableData.getRowData();
        HibernateUtil.getCurrentSession().refresh(dataBean); //seems necessary as dataBean instance deemed 'stale'
        dataBean.getChildCollection(); //will fail without line above
        return "toSomewhereElse";
}

By the way, I have an hypothesis why this does not work...
The datatable values MUST be specified using a value binding expression. When the restoreState method for the component is called, JSF attempts to use the VB expression to get the table values. When the managed bean is not found, it creates a new (empty) one and the world ends (actually it just returns back to the original page because it cannot figure out what to do)

Similar Messages

  • PLZ Help: how to get value of a request scoped Bean/Attribute in JSF ?!!!

    hi,
    I noticed this part of code to retrieve session scoped beans/vars in an ActionListener or other jsf classes, but it does not work for request scoped beans/vars :( what's the problem then ? what shall i do ?
    Type var = (Type)Util.getValueBinding("myBeanInRequest")).getValue(context);
    I have also set that getPhaseId() returns UPDATE_MODEL_VALUES or APPLY_REQUEST_VALUES.
    Any comment or idea ?

    I have declared my Bean in my JSP page not in the
    faces-config.xml. Does this make any problem ? Also I
    have tried the way you told me as well, but still the
    returned attribute is null.
    P.S. My bean is declared in my JSP page this way:
    <jsp:useBean id="newSurveyVar" class="SurveyModel"
    scope="request" />
    This declaration causes the SurveyModel instance to be created in request scope when the page is rendered, but that doesn't help you when the form is submitted -- that is going to happen on the next request (so the request attribute created here goes away). Basically, <jsp:useBean> is not typically going to be useful for request scope attributes (it's ok for session or application scope, though).
    and further I have this jsf code:
    <h:command_button label="Create" commandName="create"
    action="create" >
    <f:action_listener
    r type="CreateNewSurveyActionListener"/>
    </h:command_button>
    and this is my
    CreateNewSurveyActionListener.processAction(ActionEvent
    e) {
    if (actionCommand.equals("create_the_survey")) {
    FacesContext context =
    t = FacesContext.getCurrentInstance();
    SurveyModel survey =
    y =
    (SurveyModel)(Util.getValueBinding("newSurveyVar")).get
    alue(context);
    if (survey==null) // returns true :(((
    And since I've declared my beans here there is nothing
    special declared in my faces-config.xml
    For me again it is really strange why it is not
    working !!!
    Any idea ? Because the event listener is fired in a separate request, so the one you created in the page is gone.
    This is why the managed bean creation facility was created. If your component contains a valueRef that points at the bean name (or you evaluate a ValueBinding as illustrated earlier in the responses to your question), then the bean will get instantiated during the processing of the form submit.
    Craig McClanahan

  • Are session-scoped beans singleton

    Hi all, I miss something in the bean lifecycle within JSF. Assume that a page action navigates toward another page, linked to a session-scoped bean: this is created for the duration of this session. Then a button leads back to the original page, so that another action will lead to another page with its associated bean. Is this a new bean or the previous one ?
    This question is linked to the topic of bean dependencies through managed properties: it works fine, but since a bean is declared per class and not per instance, I miss the overall instantiation philosophy.

    Once the bean is created the first time in session, it will not be created again (until the session dies and you attempt to access the bean again of course).
    So in your scenario, the first time you access the page the bean gets created. When you go back and then go forward to the page again, a new bean is not created. The originally created one is re-used. Which means the constructor is not called again.
    CowKing

  • HT2045 I purchased a song from iTunes (it debited my account) but it will not play in iTunes. It asks for my account and PW. When these are entered, it just asks from them again. Is there a way to make the song play or get my account credited for the purc

    I purchased a song from iTunes but it will not play in iTunes or on my nano.  When I attempt to play it, a get asked for my account and pw.  When these are provided, I get asked for them again.  Is there a way to get my purchased song to play or get my account credited for this purchase?
    Thanks

    Which os are you using on your computer? 

  • Do request scoped beans work with dataTable??

    I have a datatable to display values from a managed bean. For each item, I display a command link allowing the user to "drill down" on the item for more information.
    I only need the list in the managed bean for this one request so I'd like to place it in request scope. When I do so, the command link does not work (when I select the link the current page is redisplayed and the action method I specify is never called). I also tried specifying an action listener, but that does not get called either.
    If I have the bean in session scope, everything works fine.
    Does anyone know if using a dataTable requires that the associated ban value be in session scope? If so, can you explain why?
    Thanks!

    By the way, I have an hypothesis why this does not work...
    The datatable values MUST be specified using a value binding expression. When the restoreState method for the component is called, JSF attempts to use the VB expression to get the table values. When the managed bean is not found, it creates a new (empty) one and the world ends (actually it just returns back to the original page because it cannot figure out what to do)

  • Why do my photos get blurry when they are enlarged to full screen from the disc I burn, or played on the t.v.?  I set the burn on the highest quality.  The photos don't look blurry when enlarged from iphoto on the computer.

    Why do my photos that are transferred from iphoto to idvd, and then burned on DVD, look blurry when the idvd is shown full screen on computer or on t.v.  They don't look blurry when I enlarge the iphoto pics on the computer.  I used the 'prof. quality" encoding setting before burning, and before putting photos on idvd.

    Hi
    DVD is as standard - only interlaced SD-Video (as on old CRT-TVs) and can never be any better than this.
    This is less than a quarter of Your Mac screen resolution.
    That's one part of Why You can see High res. on Your Mac - and not on DVD.
    Next part is what program is used to make the SlideShow.
    If You use iMovie'08 or 09 or 11 - to make it - it too degrades the final result as non of them can deliver interlaced SD-Video to iDVD but only half (every second line in the picture)
    I use
    • iMovie HD6 or
    • FinalCut (any version) or
    • FotoMagico™
    As they all delivers 100% of what iDVD or Toast™ or DVD Studio Pro or Whatever needs.
    Yours Bengt W

  • Hang at Shut Down... When exactly are drives safely unmounted?

    My Mac often hangs at shut down (like many others). I typically get all icons, dock, and menu bar removed and am left with the desktop picture, or sometimes I'll get to the blue screen (after the desktop picture has gone) and get the circle made of straight lines that just continually loop.
    My question is: Have the drives unmounted and therefore aren't potentially damaged due to the power being forcefully cut off (holding the power button), or are they still mounted and therefore possibly damaged requiring (to be safe) another round of DiskWarrior magic?
    I'm getting tired of spending all of my time running DiskWarrior. Are these fixes necessary?
    any thoughts are welcome and appreciated!

    Hi! I'd be concerned because the last command that the OS gives at shutdown is for the drive heads to "park" after which the power to them is turned off. If they are not "parking" the heads properly it could cause problems. I'd investigate unhooking the external attached devices to see if any of them are hanging the shutdown but also if you have several volumes or drives attached to the computer if often takes a seemingly long time for the OS to complete the disk chores at shutdown. Have you waited at least 5 min+ to see if it will shutdown? Also if Diskwarrior shows anything in "RED" then the directories definitely are having problems and should be corrected. Often a directory will suffer damage but continue to mount and function until the corruption finally gets so bad it crashes. Regular use of DW usually keeps them in good shape. Tom

  • NullPointerException When trying to Get Session Scoped Bean data in another ManagedBean

    hello
    i wont to access to some data in my session scoped bean from a request bean so when i try to get this data all i get is 
    com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection
    on managed bean «discussionlaoder»
    in the end of the exception there is
    Caused by: java.lang.NullPointerException at Hiber.discussionlaoder.init(discussionlaoder.java:35)
    this is my code:
    1-the request scoped bean
    @ManagedBean
    @RequestScoped
    public class discussionlaoder {
      private MyadmninHelper halper;
    @ManagedProperty(value="#{serviceBean}")
         private ServicesBean  serviceBean;
        @PostConstruct
        public void init() {
          halper=getServiceBean().getHalper();  // line 35
    //seter and geter code
    2-the sesions scoped bean
    @ManagedBean (eager=true)
    @SessionScoped
    public class ServicesBean {
        private MyadmninHelper halper;
    //seter and geter code
    am using glassfish server 3.1
    thank's for help

    What you need to do is fix all those typos in your code, then you don't have to override names.
    - the proper Java class name is DiscussionLoader, not discussionlaoder (fix english typo also)
    - if you want to inject a class named ServicesBean, then also call the property the same.
    @ManagedProperty
    public ServicesBean servicesBean;
    But what you're doing now is call the class 'ServicesBean' and then in your managed bean declaration you seem to change your mind and it should all of a sudden be 'serviceBean'. Well then rename the class so you don't have your typo anymore!

  • Passing values between views in View Scoped Bean

    I have a form page that uses a view scoped backing. This page forwards to a confirmation page that uses the same backing bean. I would like to redisplay the information to the user that they entered in the form and then process these values when they hit submit on the confirmation page. However, when on the confirmation page, all of the values from the bean are null. I understand that view scoped beans are destroyed when you go to a new view, but when this bean was request scoped I could see the values on this page and save them in hidden inputs to process in the backing bean. I can still see the form values in the request parameters. Also, I cannot use a request scoped bean due to multiple ajax requests that are on the form. How can I propagate the values from the first form page to the second confirmation page?
    I am using Mojarra JSF 2.0
    Edited by: edenbaptiste on Apr 22, 2010 4:25 PM

    Here is some Sample code.
    The Payment Page:
    <ui:composition>
        <form jsfc="h:form" id="form">
            <h:messages/>
            <select id="paymentMethod" jsfc="h:selectOneRadio" value="#{testPaymentBean.paymentMethod}" immediate="true">
                <option jsfc="f:selectItem" itemValue="first" itemLabel="Pay with First Type"/>
                <option jsfc="f:selectItem" itemValue="second" itemLabel="Pay with Second Type"/>
                <f:ajax render="paymentPanel"/>
            </select>
            <h:panelGroup id="paymentPanel">
                <ui:include src="#{testPaymentBean.paymentPanel}"/>
            </h:panelGroup>
            <h:commandButton action="#{testPaymentBean.handlePayment}" value="Submit"/>
        </form>
    </ui:composition>The First Payment Type Form Fragment:
    <ui:composition>
        <h:panelGroup layout="block">
            <h:outputLabel for="amount" value="Enter Payment Amount: " />
            <h:inputText value="#{testPaymentBean.amount}">
                <f:validateLongRange minimum="0" />
            </h:inputText>
            <h:message for="amount"/>
            <br />
            <h:outputLabel for="holderName" value="Enter Account Holder Name: " />
            <h:inputText value="#{testPaymentBean.name}" />
            <h:message for="holderName"/>
            <br />
            <h:outputLabel for="accountNumber" value="Enter Account Number" />
            <h:inputText value="#{testPaymentBean.accountNumber}">
                <f:validateLongRange minimum="0" />
            </h:inputText>
            <h:message for="accountNumber"/>
        </h:panelGroup>
    </ui:composition>The Second Payment Type Form Fragment:
    <ui:composition>
        <h:panelGroup layout="block">
            <h:outputLabel for="amount" value="Enter Payment Amount: " />
            <h:inputText value="#{testPaymentBean.amount}">
                <f:validateLongRange minimum="0" />
            </h:inputText>
            <h:message for="amount"/>
            <br />
            <h:outputLabel for="holderName" value="Enter Account Holder Name: " />
            <h:inputText value="#{testPaymentBean.name}" />
            <h:message for="holderName"/>
            <br />
            <h:outputLabel for="accountNumber" value="Enter Account Number" />
            <h:inputText value="#{testPaymentBean.accountNumber}">
                <f:validateLongRange minimum="0" />
            </h:inputText>
            <h:panelGroup id="physicalAddrPanel" layout="block"
                          style="display: #{testPaymentBean.physicalAddressDisplayStyle}">
                <h:outputLabel for="addrFirstLine" value="Address Line 1: " />
                <h:inputText value="#{testPaymentBean.streetLineOne}" />
                <h:commandLink value="Use PO Box" immediate="true">
                    <f:ajax render="poBoxPanel physicalAddrPanel" />
                    <f:setPropertyActionListener value="display" target="#{testPaymentBean.poBoxDisplayStyle}"/>
                    <f:setPropertyActionListener value="none" target="#{testPaymentBean.physicalAddressDisplayStyle}"/>
                </h:commandLink>
                <h:message for="addrFirstLine"/>
                <br />
                <h:outputLabel for="addrSecondLine" value="Address Line 2: " />
                <h:inputText value="#{testPaymentBean.streetLineTwo}" />
                <h:message for="addrSecondLine"/>
                <br />
                <h:outputLabel for="addrThirdLine" value="Address Line 3: " />
                <h:inputText value="#{testPaymentBean.streetLineThree}" />
                <h:message for="addrThirdLine"/>
            </h:panelGroup>
            <h:panelGroup id="poBoxPanel" layout="block"
                          style="display: #{testPaymentBean.poBoxDisplayStyle}">
                <h:outputLabel for="poBox" value="PO Box Number: " />
                <h:inputText value="#{testPaymentBean.poBoxNumber}">
                    <f:validateLongRange minimum="0" />
                </h:inputText>
                <h:commandLink value="Use Physical Address" immediate="true">
                    <f:ajax render="poBoxPanel physicalAddrPanel" />
                    <f:setPropertyActionListener value="none" target="#{testPaymentBean.poBoxDisplayStyle}"/>
                    <f:setPropertyActionListener value="display" target="#{testPaymentBean.physicalAddressDisplayStyle}"/>
                </h:commandLink>
                <h:message for="poBox"/>
                <br />
                <h:outputLabel for="zipCode" value="Zip Code: " />
                <h:inputText maxlength="5" size="5" value="#{testPaymentBean.zipCode}">
                    <f:validateLongRange minimum="0" />
                    <f:validateLength minimum="5" />
                </h:inputText>
                <h:message for="zipCode"/>
            </h:panelGroup>
        </h:panelGroup>
    </ui:composition>The Backing Bean:
    import java.io.Serializable;
    import javax.faces.bean.ManagedBean;
    @ManagedBean()
    public class TestPaymentBean implements Serializable{
        private String paymentMethod;
        private String name;
        private double amount;
        private String accountNumber;
        private int poBoxNumber;
        private String streetLineOne;
        private String streetLineTwo;
        private String streetLineThree;
        private String zipCode;
        private String poBoxDisplayStyle;
        private String physicalAddressDisplayStyle;
        private boolean poBoxUsed;
        public TestPaymentBean(){
            paymentMethod = "first";
            poBoxDisplayStyle = "none";
            physicalAddressDisplayStyle = "display";
        public String getPaymentPanel() {
            if(paymentMethod.equalsIgnoreCase("second")){
                return "/sections/formfragments/testSecondPaymentContentPanel.xhtml";
            } else if(paymentMethod.equalsIgnoreCase("first")){
                return "/sections/formfragments/testFirstPaymentContentPanel.xhtml";
            return null;
        public String handlePayment(){
            if(paymentMethod.equalsIgnoreCase("second")){
                return handleSecondPayment();
            } else if(paymentMethod.equalsIgnoreCase("first")){
                return handleFirstPayment();
            return null;
        private String handleSecondPayment() {
            poBoxUsed = poBoxDisplayStyle.equalsIgnoreCase("display");
            return "testpaymentconfirmation";
        private String handleFirstPayment() {
            return "testpaymentconfirmation";
        public String handleSecondConfirm() {
            return "testpaymentsuccess";
        public String handleFirstConfirm() {
            return "testpaymentsuccess";
        //Getters and Setters
    }The Confirmation Page:
    <ui:composition>
        <form jsfc="h:form" id="form">
            <c:choose>
                <c:when test="#{fn:containsIgnoreCase(testPaymentBean.paymentMethod, 'first')}">
                    <ui:include src="/sections/formfragments/testFirstPaymentConfirmationContentPanel.xhtml"/>
                </c:when>
                <c:when test="#{fn:containsIgnoreCase(testPaymentBean.paymentMethod, 'second')}">
                    <ui:include src="/sections/formfragments/testSecondPaymentConfirmationContentPanel.xhtml"/>
                </c:when>
            </c:choose>
        </form>
    </ui:composition>

  • Add FacesMessage to FacesContext in an session scoped bean HOWTO?

    I have an simple question. How can I add an FacesMessage to the FacesContext in a session scoped bean.
    This code works fine for request scoped beans.
    String message = "Some message";          
    FacesMessage curentMessage = new FacesMessage(message, message);
    curentMessage.setSeverity(FacesMessage.SEVERITY_ERROR); //Mark as ERROR
    context.addMessage(�userForm�, curentMessage);          When I change bean scope to "session" I am getting java.lang.IllegalStateException at the last line when adding message to context.
    Thanks:
    -- Nermin

    I have an simple question. How can I add an
    FacesMessage to the FacesContext in a session scoped
    bean.
    This code works fine for request scoped beans.
    String message = "Some message";          
    FacesMessage curentMessage = new FacesMessage(message,
    message);
    curentMessage.setSeverity(FacesMessage.SEVERITY_ERROR);
    //Mark as ERROR
    context.addMessage(�userForm�, curentMessage);          When I change bean scope to "session" I am getting
    java.lang.IllegalStateException at the last line when
    adding message to context.
    Thanks:
    -- NerminHow do you get "context"? If you are storing it as an instance variable of the bean, then you
    should expect to get an exception. The FacesContext is scoped only to one request. Instead
    of storing it in the bean, use FacesContext.getCurrentInstance() each time you need to use it.

  • How to return a service method result to JSF Page w/ request-scope bean?

    From a .jspx page, I call a request-scoped backing bean which in turn calls an AM service method. The AM service method will return an object with multiple values. Based on the results, I will set the navigation case and then call another .jspx page.
    How can I pass the result values from the AM service method to the next .jspx page? Note I will only use request-scoped beans and do not want to use session-scope bean.
    Thanks.

    Ok - I can set a new processScope var in the backing bean and then reference it in the next .jspx page:
    backing bean:
    EL.setBCVal("#{processScope.newcustidhex}", svcresult);
    where EL is utility class
    public static void setBCVal(String expr, Object value) {
    FacesContext fc = FacesContext.getCurrentInstance();
    ValueBinding vb = fc.getApplication().createValueBinding(expr);
    vb.setValue(fc,value);
    return;
    }

  • HT2534 Why can't I install apps. When they are free?

    Why can't I install apps. When they are free?

    Try anything from the 12 Days of Christmas app or any other app from the App Store.
    1. Tap the "Free" button
    2. Tap the "Install App" button
    The button will switch to the "Installing" button quickly and then go back to the "Free" button and thats it.  No workie!
    Can't believe this is broken.
    iPhone 5
    iOS v6.0.2

  • Reconstruction of request scoped backing beans

    Hi,
    I have a jsp which contains the following code:
    <h:commandButton action="go_someplace" actionListener="#{bean1.update}" value="submit"/>bean1 is this form's backing bean and it is request scoped.
    bean1 is passed some parameters from the former page by putting them in the request to that page.
    What I notice is that bean1 is constructed once when the form is displayed, but also a second time before the actionListener (update) is invoked.
    As a result, the second request to the bean (the HTTP request) does not contain what it originally did in the first request anymore and the data gets reset.
    Can anyone please explain this behavior (and offer a solution...).
    Thanks,
    Zohar

    I tried it and it doesn't solve my problem.
    I'll try to explain what I have a bit clearer:
    I have a form with a person's details: name, age. A person has a unique id.
    I have a form with a list of persons. When I select a specific person a new form is shown with that person's details. multiple forms may be opened, so the person's details form is request scoped.
    I pass the selected person's id from the list of persons' form using f:param in the form's commandLink. I retrieve this id in the person's details form using httpRequest.getParameter("com.zohar.selectedPersonId");.
    I also added a <h:inputHidden value="#{personDetails.personId}"/>I noticed that setPersonId() is invoked after all the form controls are built, so that the getPersonName() (which depends on the person ID) is invoked before setPersonId() is invoked.
    Is there a standard way to do this?

  • Problem - Values are not stored into Tables when value are accepted from us

    // jsp code
    <%@ page import="java.util.Enumeration" %>
    <%@ page import="java.util.Vector" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.lang.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="beans.register2" %>
    <jsp:useBean id="registerbn" scope= "session" class="beans.register2" />
    <% String base = (String) session.getAttribute("base");
    registerbn.setDburl((String)session.getAttribute("dbUrl"));
    registerbn.setDbuser((String)session.getAttribute("dbUserName"));
    registerbn.setDbpasswd((String)session.getAttribute("dbPassword"));
    System.out.println("Inside jsp - setMembers of promotion successful");
    // registerbn.setMembers1();
    System.out.println("after setting");
    %>
    <%
    String action=request.getParameter("action");
    %>
    <HTML>
    <HEAD>
    <TITLE> TIFR INTRANET </TITLE>
    </HEAD>
    <HEAD>
    <script language="JavaScript1.2">
    //some validations functions
    </script>
    </head>
    <body>
    <table valign="top" align="top">
    <TR>
    <TD COLSPAN="100%"><jsp:include page="Header.jsp" flush="true"/></TD>
    </TR>
    <TR>
    <TD align="top" valign="top"><jsp:include page="menu.jsp" flush="true"/>
    <font face="arial" size="1">
    site developed by ADPCell TIFR
    </font>
    </td>
    <td>
    <table cellpadding="2" cellspacing="3" width="40%">
    <form method="post" action="./beans.register2">
    <td width="40" align="center"
    <font face="arial" size="5" align="right">
    <b>
    Registration <hr> </hr>
    </b>
    </font>
    <br>
    </td>
    <tr valign="center" width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">IdCode </b> </font>
    </td>
    <td width="40%">
    <b><font face="Arial" size="2">
    <input type="text" name="idcode" size="6" style="border-style:solid" value="">
    </font></b>
    </td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">User </font></B></td>
    <td width="40%">
    <input type="text" name="user" size="12" style="border-style: solid" value="">
    </font></b></td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">Password </font></B></td>
    <td width="40%">
    <input type="password" name="password" size="25" tabindex="20" style="border-style: solid" width="12" value="">
    </font></b></td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">Section code </font></b></td>
    <td width="40%">
    <select size="1" name="section_code" tabindex="9"
    style="border-style: solid">
    <%@ include file="section.txt" %>
    <!-- left for password -->
    1)
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">Category </font> </b></td>
    <td width="80%">
    <font face="arial" size="2"> <b>
    <input type="radio" name="Category" value="General">General
    <input type="radio" name="Category" Value="Operators">Operators
    <input type="radio" name="Category" Value="Heads">Heads<BR>
    </b> </font>
    </td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">Budget Category </font> <b> </td>
    <td width="40%">
    <font face="Arial" size="2"> <b>
    <input type="radio" name="BCategory" value="General">BGeneral
    <input type="radio" name="BCategory" Value="Operators">Operators
    <input type="radio" name="BCategory" Value="Head">Head
    </td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">Budget Heads
    </font></b></td>
    <td width="40%">
    <b><font face="Arial" size="4">
    <textarea rows="2" name="Bheads" cols="20" size="100"
    style="border-style: solid">
    </textarea></font></b></td></tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">Other Category</font></b></td>
    <td width="40%">
    <b><font face="Arial" size="2">
    <select size="1" name="OtherCategory" tabindex="20" style="border-style:
    solid" size="2"><OPTION value="EH">EH
    <OPTION value="EO">EO
    <OPTION value="FH">FH
    <OPTION value="FO">FO
    <OPTION value="AO">AO
    <OPTION value="AH">AH
    </select></font></b></td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">email </font></b></td>
    <td width="40%">
    <b><font face="Arial" size="2">
    <input type="text" name="email" size="20" style="border-style:
    solid" width="6">
    </font></b></td>
    </tr>
    <tr width="80%">
    <td width="40%">
    <font face="Arial" size="2"><b>Dob </font></b></td>
    <td width="40%">
    <font face="Arial" size="2"><b>
    <select size="1" name="day" style="border-style: solid"><OPTION value="0">Day
    <% int i;
    for(i=1;i<=31;i++)
    out.print("<OPTION VALUE=\""+i+"\">"+i+"</option>");
    %>
    </select>  
    <select size="1" name="month" style="border-style: solid" ><OPTION value="0">Month
    <OPTION value="1" >January
    <OPTION value="2" >February
    <OPTION value="3" >March
    <OPTION value="4" >April
    <OPTION value="5" >May
    <OPTION value="6" >June
    <OPTION value="7" >July
    <OPTION value="8" >August
    <OPTION value="9" >September
    <OPTION value="10">October
    <OPTION value="11">November
    <OPTION value="12">December
    </select>
    <select size="1" name="year" style="border-style: solid">
    <% int j;
    for(j=1950;j<=2000;j++)
    out.print("<option value=\""+j+"\">"+j+"</option>");
    %>
    </select></b></font></td>
    </tr>
    <br> <br>
    <tr width="80%">
    <td width="40%">
    <b><font face="Arial" size="2">Date of Join
    </font></b></td>
    <td width="40%">
    <b><font face="Arial" size="2">
    <select size="1" name="day1" style="border-style: solid"><OPTION value="0">Day
    <% int k;
    for(k=1;k<=31;k++)
    out.print("<OPTION VALUE=\""+k+"\">"+k+"</option>");
    %>
    </select>
    <select size="1" name="month1" style="border-style: solid" ><OPTION value="0">Month
    <OPTION value="1" >January
    <OPTION value="2" >February
    <OPTION value="3" >March
    <OPTION value="4" >April
    <OPTION value="5" >May
    <OPTION value="6" >June
    <OPTION value="7" >July
    <OPTION value="8" >August
    <OPTION value="9" >September
    <OPTION value="10" >October
    <OPTION value="11" >November
    <OPTION value="12" >December
    </select> 
    <select size="1" name="year1" style="border-style: solid">
    <% int l;
    for(l=1950;l<=2000;l++)
    out.print("<OPTION VALUE=\""+l+"\">"+l+"</option>");
    %>
    </select>
    </b></font></td>
    </tr>
    </table>
    <table cellpadding="2" cellspacing="3" width="40%" >
    <tr width="100%">
    <td width="30%">
    <input type="Submit" value="Submit" name="B1" > </td>
    <td width="40%">
    <input type="reset" value="Reset" name="B2"></td>
    <%
    //String action=request.getParameter("Submit1");
    if(action!=null && action.equals("Submit"))
    try{
    String idcode=request.getParameter("idcode");
    String user=request.getParameter("user");
    String password=request.getParameter("password");
    String seccode=request.getParameter("section_code");
    String Category=request.getParameter("Category");
    String BCategory=request.getParameter("BCategory");
    String Bheads=request.getParameter("Bheads");
    String OtherCategory=request.getParameter("OtherCategory");
    String email=request.getParameter("email");
    String day=request.getParameter("day");
    String month=request.getParameter("month");
    String year=request.getParameter("year");
    String Dob=day+"/"+month+"/"+year;
    String day1=request.getParameter("day1");
    String month1=request.getParameter("month1");
    String year1=request.getParameter("year1");
    String Doj=day1+"/"+month1+"/"+year1;
    registerbn.setIdcode("idcode");
    registerbn.setUser("user");
    registerbn.setPasswd("password");
    registerbn.setSec_code("seccode");
    registerbn.setCategory("Category");
    registerbn.setBut_cat("BCategory");
    registerbn.setBut_heads("Bheads");
    registerbn.setOther_Category("OtherCategory");
    registerbn.setEmail("email");
    registerbn.setDob("Dob");
    registerbn.setDoj("Doj");
    registerbn.saveData();
    }catch(Exception ex)
    out.println("ERROR :has occured ");
    %>
    </table>
    </table>
    </table>
    </form>
    </td>
    </tr>
    <jsp include page="Footer.jsp" flush="true"/>
    ------------------ End of JSP Programs ----------------
    // Beans Code
    package beans;
    import java.util.*;
    import java.util.Date;
    import java.util.Vector;
    import java.sql.*;
    public class register
    private String idcode;
    private String user;
    private String passwd;
    private String sec_code;
    private Vector sec_names;
    private String category;
    private String bud_cat;
    private String bud_heads;
    private String other_category;
    private String email;
    private String dob;
    private String doj;
    private String ent_dt;
    private String act_dt;
    private String dbUrl=null;
    private String dbUser=null;
    private String dbPassword=null;
    public void setDburl(String u)
    dbUrl=u;
    public void setDbuser(String us)
    dbUser=us;
    public void setDbpasswd(String Pass)
    dbPassword=Pass;
    public String getIdcode()
    return idcode;
    public void setIdcode(String i)
    idcode=i;
    public String getUser()
    return user;
    public void setUser(String u)
    user=u;
    public String getPasswd()
    return passwd;
    public void setPasswd(String p)
    passwd=p;
    public Vector getSec_names()
    return sec_names;
    public void setSec_names()
    // This function should select valid section code from the database and then populate the sec_names vector.
    public String getSec_code()
    return sec_code;
    public void setSec_code(String s)
    sec_code=s;
    public String getCategory()
    return category;
    public void setCategory(String c)
    category=c;
    public String getBud_cat()
    return bud_cat;
    public void setBud_cat(String b)
    bud_cat=b;
    public String getBud_heads()
    return bud_heads;
    public void setBud_heads(String b)
    bud_heads=b;
    public String getOther_Category()
    return other_category;
    public void setOther_category(String o)
    other_category=o;
    public String getEmail()
    return email;
    public void setEmail(String s)
    email=s;
    public String getDob()
    return dob;
    public void setDob(String d)
    dob=d;
    public String getDoj()
    return doj;
    public void setDoj(String d)
    doj=d;
    public String getAct_dt()
    return act_dt;
    public void setAct_dt(String d)
    act_dt=d;
    public void setMembers()
    Connection conn;
    Statement stmt;
    String query="Select sec_code from web.section";
    sec_details=new Vector();
    try
    conn=DriverManager.getConnection(dbUrl, dbUser, dbPassword);
    System.out.println("connected");
    stmt=conn.createStatement();
    System.out.println("Statement Created");
    ResultSet rs=stmt.executeQuery(query);
    do
    String seccode=rs.getString(1);
    sec_details.addElement(seccode);
    }while(rs.next());
    rs.close();
    stmt.close();
    conn.close();
    }catch(SQLException e)
    System.out.println("Execution Occured" +e);
    catch(Exception e)
    System.out.println("Execution Occured" +e);
    public void saveData()
    Connection conn;
    Statement stmt;
    String id=getIdcode();
    String use=getUser();
    String pass=getPasswd();
    String mail=getEmail();
    String sec=getSec_code();
    String cat=getCategory();
    String oth=getOther_Category();
    String bud=getBud_cat();
    String dob1=getDob();
    String doj1=getDoj();
    String budh=getBud_heads();
    String query="insert into wb_register " + "(idcode, user, passwd, sec_code, category, bud_cat, bud_heads, other_category, email , dob, doj, ent_dt)" + " values('"+id+"','"+use+"','"+pass+"','"+sec+"','"+cat+"','"+bud+"','" budh"','" oth"','"+mail+"','"+dob1+"','"+doj1+"','"+"Sysdate"+"')";
    try
    conn=DriverManager.getConnection(dbUrl,dbUser,dbPassword);
    System.out.println("connected");
    stmt=conn.createStatement();
    stmt.executeUpdate(query);
    stmt.close();
    conn.close();
    catch(SQLException e)
    System.out.println("Exception occured" +e);
    catch(Exception er)
    System.out.println("Exception occured" +er);
    ------------------------End of Beans Program ---------------
    Questions:-
    1) when we are submitting values to form it is not stored into backend (Oracle 9i)
    2) please send some source code for how to fetch values from backend and wants stored into Combo box /select Box
    3) We have faced problem of How call methods of Bean program into JSP programs

    The code to get the values from the database and store them in the combo box or select box would be as follows:
    <%
    zSQL = "select id, name from Users"
    rs = Con.ExecuteQuery(zSQL);
    if(!rs.next()) {
    %>
    <select name="id">
    <option value="0">select the name</option>
    <%
    do {
    %>
    <option value="<%= rs.getString(1) %>"><%= rs.getString(2) %></option>
    <%
    while (rs.next());
    %>
    </select>
    <%
    else {
    out.println("No Record Found");
    %>
    This would help you better.
    and for your first question, please check whether u are able to connect database with your connection method. if you are able to connect to the database, then please check the values (print them on the browser) which are posted from form, if it is also correct then check you r insert statement.
    and for your last question the best tutorial is JAVA API.
    Cheers!
    Rambee

  • I recently had to swap out my iphone 4s and I am having problems restoring photos and videos from icloud.  I get a message on my phone that says " the URL you are requesting is not found on this server".  Pics and videos have been deleted too.

    I recently had to swap out my iphone 4s and I am having problems restoring photos and videos from icloud.  When I restored my phone from icloud, half of my pics and videos have been deleted, the pics that were restored on my phone are very blurry, and the videos won't play.  I get a message on my phone that says " the URL you are requesting is not found on this server".  I have erased and reset my phone twice, but every time I do it, more pics and videos are deleted.  I have backed up to icloud and iphoto, however, some of the pics are no longer on iphoto either.  Is there someway to get the videos to play on my phone again?  Make the photos not as blurry as they are now and to restore the pics and videos that have been lost?  I really would love to have them back, this phone is supposed to be the best and right now it doesn't seem to be.  Please help if you can.

    I too have noticed that once i restored from iCloud. Pictures blurry and videos wont play!
    Need help too!!

Maybe you are looking for

  • Error while sending message.

    Hi,Could anyone explain the below error message and tell me how can we solve this? Error while sending message: com.sap.aii.af.ra.ms.api.ConfigException: ConfigException in XI protocol handler. Failed to determine a receiver agreement for the given m

  • Syntax error in dreamweaver

    this message keep showing up in my code view in dreamweaver cs4 in one of my files, "There is a syntax error on line 24 of MXWidgets.js.php. Code hinting may not work untill you fix this error" how do i fix this pls also my date field with a date pic

  • HT3832 "Automatically add to iTunes" folder.  Where do my files go?

    Where do my pdf files go after I add them to the "Automatically add to iTunes" folder? They appear on my iPad okay, but I cannot find them on my PC any longer

  • Adding Images in JList?

    Hi guys, how do i add Images in JList along with Text? please help me here. cheers, Sachin

  • Coldfusion 10: How to "upgrade" existing "Developer License" to "Standard License"?

    Hello, we've bought a "Standard License" of Coldfusion 10 (Upgrade license from Coldfusion 9). Now I want to "migrate" an existing Coldfusion 10 Developer version (has been installed as "test version" and degrated to "Developer", now) to our new lice