Re: Passing data to an include page
On Thursday, May 29, 2003, at 12:24 PM, philippe bertramo wrote: What is the easiest way to pass a local data from the parent to the included page ? I recommend using the jsp:param tag. Here is an example: jsp:include page=scripts/login.jsp jsp:param name=username value=jsmith / jsp:param name=password value=yoyo / /jsp:include The jsp:param tag basically appends name/value pairs as query string parameters, but the tag nicely encapsulates the process (automatically URL encoding your data). You can then access the parameters in the request scope in the included page. Hope this helps. Christian ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=8 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=8 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
RE: Antw: Re: Passing data to an include page
I'd prefer to use request attributes. If the data were suitable for storage in the session, I doubt Phil would have called them local. -- Sebastian -- more specifically, you can use the request.getAttribute() and request.setAttribute() methods to put and retrieve objects into the request scope. For example, on a self posting form, you might have a servlet handle validation and then send a vector of errors to the jsp to display. In the servlet, you'd do something like this: request.setAttribute(errors, v); where 'v' is a Vector object. Then in your JSP, you could use syntax like this: jsp:useBean id=errors scope=request class=java.util.Vector / to retrieve the Vector from the request scope. hth, AJ Aaron Johnson [EMAIL PROTECTED] http://cephas.net/blog/ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=8 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=8 Get the JRun Web Application Construction Kit - the only book written specifically for JRun developers. http://www.amazon.com/exec/obidos/ASIN/0789726009/houseoffusion
Re: Passing data to an include page
Phil It depends what sort of include. If you're using an %@ include % directive, you can just refer to the variable. If you're using jsp:include / you could put it in a session variable. Nick - Original Message - From: philippe bertramo [EMAIL PROTECTED] To: JRun-Talk [EMAIL PROTECTED] Sent: Thursday, May 29, 2003 5:24 PM Subject: Passing data to an include page Hello I'm using JRun 3.0 at the moment though migrating to JRun 4. I am currently reworking some of my old code comming back from Jrun 2.x and I'm trying to be clever (difficult). This may be a basic question: I have a top JSP page including a child JSP page. What is the easiest way to pass a local data from the parent to the included page ? Thanks, Phil ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=8 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=8 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
Antw: Re: Passing data to an include page
I'd prefer to use request attributes. If the data were suitable for storage in the session, I doubt Phil would have called them local. -- Sebastian [EMAIL PROTECTED] 29.05.03 18:37:08 Phil It depends what sort of include. If you're using an %@ include % directive, you can just refer to the variable. If you're using jsp:include / you could put it in a session variable. Nick - Original Message - From: philippe bertramo [EMAIL PROTECTED] To: JRun-Talk [EMAIL PROTECTED] Sent: Thursday, May 29, 2003 5:24 PM Subject: Passing data to an include page Hello I'm using JRun 3.0 at the moment though migrating to JRun 4. I am currently reworking some of my old code comming back from Jrun 2.x and I'm trying to be clever (difficult). This may be a basic question: I have a top JSP page including a child JSP page. What is the easiest way to pass a local data from the parent to the included page ? Thanks, Phil ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=8 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=8 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com