Re: Tiles and appending request parameters
Hi, Brandon Goodin wrote: Thanks, let me provide a more real world example and see what you would do. - I have a menu that is customized according to the user. - I have a tile that displays the menu data. - I have a layout that has a - In my tiles-defs.xml I give the following definition for the "menu" insert. - The "tile.menu" contollerUrl needs to retrieve the userid from the original action that called the mypage definition. Since the tile.menu definition spawns it's own request I assume it does not have access to the request of the parent page. Therefore, I was wondering if there is a way to pass the userId down into the request that is spawned by the controllerUrl. Tiles use RequestDispatcher.include() to include a tile or call a controller. The original request is accessible in all the included tiles or controller. So, you can access the userId. Here is a step through of the process I envision request -> Action -> page that contains controllerUrl tile definition -> menu tile calls controllerUrl Action -> (Here is where I want to pass parameters into the request spawned by the controllerUrl) Here you retrieve the userId, and create the appropriate user menu. There is several solutions: * set a tile attribute to a predefined menu definition * create dynamically a list of menu entry * ... Action does it's magic -> Action returns a page with a menu customized to a particular user. The action forward to the menu tile which retrieve the appropriate attribute and show it as a menu ... Check the example in struts-documentation/example: there is a user customizable menu. This menu is set in a controller according to what the user has chosen. The corresponding definition is in tiles-examples-def.xml (examples.userMenu). Cedric Thanks for your help. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:06 AM To: Struts Users Mailing List Subject: Re: Tiles and appending request parameters Hi, I think that the problem is not related to the Tiles. What you want is to be able to add a request parameter to the current requestResponse. When Tiles include the controller via its url, is simply do an include, and doesn't modify the requestResponse object. So, you still have all the http parameters that are associated to the request. You can yourself modify the requestResponse object in your action before inserting the tiles. Check the jsp and servlet spec to know if it is possible to add an http parameter. Personally I use to pass such extra parameters in the request context or Tile context rather than a new http parameter. Hope this help, Cedric Brandon Goodin wrote: Hey all, I have asked this question in the past and have lived with the limitation of not being able to do it. The only reason why I ask now is that I recently gave a quickstart presentation on tiles and wasn't sure if somethin had been added to remedy the problem. So, I wanted to pose it again to see if there has been an enhancement that supports it or there is a viable workaround that can produce the same results (without scriplets). I have a layout that has an that uses the controllerUrl attribute. I want to append a parameter to the controllerUrl. Is this possible yet? For example: I have this definition: When the page renders I want to attach the following request paramters to the controllerUrl value: ?weatherStationID=KFCA So that the controllerUrl ultimately calls: ... controllerUrl="/do/weather?weatherStationID=KFCA" ... The parameters will be supplied by the action that called the parent layout. This is not a realworld example. It is just a simple illustration. Please do not send me alternate approaches. I just want to know if dynamic parameter appending is possible with tiles. Thanks all. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles and appending request parameters
Thanks, let me provide a more real world example and see what you would do. - I have a menu that is customized according to the user. - I have a tile that displays the menu data. - I have a layout that has a - In my tiles-defs.xml I give the following definition for the "menu" insert. - The "tile.menu" contollerUrl needs to retrieve the userid from the original action that called the mypage definition. Since the tile.menu definition spawns it's own request I assume it does not have access to the request of the parent page. Therefore, I was wondering if there is a way to pass the userId down into the request that is spawned by the controllerUrl. Here is a step through of the process I envision request -> Action -> page that contains controllerUrl tile definition -> menu tile calls controllerUrl Action -> (Here is where I want to pass parameters into the request spawned by the controllerUrl) Action does it's magic -> Action returns a page with a menu customized to a particular user. Thanks for your help. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:06 AM To: Struts Users Mailing List Subject: Re: Tiles and appending request parameters Hi, I think that the problem is not related to the Tiles. What you want is to be able to add a request parameter to the current requestResponse. When Tiles include the controller via its url, is simply do an include, and doesn't modify the requestResponse object. So, you still have all the http parameters that are associated to the request. You can yourself modify the requestResponse object in your action before inserting the tiles. Check the jsp and servlet spec to know if it is possible to add an http parameter. Personally I use to pass such extra parameters in the request context or Tile context rather than a new http parameter. Hope this help, Cedric Brandon Goodin wrote: >Hey all, > >I have asked this question in the past and have lived with the limitation of >not being able to do it. The only reason why I ask now is that I recently >gave a quickstart presentation on tiles and wasn't sure if somethin had been >added to remedy the problem. So, I wanted to pose it again to see if there >has been an enhancement that supports it or there is a viable workaround >that can produce the same results (without scriplets). > >I have a layout that has an that uses the controllerUrl attribute. >I want to append a parameter to the controllerUrl. Is this possible yet? > >For example: > >I have this definition: > >path="/layouts/weather/weatherlayout.jsp" >controllerUrl="/do/weather"/> > >When the page renders I want to attach the following request paramters to >the controllerUrl value: > >?weatherStationID=KFCA > >So that the controllerUrl ultimately calls: > >... >controllerUrl="/do/weather?weatherStationID=KFCA" >... > >The parameters will be supplied by the action that called the parent layout. > >This is not a realworld example. It is just a simple illustration. Please do >not send me alternate approaches. I just want to know if dynamic parameter >appending is possible with tiles. > >Thanks all. >Brandon Goodin >Phase Web and Multimedia >PO Box 85 >Whitefish MT 59937 >P (406) 862-2245 >F (406) 862-0354 >[EMAIL PROTECTED] >http://www.phase.ws > > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles and appending request parameters
Hi, I think that the problem is not related to the Tiles. What you want is to be able to add a request parameter to the current requestResponse. When Tiles include the controller via its url, is simply do an include, and doesn't modify the requestResponse object. So, you still have all the http parameters that are associated to the request. You can yourself modify the requestResponse object in your action before inserting the tiles. Check the jsp and servlet spec to know if it is possible to add an http parameter. Personally I use to pass such extra parameters in the request context or Tile context rather than a new http parameter. Hope this help, Cedric Brandon Goodin wrote: Hey all, I have asked this question in the past and have lived with the limitation of not being able to do it. The only reason why I ask now is that I recently gave a quickstart presentation on tiles and wasn't sure if somethin had been added to remedy the problem. So, I wanted to pose it again to see if there has been an enhancement that supports it or there is a viable workaround that can produce the same results (without scriplets). I have a layout that has an that uses the controllerUrl attribute. I want to append a parameter to the controllerUrl. Is this possible yet? For example: I have this definition: When the page renders I want to attach the following request paramters to the controllerUrl value: ?weatherStationID=KFCA So that the controllerUrl ultimately calls: ... controllerUrl="/do/weather?weatherStationID=KFCA" ... The parameters will be supplied by the action that called the parent layout. This is not a realworld example. It is just a simple illustration. Please do not send me alternate approaches. I just want to know if dynamic parameter appending is possible with tiles. Thanks all. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles and appending request parameters
Hey all, I have asked this question in the past and have lived with the limitation of not being able to do it. The only reason why I ask now is that I recently gave a quickstart presentation on tiles and wasn't sure if somethin had been added to remedy the problem. So, I wanted to pose it again to see if there has been an enhancement that supports it or there is a viable workaround that can produce the same results (without scriplets). I have a layout that has an that uses the controllerUrl attribute. I want to append a parameter to the controllerUrl. Is this possible yet? For example: I have this definition: When the page renders I want to attach the following request paramters to the controllerUrl value: ?weatherStationID=KFCA So that the controllerUrl ultimately calls: ... controllerUrl="/do/weather?weatherStationID=KFCA" ... The parameters will be supplied by the action that called the parent layout. This is not a realworld example. It is just a simple illustration. Please do not send me alternate approaches. I just want to know if dynamic parameter appending is possible with tiles. Thanks all. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]