Request attribute vs parameter

Hi all,
I am getting confused of request attribute and request parameter. What i understand is that a parameter is a piece of info that send with the request. Such that infomation (parameter) come from a form component (text field, radiobuttion,selection...). By using servlet.getParameter("my text filed") i can retrieve what user enter into the form.
In the similar maner, if from one servlet, i use request.setAttribute("a message","content of a message") i can also retrive the content of the message from another servlet using getAttribute.
In short, parameter is for form-servlet communication and attribute is for servlet-servlet communication, am i correct? Can I change the parameter of the request from a servlet?
Is there any other different between these 2?
Thai
Message was edited by:
lnthai2002

I still dont get it. You said
HttpServletRequest doesnt have get/setAttribute(arg0, arg1) method.
But it does. http://java.sun.com/javaee/5/docs/api/
Again, my concern is whether i can exchange value of parameter and attribute. Assuming the following scenario:
a user want to access a protected servlet /financial. This servlet notice that the user has not been login yet. Thus, it record the url of the request as a attribute:
//inside /financial servlet
if((req.getSession(false).getAttribute("curUser")) == null)
      dest="/WEB-INF/docs/authentication/login.jsp";
      req.setAttribute("oriUrl",req.getRequestURL());
      } then it forward the request to login.jsp. After user input his infomation, the login.jsp send a NEW request with the user's credential to the /authentication servlet. Now, as you can see, when the authentication servlet receive the request, it doesnt know that the user was trying to access the /financial servlet before because the oriUrl attribute is lost. What i getting at here is how I can retain the oriUrl attribute over requests? I need to capure that attribute and associate it with a new request as a parameter. But HOW?
Hope you can help
Message was edited by:
lnthai2002

Similar Messages

  • Lost of request attribute

    Hi,
    I have a form (form.jsp) that contains this line of code :
    <% request.setAttribute("dbOpType","1"); %>
    This form as also a commandButton that calls the following bean method :
    public String delegate(){
    System.out.println(request.getAttribute("dbOpType");
    The delegate method always prints "null", the request attribute "dbOpType" is then lost and i don't understand why. I don't want to patch the problem by adding my attribute in the session.
    Someone have an idea?
    Thank you.

    Thanks for the tip but it seems that i cannot pass expression to the value field like this:
    <f:attribute name="dbOpType" value="<%=request.getParameter("dbOpType") %>"/>
    I get a compile error...
    I juste want to be able to read my request parameter in my bean method at the application invocation phase...

  • 'Requested attribute is invalid' error

    I'm attempting to programmatically get (and ultimately set) camera attributes with CVI. I can get some attribute values, such as ROI_WIDTH using the imgGetAttribute function, but not all, and not the ones that I really need to access, which are 'Exposure Time' and 'Gain Value'. I can see and set these exposure time and gain value camera attributes in MAX. However, when I attempt to use the imgGetCameraAttributeString function in IMAQ to get these attributes, I get the error 'The requested attribute in invalid'. My camera is the Basler acA2040-180km. In all other respects - snapping, grabbing, etc. the camera interface works fine.
    I cannot see what I am doing wrong or what piece I am missing, but it is obviously something. I took the NI example 'Analog attributes' as a starting point but that yields the same errors. How can MAX manipulate these camera attributes but I cannot in CVI? Is there some setup piece that is missing? 
    I'm kinda new to this environment, but would much appreciate any help anyone has.
    Thanks in advance,
    Wayne Showalter
    Solved!
    Go to Solution.

    Hi Wayne,
    IMAQ differerentiates in behavior and API with respect to 'IMAQ attributes' (defined by the IMAQ driver) and 'Camera Attributes' (defined by the camera file). All the ones with fixed constants (like ROI_WIDTH) are IMAQ attributes while the ones that specifically set something in the camera are camera attributes. You'll need to use the Get/SetCameraAttribute API for those. There are different functions for String vs Numeric attributes. I suspect if you call it with imgSetCameraAttributeNumeric() it will work.
    Eric

  • Set request attributes from the request attributes

    Using struts chaining actions.
    When using chaining the requestAttributes are lost.
    Is there a way to get all the request attributes and set them back to the request again?
    if so how to do this?
    Thanks.

    Looks like nobody knows :(
    It seems odd that nobody's tried to get InputSelectLOV or DataHandler working with a Struts app...
    ... anyway, on to finding out why the thing's throwing my releasemode away. This really is very like swimming through treacle :(

  • Use request attributes in JSF

    Is there a way we can pass data from one form bean to the other using request attributes insted of session attributes?
    I am able to work with session attributes using
    HttpSession mySession = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true); and setting attributes to it, but getting null pointers(occassionally) when I retrieve the atribute and work with it.
    getSession(false) isnt helping either.
    Looks like facesServlet is creating a new request when it forwards to next page. Any idea on how to get the Faces Servlet do something like request despatcher forward, for navigation so I can work with request attributes?
    Appreciate your input.

    Can I have just one backing bean and use it for all jsps in the app? App has 4 flows from home page and mutiple jsps in each flow. Each jsp has multiple form fields. Is that OK?
    Any way to passing data/objects between different backing beans - other than using session attributes? I had similar problems working on Struts app as well.

  • How to access request attributes in a portlet?

    Hello Experts,
    request.getParameter() in the reset method works fine in a pageflow but doesnt work in a portlet or a portal and always returns null for all the attributes/parameters,is there any special way of getting the request attributes in a portlet..any wrapper class around the original HttpRequestObject..Please let me know.
    Thx!

    Found the answers:
    1. The service Impl should implement the javax.xml.rpc.server.ServiceLifecycle interface.
    In this way you get access to a javax.xml.rpc.server.ServletEndpointContext, which gives access to amongst others javax.xml.rpc.handler.MessageContext, which gives access to request information
    2. In the Handler it is possible to store information on the MessageContext, which can be accessed in the service Impl (see 1.).
    Groeten,
    HJH

  • Is there a problem with too many request attributes

    I am fairly new to jsps and this is a best practices question
    I find that adding request attributes to my jsp is easy way to get data referenced in the jsp. Is this a bad practice and what is the ideal way to pass data to the jsp?
    Thanks.

    Putting attributes into the request scope if perfectly fine.
    If there are a lot of attributes though, grouping them into beans and just setting one bean in the request scope would be better.
    eg if you wanted to display a users details on screen, you COULD do
    request.setAttribute("username", user.getUserName());
    request.setAttribute("usercountry", user.getCountry());
    OR
    request.setAttribute("user", user);
    and on your JSP page
    <jsp:useBean id="user" ... />
    <%= user.getUserName() %>
    or with EL ${user.userName}
    Cheers,
    evnafets

  • Change/Edit Request Attributes in CUP at Approval Stage

    Hi All,
    We have SAP GRC AE/CUP 5.3 SP07 installed in our environment. In our work flow of the request, there is a requirement that some of the request attributes need to be changed by the role owner/ approver at the approval stage of the request. The request contains both SAP standard as well as some custom attributes. I only see an option to edit the validity date or the roles/profiles of the request at the approval stage. Is this option configurable? If not, do we have any work around to achieve the requirement?
    Thanks, Anil

    Hi Harleen and Alpesh,
    We are in GRC 5.3 SP8 and we would like to allow approvers in each stages to change the validity date (e.g. Valide to date) in a role request.   Here is the situation:
    I have a workflow path which has two approval stages.   Both stages were configured to allow "Change Request Content".    What I noticed is the approver in the first approval stage can change the validity date and then approve the request.    But when the request is on the 2nd approval stage, the approver can no longer modify the validity date.  
    Is this the same scenario which Harleen said that "You cannot edit the information of a request once it enters the approval stages"?   If this is the same scenario, do you know whether a fix is considered by  or available from SAP? 
    There may be situations where we don't want the 2nd approver to overwirte what 1st approver has approved.   However, in some situations we may want to keep that flexibility to let the later approver to have the last say.
    Thanks for your input.

  • FRM-47007: Cannot get parameter WUC_DATA attributes from Parameter List: in

    Hi,
    I am pretty sure this is a webutil message. I am running 10g through OC4J, all was working well one minute then on startup of the form I get these 2 message 4 or 5 times:-
    FRM-47007: Cannot get parameter WUC_DATA attributes from Parameter List: invalid list ID.
    followed by:
    FRM-47007: Cannot get parameter WUC_DATA_MULTIPART attributes from Parameter List: invalid list ID.
    These 2 message are repeated 4 or 5 times then things appear to run fine, I can open and read files, transfer them etc. The only thing I can think I have done differently is add a bean to a data block but when I remove the bean and restart the OC4J I still get the messages.
    Any ideas?

    Fixed,
    I dropped the WEBUTIL object group then added it again by adding the object library then subclassing it to the object group. The error messages are gone.
    Cheers

  • Passing Request Attributes in betweeen pageflow Portlets

    Hi
    How to pass Request Attributes in between Pageflow Portlets
    I tried with ScopedServletUtils class but it's not working for me
    Thanks

    Consider using events to pass data between portlets. Refer to docs about
    Interportlet Communication (IPC).
    Subbu
    Srinivasa Reddy Kapidi wrote:
    Hi
    How to pass Request Attributes in between Pageflow Portlets
    I tried with ScopedServletUtils class but it's not working for me
    Thanks

  • Question re a branch's REQUEST attribute

    Can somebody explain to me the purpose of a branch's REQUEST attribute?
    When a button is pressed, its name is placed into the REQUEST application-level item. If it is a Submit button, processing will then take place and a branch that meets the conditions that are set will be run. So what is the point of having a REQUEST attribute in the branch itself? Thanks.

    For an example let's suppose you want to execute same PL-SQL block when submit or save buttons are pressed. If you write this on button pressed, you have to write two blocks of code, one to be executed after Submit and another for Save, whereas if you just assign a request after pressing a submit/Save button you can execute one single block based on the condition, "When Request contains- Save or Submit".
    --Manish                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Is deriving or check Change Request attributes in DERIVE_ENTITY or CHECK_ENTITY

    Hi,
    I'd have a requirement to derive or check  the Change Request attributes like Change Request Reason and Change Request Priority , e.g if CR Priority is empty, set to a specific value or Check if Change Request Reason is set.
    I know via an OSS message that we are not able to derive or check CR attributes using BRF+ but can we derive or check using the BADI?

    The BRF+ and BAdI solutions are directed more towards the master data entities. If you "only" want to default or check the CR header, then one idea is to enhance the CR Header handler class. Please see this document that describes how to enhance the CR Header. You don't need to add a field, but you can learn the technique of adding checks, etc. to the GenIL model handler class.
    Enhancement of the User Interface Building Bloc... | SCN

  • JSTL EL : Getting the type of all request attributes

    I want to loop thru all the request attributes and displaying their type or className. I wanna do that using jstl (no scriptlets).
    In the following code, what el expression shall is use for the value attribute of the c:out tag ?
    <c:forEach items="requestScope" var="currentAttribute">
    <c:out value="????"/>
    </c:forEach>

    Its a bit annoying, but I am curious as to howthis
    is important?not so much. i just didn't expect JSTL not to provide
    any way to achieve such a simple task.Yeah, things get complex when you try to make a unified approach of accessing things (the dot operator for both accessing properties through get/set methods, and for accessing values in a collection or array...). They had to choose one of the other for default behaviour I guess...
    If it really is, and you are using a JSP 2.0server,
    then maybe you can write up a utility function
    library that contains a Boolean instanceOf(Object
    obj, Class type) method, or String
    getClassName(Object) method...You mean a function like the jstl functions
    (startsWith, contains...)?Yeah. They aren't too hard, especially if you have any experience with custom tags (more importantly with TLDs and how to pack custom tags...)
    You just make a class with a bunch of public static methods. Then you create a TLD that defines the library name, URI, and what methods map where... You pack the class in a JAR, put the TLD in the META-INF directory and put the JAR inside your WEB-INF/lib directory. You access them just like you would the JSTL functions.

  • Scope of request attributes

    Hi
    I have a question regarding the scope of the request variables when frames are used.I have a link from which i go to an action and store some variables in req scope and will reach a jsp which is made up of three frames and the middle frame is a jsp which in turn comprises of frames.Now in these jsps i am not able to access the request attributes.
    For ex
    action path="/login" type="LoginAction" name="LoginForm" validate="true" input="/login.jsp"
              forward name="operator" path="/index.jsp"
    and the index.jsp is
         <frameset framespacing="0" border="0" rows="55,80%,23" frameborder="0">
              <frame name="top" scrolling="no" noresize target="middle" src="top_frame.jsp">
              <frame name="middle" target="bottom" src="home.jsp" scrolling="no" noresize>
         <frame name="bottom" src="bottom_frame.jsp" target="middle" scrolling="no" noresize>
    </frameset>
    and the middle part in the above frame ie home.jsp is like
    <frameset framespacing="0" border="0" rows="55,80%,23" frameborder="0">
              <frame name="middle" target="bottom" src="body1.jsp" scrolling="no" noresize>
         <frame name="bottom" src="body2.jsp" target="middle" scrolling="no" noresize>
    </frameset>
    The problem is that these request variables are not available yo body1.jsp and body2.jsp.........whats the best way to make these attributes available to these pages also ...............

    Pass them along...
    <%
    String someValue = "myIDsomethingOrOther";
    %>
    <frameset ... >
    <frame src="page1.jsp?id=<%= someValue %>" ... />
    <frame src="page2.jsp?id=<%= someValue %>" ... />
    </frameset>But other then that, no.

  • Return-to="currentPage" - Not able to get request attribute in page

    My JPF portlet has request "Request Attribute Persistence" as session.
    The Page Flow Refresh Action attribute is "refreshAction".
    My refreshAction annotation looks like this
    * This is called when the page is refreshed.
    * @jpf:action
    * @jpf:forward name="success" path="begin.do"
    * @jpf:forward name="goBackToCurrentPage" return-to="currentPage"
    * @jpf:forward name="goBackToPreviousPage" return-to="previousPage"
    * @jpf:forward name="goBackToPreviousAction" return-to="previousAction"
    When I try to forward to "goBackToCurrentPage", the request attribute that I had stored are not accessible in the JSP page.
    The only way for me to get that working is to change the forward to "goBackToPreviousAction".
    In this way, the action class will be called, which will inturn set the attribute in the request scope. However, this is a very expensive way.
    Is there something that I am missing here?

    Hi again!
    I must admit that I, after some tesing, had to leave the "goBackToPreviousAction" solution since it gave me some unwanted side effects.
    Instead I found a solution that actually works as one would expect.
    Thanks Graham Patterson!
    (http://forums.bea.com/bea/thread.jspa?messageID=200571206)
    My pfRefreshAction() now instead looks like this.
    * @jpf:action
    * @jpf:forward name="goBackToIndexPage" path="index.jsp"
    protected Forward pfRefreshAction()
    Forward forward = null;
    if ("forward to index page condition")
    forward = new Forward("goBackToIndexPage");
    return forward;
    Regards/ Thomas Lindbom :-)

Maybe you are looking for