Get a parameter from a Request

Hello everybody,
I noticed that there is not a method like request.setParameter(...,...), so i was wondering if i can use the method request.setAttribute(...,...) to put an object in the request and then get it with the method request.getParameter().....;anyway what is the difference between a Parameter and an attribute in the request object?
Cheers.
Stefano

Hello,
Basically the difference I see is that a request's parameter is information that is already part of the request. An attribute is something that you add into a request and is not essential to the object. As for putting an object in there it can be done with the setAttribute just as you mention.
Hope this helps

Similar Messages

  • How to get a parameter from each request in a session scope BackingBean

    While calling my JSF page, I pass an id as parameter in the URL, and in the Backing bean I retrieve it from the request.
    On each request I need to get the id and populate the page accordingly.
    But I am forced to create my Backing Bean in session scope b'cos otherwise ValueChangeListener method does not work properly.
    So where and how do I get the id on each request?
    Pls. help

    What you can do is create it in the request scope like this:
    <managed-bean>
          <managed-bean-name>personBean</managed-bean-name>
          <managed-bean-class>
            com.PersonBean
          </managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
           <managed-property>
                 <property-name>id</property-name>
                 <property-class>java.lang.Long</property-class>
              <value>#{param.id}</value>
          </managed-property>
    </managed-bean>And then in the page use a hidden field to set the id in case of a postback (validation error):
    <h:inputHidden id="id" value="#{personBean.id}"/>Does that help you?
    Thomas

  • Can viewObject get a parameter from sessionScope to binding variable?

    hello,
    using Jdev11g ADF Fusion application
    Can viewObject get a parameter from sessionScope and assign into binding variable ? without using executeWithParameter
    Thanks
    greenApple

    A. Safwat,
    As I said before, I was not trying to be offensive, but simply to explain some of the shortcomings of one solution over another. One of the reasons people give such short answers is that many questions (including this one) have been asked and answered many many many times before on the forum. As to my reasons:
    1). Overkill - overkill because you are writing code to do what the framework already provides for you.
    2). Not bind-variable friendly - you are gluing in literals into a SQL statement. That means that Oracle will have to hard parse the query for each new value of the filter clause, yielding to poor performance, particularly in a multiuser environment. It should ideally be done using bind variables.
    3). Insecure (think about what happens if you put "'xyz' or 1=1" into the filterValue there) - not using bind variables is a security hole. Think through what happens if a filter criteria comes through like the one I mentioned.
    4). Inflexible - because you are overriding executeQueryForCollection, this VO becomes inflexible and can only be used in this particular place. Using the declarative approach outlined by Timo is more flexible
    5). Bad (ok, that's my opinion there) - OK, perhaps this was a bit offensive ;)
    Please don't take a critique of a post as offensive, as I assure you it was not intended to be in that spirit. As I mentioned, I greatly appreciate when people point out issues/problems/etc with my ideas, as that is the best way for me to learn. I have in the past written applications that were not bind-variable friendly, and I learned the downsides the hard way (system was horribly non-performant) - I wish someone had reviewed my approach and told me "bad idea" before the application made it into production.
    Respectfully,
    John

  • How to get a parameter from BPC and use it in ABAP program

    Hello gurus!
    I got a problem...
    SAP BPC will send parameters such as year, division, category, company code and so on via script logic to SAP BW.
    I need to get these parameters from BPC and use them in a ABAP program as a filter.
    This ABAP program will do several routines and return new values to BPC. It must be made on ABAP and I need to filter data to avoid performance issues.
    Does anybody knows how to do it? or have a example of it?
    Thank you in advance.
    Regards,
    Rubens Kumori

    Hello, I'm looking for a suggest.
    I need to pass two parameters (users can input them in a data manager package in bpc) to a BAdI.
    In this BAdI I write a code that store those parameters in a InfoObject.
    The problem is:
    - one parameter is for CATEGORY value. CATEGORY is a dimension of the application and I read the value with a code like this:
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = 'C_CATEGORY'.
    - other parameter is a generic DATE. this parameter is not a dimension of the application and I don't know how I can retrieve this value in BAdI.
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = '.....'.
    The data manager dynamic script is:
    PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%")
    PROMPT(TEXT,%SELECTED_DAY%,"Write the date (format YYYYMMDD)",)
    I also have a dynamic constant that assign the name %CATEGORY_DIM% to "C_CATEGORY" value.
    Can anyone help me?
    thanks a lot
    Edited by: Luca Novali on Feb 13, 2012 3:49 PM

  • How to get the parameter from Java Script into the Parameter crystal Report

    Hi All,
    Crystal Report is integrated with Oracle 10g. I created the base SQL query for col1, col2, col3 and col4. Java Script pass parameter value (185) to Col1.
    My question is how to create crystal report to make Col1 as parameter and how to get the parameter value 185(Col1) from Java Script. Is there any additional code I need to include in the crystal report?
    FYI.
    Java script sends the right parameter value.There is no issue in java script.
    This is an automatic scheduled process when batch runs, Java script should pass the parameter value and the crystal report should get the value and produce the output report.

    Not sure if this is an application question or if you are trying to hook into Crystal Reports parameter UI? If the later then no option other than report design. If an application then I can move this to the Java Forums.
    If you are asking how to alter the parameters I suggest you remove the Java reference and post a new question so it's not confusing the issue.
    Please clarify?

  • To get date Parameter from an OAF page

    Hi,
    I want to get a date parameter from an OAF page and pass them to a query in Vo as binding variables.
    How can that be done.
    I tried this to get the date from my page but it gives an error when I pass it to the query-
    String v_date = pageContext.getParameter("StartDate");

    My CO --------------------------
    if( pageContext.getParameter("Submit") != null)
    String userid = (new Integer(pageContext.getUserId())).toString();
    String personid = (new Integer(pageContext.getEmployeeId())).toString();
    String v_date = pageContext.getParameter("StartDate")+"";
    String v_end_date = pageContext.getParameter("EndDate")+"";
    System.out.println("call to process request0 : " + userid);
    System.out.println("call to process request0 : " + personid);
    System.out.println("call to process request0 : " + v_date);
    System.out.println("call to process request0 : " + v_end_date);
    Serializable[] params = {personid,v_date,v_end_date};
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    String empUserid = pageContext.getUserName();
    System.out.println(pageContext.getUserName());
    System.out.println("Calling initMoverQuery");
    am.invokeMethod("initMoverQuery", params);
    System.out.println("Call out of initMoverQuery");
    My AM------------------------------------------------------------
    public void initMoverQuery(String pid,String sd,String ed)
    System.out.println("In init Query of AM" +pid);
    EmployeeMoverVOImpl vorep = getEmployeeMoverVO1();
    Number personid = new Number(Integer.parseInt(pid));
    System.out.println("user id"+ personid);
    System.out.println("start date"+ sd);
    System.out.println("end date"+ ed);
    if (vorep == null)
    MessageToken[] tokens = { new MessageToken("OBJECT_NAME", "EmployeeMoverRepVO1")};
    throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", tokens);
    if (!vorep.isPreparedForExecution())
    // vorep.initQuery(personid,sd1,ed1);
    vorep.setWhereClauseParam(0,personid);
    vorep.setWhereClauseParam(1,sd);
    vorep.setWhereClauseParam(2,ed);
    vorep.executeQuery();
    System.out.println("End SP VO Query");
    }

  • Getting XML result from Oracle request

    We have Oracle 8i Entreprise Edition and We like to get XML result from an Oracle request. Can I use only Oracle 8i Entreprise Edition product or should i use another oracle product to do this job ?
    Thank you

    Download our XSQL Pages technology with the XSQL Servlet and you'll be in business in no time. If you want to just get XML programmatically from SQL in your own programs, you can try the XML SQL Utility (which XSQL Pages makes use of under the covers). XSQL Pages comes with lots of demos and a tutorial.

  • Get Date parameter from request

    hi all,
    i've a JSP in which there is a date field, in the JSP i'm declaring a date variable and use request.getParameter but the date variable store another date with time part while i want the entered date without time part...any help?

    My CO --------------------------
    if( pageContext.getParameter("Submit") != null)
    String userid = (new Integer(pageContext.getUserId())).toString();
    String personid = (new Integer(pageContext.getEmployeeId())).toString();
    String v_date = pageContext.getParameter("StartDate")+"";
    String v_end_date = pageContext.getParameter("EndDate")+"";
    System.out.println("call to process request0 : " + userid);
    System.out.println("call to process request0 : " + personid);
    System.out.println("call to process request0 : " + v_date);
    System.out.println("call to process request0 : " + v_end_date);
    Serializable[] params = {personid,v_date,v_end_date};
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    String empUserid = pageContext.getUserName();
    System.out.println(pageContext.getUserName());
    System.out.println("Calling initMoverQuery");
    am.invokeMethod("initMoverQuery", params);
    System.out.println("Call out of initMoverQuery");
    My AM------------------------------------------------------------
    public void initMoverQuery(String pid,String sd,String ed)
    System.out.println("In init Query of AM" +pid);
    EmployeeMoverVOImpl vorep = getEmployeeMoverVO1();
    Number personid = new Number(Integer.parseInt(pid));
    System.out.println("user id"+ personid);
    System.out.println("start date"+ sd);
    System.out.println("end date"+ ed);
    if (vorep == null)
    MessageToken[] tokens = { new MessageToken("OBJECT_NAME", "EmployeeMoverRepVO1")};
    throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", tokens);
    if (!vorep.isPreparedForExecution())
    // vorep.initQuery(personid,sd1,ed1);
    vorep.setWhereClauseParam(0,personid);
    vorep.setWhereClauseParam(1,sd);
    vorep.setWhereClauseParam(2,ed);
    vorep.executeQuery();
    System.out.println("End SP VO Query");
    }

  • Display tag: how to get pagesize parameter from TableDecorator?

    Hi all,
    I'm designing�org.displaytag.decorator.TableDecorator wrapper for our project, but I need to get pagesizeparameter from TableDecorator and I don't know - how to do it :(
    Any ideas?
    ps. http://www.displaytag.org used

    Not sure if this is an application question or if you are trying to hook into Crystal Reports parameter UI? If the later then no option other than report design. If an application then I can move this to the Java Forums.
    If you are asking how to alter the parameters I suggest you remove the Java reference and post a new question so it's not confusing the issue.
    Please clarify?

  • Cannot get OUT parameter from stored procedure

    Hi,
    I am new to stored procedure programming. I wrote a simple java stored procedure as follows:
    package fvt;
    import java.sql.*;
    import java.io.*;
    public class FVTProcedures
    extends COM.ibm.db2.app.StoredProc {
    public void addRecord(int id, String name, int status)
    throws SQLException {
    java.sql.Statement stmt = null;
    java.sql.Connection con = null;
    PrintWriter pw = null;
    try {
    status =3;
    pw = new PrintWriter(new FileWriter("c:/temp/fvtproc.txt"));
    pw.println("starting...");
    // get connection
    con =getConnection();
    pw.println("Got connection");
    stmt = con.createStatement();
    stmt.execute("INSERT INTO cmtest (id, name) values (" + id + ",'"+name+"')");
    pw.println("Inserted the record");
    if (!con.getAutoCommit()) {
    con.commit();
    pw.println("Committed the connection");
    catch (SQLException sqle) {
    pw.println(sqle.getMessage());
    catch (Exception e) {
    pw.println(e.getMessage());
    finally {
    status =2;
    pw.close();
    try {
    if (stmt != null) {
    stmt.close();
    catch (SQLException sqle) {}
    try {
    if (con != null) {
    con.close();
    catch (SQLException sqle) {}
    Then I use the following sql command to create this stored procedure, especially register status as OUT parameter.
    CREATE PROCEDURE addRecord (IN id INT, IN name VARCHAR(20), OUT status INTEGER)
    FENCED LANGUAGE JAVA EXTERNAL NAME 'fvt.FVTProcedures!addRecord' PARAMETER
    STYLE DB2GENERAL
    My java program calling this stored proc is as follows:
    import java.sql.*;
    import javax.sql.*;
    public class CallableStmtTest {
         COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource ds = null;
         public static void main(String args[]) {
              CallableStmtTest dt = new CallableStmtTest();
              try {
                   dt.test();
              } catch (Exception e) {
                   e.printStackTrace(System.out);
         public CallableStmtTest() {
              ds = new COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource();
              ds.setUser("username");
              ds.setPassword("password");
              ds.setDatabaseName("database");
    public void test() {
    java.sql.Connection conn = null;
    CallableStatement cs = null;
    String sql = "CALL ADDRECORD(?, ?, ?)" ;
    try {
    conn = ds.getPooledConnection().getConnection();
    conn.setAutoCommit(false);
    System.out.println("Got the connection");
    cs = conn.prepareCall( sql ) ; /* con is the connection */
    System.out.println("Callable statement is prepared");
    cs.registerOutParameter(3, java.sql.Types.INTEGER);
    cs.setInt(1, 1001 );
    cs.setString(2, "1001");
    cs.execute() ;
    System.out.println("Callable statement is executed, return status: "+cs.getInt(3));
    conn.commit();
    catch(SQLException sqle) {
    sqle.printStackTrace();
    finally {
    try {
    if (cs!=null) {cs.close();}
    catch (SQLException sqle1) {
    try {
    if (conn!=null) {conn.close();}
    catch (SQLException sqle1) {
    However, the out put is always
    Callable statement is executed, return status: 0
    while i expect to be
    Callable statement is executed, return status: 2
    Can anyone tell me what's wrong with that?
    thansk,
    JST

    public void addRecord(int id, String name, int status)
    throws SQLException {
    status =3;In regular java you are never going to see this value (3) outside of that method. Java doesn't work that way.
    So unless java inside the DB works really differently from regular java, you are going to have to pass something else.

  • How to get a parameter from a HTML  select list in a servlet

    Hi!
    I have the following problem :
    In a HTML form I have the following select list:
    <select name="tickets">
                                            <option value="1">1</option>
                                            <option value="2">2</option>
                                            <option value="3">3</option>
                                            <option value="4">4</option>
                                            <option value="5">5</option>
                                            <option value="6">6</option>
    </select>And in the servlet I try to read the value I have selected doing : String tickB = (String) request.getParameter("tickets");But for my amazement tickB always has the value 1, althought I have selected in the list the value 2,3,4,5 or 6
    �Where is the error ? �Have I to do with getParamaterValues instead getParameter to obtain the correct value?
    Bye
    Edited by: bladu on Jun 4, 2008 1:25 AM

    Where is the error ? No error in portion of code you have shown.
    But for my amazement tickB always has the value 1, althought I have selected in the list the value 2,3,4,5 or 6Are you sure there are no other form element(hidden field, text field) with same name tickets ? If you are using GET method, you may check the url to see if there are more than one parameters named tickets set in it
    Have I to do with getParamaterValues instead getParameter to obtain the correct value? Not required.

  • Get the parameter from the URL

    Hello
    I have a problem. I want to know the id that is in the url of an extern site. For example http://www.example.com/employer.jsp?id=1234
    Does anybody know how I can get the value 1234 fom the url. I have no idea but it is very important for me.
    Please help me,
    Henk

    oic. If the document location according to the browser is that URL with the id or whatever, then you could use Javascript to set the value of a hidden form field:
    <body ... onload="document.forms['myform'].submit();">
    <form name="myform" ... onsubmit="this.url.value=document.location.href; return true;">
    <input type="hidden" name="url" />
    Of course, that'll submit the form on load, you can change that part if you want.
    If the page is in a frameset and you want the top page's location, you can do:
    <form name="myform" ... onsubmit="this.url.value=top.document.location.href; return true;">
    But, the browser is going to have the location of whatever page it thinks it's viewing, and if it got there by a redirect, it'll show the page it is on, not the page it was redirected from. For forwarding, it'll still think it is on the page that did the forwarding, not the end page. In other words, whatever you see in the brower's location bar should be what you'll get.

  • Cannot get the parameter from a HTML page at the first time

    Hi everyone,
    I have a html page with <input name="username" ...>, and the submit action is a url to my JSF web application. In the start page of the JSF webapp, I use following code to get value of username.
    FacesContext facesContext = javax.faces.context.FacesContext.getCurrentInstance();
    String userName = (String)facesContext.getExternalContext().getRequestParameterMap().get("username");
    However, I cannot get it at the first time. The strange thing is if i click "refresh" button, the value of username is shown up on my page.
    Why? and How to solve it?
    Thanks in advance,

    Hi,
    Are you putting this code in the public void preprocess() method?
    Check out
    http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/app_model.html
    The assumption is that Creator is being used.

  • Get init parameter from JSP

    Hello folks
    First of all, I want to say sorry for my English.
    Well, I have one jsp file and I want to pass one value from web.xml file to it but I don't know how
    I also did the same thing with servlet and it's OK, I used function getInitParameter in ServletConfig and modified file web.xml in Tomcat 3.2.
    Please help me
    Thanks in advance.

    Hi,
    For example, if your web.xml has something like:
    <context-param>
    <param-name>testParam</param-name>
    <param-value>[email protected]</param-value>
    </context-param>
    You can access the "testParam" init param from within your JSP scriptlet as:
    String value = getServletContext().getInitParameter("testParam");
    where "testParam" matches the <param-name> element of one of these initialization parameters.
    Hope that helps.
    Regards,
    Senthil Babu
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • Getting No Reply from SNMP Request to Windows 2012 Server

    SNMP Community string has been properly configured using Properties against SNMP Service in the list of services under Computer Management/Services and Applications/Services.  SNMP Service was properly installed using Add Roles and Features.  The
    server and the client were both rebooted (restarted).  As near as I can tell (Norton is in control of the firewall on the client) the firewall on both computers has been disabled.  The program that I am using has worked in the past against Windows
    2008 with SNMP Service configured and against motion picture theater projectors.  What else can I try?
    MARK D ROCKMAN

    Hi,
    Type netstat –an at a command prompt, and then press
    ENTER. To confirm that the SNMP service uses the correct User Datagram Protocol (UDP) ports:
    UDP port 161 for general SNMP messages.
    UDP port 162 for SNMP trap messages.
    If these ports are being used by another service, you can change the settings by modifying the local services file on the agent. The services file is located in the
    %systemroot%\System32\Drivers\Etc folder.
    If you find another service or program that binds to UDP port 161, stop the automatic startup of that service or program.
    It is just a suggestion that SNMP is deprecated for Windows Server 2012. Instead, use the Common Information Model (CIM), which is supported by the WS-Management web services protocol and implemented as Windows Remote Management.
    Best Regards,
    Eve Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Maybe you are looking for

  • XML versions supported in XML Publisher 5.6.2

    Hi everyone, can someone tell me, which versions of the XML specification - XSLT 1.0 or XSLT 2.0 - XPath 1.0 or XPath 2.0 are supported in the rtf templates of XML Publisher 5.6.2? Thanks in advance

  • New Computer Cannot Open Old Encrypted Emails

    I have a user that has recently been set up on a new computer copying their .pst from an older system. The previous computer was running Windows 7 32bit w/ Office 10 and the new one is running Windows 7 64 bit w/ Windows 10. The user can open recentl

  • Google maps in israel?

    i've had the software upgrape fo a while now, and knew that the maps app didn't show the streets in israel, but i thought that it just didnt have the streets for many small countries. but i was looking a little closer today and realized that there it

  • Creating 2nd library

    Hey all, this is my motivation for doing this: my wife's pics reside within the original library and I don't want to mess with it. Need to download 40 or so pics in a new space and after a week delete. This will probably involve at least 'rotating im

  • Premiere Elements 11 video editor crashing

    Hello! We just bought Premiere Elements 11 to make short (less than 5 min) videos for work. The program is frequently crashing while editing (happening on both computers, so I'm thinking it's either how it's been installed or the company firewall may