Results 1 to 3 of 3

Thread: Syntax to reach value stored on context variable

  1. #1
    Join Date
    Jul 2005
    Posts
    14

    Default Syntax to reach value stored on context variable

    Hi all
    I'm starting with Spring and SWF, and I have a doubt related to a syntax problem:
    I have a text field named myName on page nš 1. I pass it along to my Action on the submit but when the submit redirects me to my page nš2 I can't retrieve the value.

    What is the syntax to reach that value?

    Many thanks,
    Rui

  2. #2
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    I take it your action is putting the myName value in either request scope (context.getRequestScope().setAttribute(...)) or flow scope (context.getFlowScope().setAttribute(...)). If that's the case, you will be able to just do "<c:out value="${myName}"/>" if you're using the JSTL, or "<%=request.getAttribute("myName") %>" using a plain old scriptlet.

    I suggest you take a look at the many sample applications that come with SWF. Note that they use JSP 2.0, so that makes accessing the value even simpler: "${myName}".


    If the action is not putting the myName value in request or flow scope, it will just stay as a request parameter for that single HTTP request (it was put there by the Servlet engine). In this case you can access it using "<c:out value="${param.myName}"/>" or "<%=request.getParameter("myName") %>"

    Erwin

  3. #3
    Join Date
    Jul 2005
    Posts
    14

    Default Not working

    Hi klr8

    On my Action I can see the value of myName using context.getSourceEvent().getParameter("myName"), but none of the examples you gave me work on my webpage, for reasons unknown to me.
    If I acess the value of myName using the request variable, won't I be doing it the wrong way?

Similar Threads

  1. Replies: 11
    Last Post: Jun 1st, 2006, 04:30 PM
  2. Replies: 2
    Last Post: Oct 13th, 2005, 02:47 PM
  3. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  4. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM
  5. Replies: 6
    Last Post: May 8th, 2005, 11:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •