Request.getParameter() from same page as HTML form

I have a jsp page with a form. form contains a textfield, once the user submits the form, i want jsp scriptlet to get the
value of the user input and carry out processing on it within the same page and give a result.
problem is the first time the page is loaded, there is an error in the request.getParameter() statement since no form has
yet been submitted i guess ....
if i use another page ... it works ... but i want to display the information in the same page ...
thanks

I'd like to see an example where you'd get a NullPointerException from the line
if(request.getParameter("foo") == null)
but not one from
if(null == request.getParameter("foo"))
In either case, the only possibility for a NullPointerException would be if your request variable were null (but this would cause a NullPointerException in either method). Otherwise request.getParameter() returns a null value if the parameter does not exist, but will not throw a NullPointerException.

Similar Messages

  • Is there a way to automatically add another of the same page while a form is being filled?

    Is there a way to automatically add another of the same page while a form is being filled?
    I have a two-page form of which the second page is essentially a spreadsheet analog.  Often, there is need for for more lines than are available on the page.  Is there a way in which to add another or even multiple copies of the second page? 
    Thanks ahead...
    TG

    You can do that with a dynamic XFA form created in LiveCycle Designer, which comes with Acrobat Pro for Windows. For more information, you can ask over at the LiveCycle Designer forum.

  • Submitting request.getParameter value on page submit

    I am getting the value from the request parameter as under
    <%
    String mod = request.getParameter("mod");
    %>
    Now i want this mod value to be submitted as page submits. For that i used:
    <h:inputHidden id="mod_field" value="" />
    Now the question is how to pass the above mod value using this hidden input? and secondly how to bind it with the property in the backing bean (say the name of my backing bean is bean.navigation) so that i can access and use the value.

    Hay this exception has again started showing me up.
    exception
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.el.ReferenceSyntaxException: param.mod
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    root cause
    javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.el.ReferenceSyntaxException: param.mod
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:854)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
         org.apache.jsp.tsheetRcode_jsp._jspService(tsheetRcode_jsp.java:344)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    root cause
    javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.el.ReferenceSyntaxException: param.mod
         com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:206)
         com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
         javax.faces.component.UIOutput.getValue(UIOutput.java:147)
         com.sun.faces.renderkit.html_basic.MenuRenderer.getCurrentSelectedValues(MenuRenderer.java:670)
         com.sun.faces.renderkit.html_basic.MenuRenderer.renderOption(MenuRenderer.java:549)
         com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(MenuRenderer.java:525)
         com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:481)
         com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:430)
         javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:712)
         javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:616)
         javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:539)
         com.sun.faces.taglib.html_basic.SelectOneMenuTag.doEndTag(SelectOneMenuTag.java:505)
         org.apache.jsp.tsheetRcode_jsp._jspx_meth_h_selectOneMenu_0(tsheetRcode_jsp.java:449)
         org.apache.jsp.tsheetRcode_jsp._jspService(tsheetRcode_jsp.java:263)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)

  • Post to authenticator from an external website / html form

    Is it possible to post to a authenticator from an html page containing the form located on an external website?
    I have developed a custom login module for the portal server, so I tried fiddling a bit and cheating with the states. Problem is the login module still expects to be called first for displaying the form... resulting in the fact that a form post to the authenticator displays the portal login form in stead of actually validating credentials right away.
    I am trying to achieve something like the login box topleft on http://mysun.sun.com/
    Anybody who has experience on this part and can help me out?

    What you might want to do is look at the way that the login provider has been built.(Usually available when using anonymous login).
    <INPUT TYPE=HIDDEN NAME="arg" SIZE=-1 VALUE="newsession">
    <!-- For different auth methods, the below params must be modified -->
    <INPUT TYPE=HIDDEN NAME="page" SIZE=-1 VALUE="1">
    <INPUT TYPE=HIDDEN NAME="Submit" SIZE=-1 VALUE="Login">
    This seems to almost just "pass" the credentials through to the authenticator. It also destroys the current session, and forces the portal to start a new session.
    You can find more info on this in the Release notes for SP3/SP4. See http://docs.iplanet.com
    HTH

  • After migration from SP2010 to SP2013 HTML Form Webpart doesnt works

    Hi,
    Before migration to SharePoint 2013, our html form webpart works fine in sharepoint 2010. After migrated our webpart was not working. When we tried to edit the html form webpart , and when we specified apply we got the
    following errors, Cannot retrieve properties at this time, as well cannot save you changes. Can anyone help us to sort this issue.
    Regards
    Nalwyn Nessiah.N

    Hi,
    According to your description, the HTML Form Web Part not working after upgraded to SharePoint 2013.
    What version of IE browser you use?
    Also please try to add a new HTML Form Web Part for a test to see if the issue still exists.
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • Request.getparameter with same name problem

    hi all ,
    can u please help me,
    my code ->
    <form>
    <input type= "hidden" name= "mid" id = "mid" value = "search" />
    </form>
    and m redirecting this jsp to another with url
    showDetails.jsp?mid="hello";
    String str[] = request.getParameterValues("mid");
    this str contains only hidden parameter value ie. search
    but i also want value appended to url
    can u please tell me how thats possible ?
    i don't want to use request.queryString() that is not a good answer.
    please tell me

    If you want to assign multiple parameter values to the same parameter name in a query string, you need the array notation. E.g. foo.jsp?name[]=value1&name[]=value2

  • How to use a JavaBean with request scope from one page to other page

    Hi,
    I want to use in one jsp file a javabean with scope of request for it, I use:
       <jsp:useBean id="entry" class="jsps.SaleEntry" scope="request" />and after in that page I make operations with it using the jsp:setProperty and jsp:getProperty operations
    My question is that if I want to get the result of that javabean in the following page, Have I to record the javabean doing : request.setAttribute(""objectId",id) and then in the following jsp page I can rescue the object doing: SaleEntry sE=(SaleEntry) request.getAttribute("objectId") ???
    or in the contrary, only using jsp:setProperty the information is available to recover it in the following jsp doing : SaleEntry sE=(SaleEntry) request.getAttribute("objectId") because setProperty records the information without need of doing : request.setAttribute(""objectId",id). ????
    Thanks with anticipation and sorry if it is a silly question but I am beginner in the use of JavaBeans

    Thanks Anthony,
    I'm working with Tigi on the same project and now I can tell you that the problem is solved.
    request.getRequestDisptacher("/myServlet");hehe, you switched the 't' and the 'a'
    <%@ include file="/myServlet" %>this is the one we use :)
    But what is the difference between the first one and the last one? Now We are using the last one because that's the shortest :) not a pretty good reason huh :)
    cheers,
    Soep

  • Extracting values from drop down buttons html forms

    Hello,
    I would like to know how to obtain the values which is selected through the drop down box. Iam using Java Script as a client side scripting lang..
    Here is my code so far..do let me know what to do further. Iam not getting the alert mesg which is sitting in the put() so let me know how the put method should work
    Thanks a lot
    avis
    <HTML>
    <HEAD>
    <script language="javascript" type="text/javascript">
    <!-- hide
    function put()
    choice = document.forms.Pri.list.optionsdocument.forms.Pri.list.selectedIndex]
    if (choice ="0")
    alert("enter state"+choice);
    function goto()
    Pri.list.options.value=" "
    //end -->
    </script>
    </HEAD>
    <BODY>
    <form name="Pri" method = "get" action="">
    State<SELECT NAME="list" onChange="put()">
              <OPTION>
    <OPTION>Alabama
    <OPTION>California
              </SELECT>
    <input type="submit" Value="Submit">
    <input type=button name="Reset" value=Reset onClick=goto()>
    </form>
    </BODY>
    </HTML>

    I'm not sure what you're talking about... if you don't select an option from the list, the onchange function isn't going to be called, so of course the the alert isn't working.
    You sound like you are complaining that when the form submits, the value for the select list is the first option (""). I fail to see why this is a problem. If the value is "", then you handle it like nothing was selected. In a single select list like that, an option is always selected. The whole point of having a blank option is to allow the user to pick it. Otherwise don't put a blank option.
    In general, you don't need to use a button to do reset, you use a reset button: input type="reset". And it'll reset on it's own.

  • Removing index.html from home page / remove .html tags from all other pages

    Hello All,
    I was wondering if there is a way to remove the index.html from my main page, so that www.mypage.com/index.html is simply www.mypage.com/. This also applies to all the other pages in the site, but only for the .html extension: www.mypage.com/contact.html becomes www.mypage.com/contact. Almost all sites I know do this, but I can't figure out the technique beyond working some crazy voodoo with Apache.
    Thanks in advance for your help!

    if 'index.html' is in your HOST server's default filename list, then you can omit its name from any link, e.g.,
    <a href="/">Home</a>
    That link will cause the server to load the default file found in the root folder of the site.
    This is actually the preferred way to link to your home page.

  • Dynamic Page truncating html form text item

    I have created a dynamic page that displays the system date on a form. When the
    page displays, the date truncates after the space or comma. ie.
    instead of displaying "Monday, December 30" it displays "Monday". If i remove
    the comma or spaces from the format, it will display ok. Is there some type of
    URL encoding I need to to.
    <FORM action="stars3.star_portal.process_student_att" method="post">
    <TABLE border="0" cellspacing=0 cellpadding=2>
    <TR BGCOLOR="#000063">
    <ORACLE>
    BEGIN
    htp.p('<TD ALIGN="CENTER"><FONT COLOR="WHITE">' );
    htp.p('<input type="text" name="T1" size="30" value=' ||
    to_char(sysdate,'Day, Month DD') || '>' || '</FONT></TD>');
    END;
    </ORACLE>
    </TR>
    </TABLE>
    </FORM>

    Hi,
    Yes, it is an encoding problem. You can make use of htp.formText to overcome this. The spaces and commas are interpreted properly with formText.
    Here is an example.
    <ORACLE>
    declare
    l_date varchar2(100);
    BEGIN
    select to_char(sysdate,'Month, Day, DD') dt
    into l_date
    from dual;
    htp.p(l_date);
    htp.p('<TD ALIGN="CENTER"><FONT COLOR="WHITE">' );
    htp.formText(cname => 'T1',
    cvalue => l_date,
    csize => 30,
    cmaxlength => 30);
    END;
    </ORACLE>
    Thanks,
    Sharmila

  • Restrict requester/approvers from  viewing/editing an object form field

    Dear All,
    We implemented 5 levels of approval workflow. The requirements is to configure the following permission on OIM:
    1. Requester is only able to view,insert dan modify 5 field out of 10 field on object form. The other 5 fields he can not view/insert/modify.
    2. The 1st until the 4th approvers can view only the 5 field the requester can view,insert and modify
    3. The last (5th) approver can view only the 5 field the requester can view,insert and modify but able to view/insert/edit the other 5 field that the requester and other approvers can not view.
    Any body know how to enable this configuration on OIM? basically this is to set the Object form field level permission.
    Your response is highly appreciated.
    Thank you

    You could have the final request process auto provision the final object and populate just the process form with the listed values as you pass them from one object form to another.
    You could use the API's to cancel each request as it gets approved which triggers the next resource object to be provisioned and populate the object form. Then the final approval would get completed and you could map those values to the process form for the final object. Then the user would only have one resource object on their profile. You could also limit which objects were viewable when the request was made by making them available to the organization as a generic object, then set it to system so it would be displayed in the list of availabel resources.
    -Kevin

  • Refresh the table found on the same page as the form

    Hi , I am doing an entry form where user will enter data that will be saved to the database. below is a table which consist of all the data entered by the specific user. When i submit the form the data is stored in the database. But the table is not refreshed. i Have to click on the header of one of the column to refresh the table how can the table be refreshed when i submit the data in the form ...
    Please help me
    Thanks
    Lutchumaya

    Hi,
    define a value of the ID property of the button. Set the same value to the PartialTrigger property of the table (or if this doesn't do it, to the surrounding af:form element)
    Frank

  • Full request deletion from same datasource in different R/3 systems.

    Hi,
    I have a cube in which data is full loaded . I have a two R/3 Systems e.g. A and B.  there is a standard datasource which is loading data as a full load. this same datasource is pulling data from these two R/3 Source system i.e. A and B. Now My problem is I want to remove earlier data from the same datasource from cube before new data arrives in the cube.
    There are settings to be done at infopackage level, I want to know what setting shall I do so that only source system relevant data get deleted from the cube before new data with full load arrive in the cube.

    Hello,
    you need to check:
    Datasources Are the same
    Source Systems Are the same
    Selections are same or more comprehensive
    When you start the infopackage manually, it will ask you to confirm deletion of data packages.
    BR
    Ondrej

  • JSF: how to add new record in datatable from same page

    Jdeveloper : 11.1.2.2.0
    using ADF i want to create a page that contains a datatable, input text field and a command button.
    when i press the command button i want the text in the input text field to be inserted as a new record in datatable.
    what is the best practice for that ? how to get the value of the input text field and insert it?
    thanks in advance :)

    thanks so much that really helped :)
    the solution is to do it programatically in a managed bean :)

  • Accessing form field on a page with JSP code on the SAME page

    Hello people,
    This is what i want to do...
    I need a profile form for my project wherein the user can update his profile.
    it has a username field. I want the username to be changeable at any point of time.
    if the user wishes to change his username he simply goes to the Change_Profile page (the one im talking about) and changes it.
    But the username should not conflict with the username that any other member might have already chosen
    so i put a button on the form right below the field "username" for the user to check for the username's availability.
    I want the following things to happen when the user types a username and clicks on this button (which is not a submit button)
    1. I want to access my MS SQL 2000 server database and check for all usernames accepted by that form
    2. I want to compare each with this username
    3. I want to show the result to the user on the very same page+*. that is "Username available" or "Username Taken"
    4. I want to show the result using an alert message from javascript+*
    help me if u can please.

    1. Don't do SELECT * FROM users for fun unless you want to list them all to the client.
    2. Use a WHERE clause in your query and just check if it returns zero rows or not.
    3. Let the servlet with the business logic forward the request to the same page using RequestDispatcher.
    4. Let the JSP print the Javascript code to the response based on a condition.

Maybe you are looking for

  • How to resolve errors (-50 and -8058) when moving Time Machine backups to new disk?

    I'm trying to move my Time Machine backups (about 600GB total) to a new external hard drive.  I started the process last night, but after an hour or so received two errors, each repeated multiple times: "The operation couldn't be completed because an

  • ....Date Type in Oracle

    Hi All, Just to clear a few misconception/ambiguities regarding the DATE data type in Oracle. We hve a table which stores the date of insertion of a record. The front end application is in PHP while backend is in oracle. When i query the table, it sh

  • Use of Business Service Contro and Registry Console

    Hi All Oracle Fusion Middleware Service Registry 11g will provide two user interface control A. Business Service Control B. Registry Console I am going through the Oracle Fusion Middleware Service Registry Guide 11g provided by Oracle and figure out

  • Key event handler

    What is the best approach to handling key events (listening for keys being pressed)? Are there any widgets out there for this purpose? Just do it in JavaScript? Thanks

  • Want to purchase something but they keep asking for ITunes support for transaction

    I wanted to purchase something for my game but they keep on asking for iTunes's support for transaction,why and how to solve it?