View Full Version : Syntax to reach value stored on context variable
ruipacheco
Aug 1st, 2005, 12:25 PM
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
klr8
Aug 1st, 2005, 01:17 PM
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
ruipacheco
Aug 2nd, 2005, 04:33 AM
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?
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.