Hey, 
I am not sure if you understood what Christian said, but in the code below,
the last part of the url gets passed as a parameter to the onActivate
function. You do have to do any string manipulation of the url. You can just
get integer. 

So when you are enter to the page class below, thanks to to tapestry club =
Club2;
"localhost:8080/MyApp/Club2"

public class MyApp {
void onActivate(String club) {

System.out.println("Club is " + club);
//prints out "Club is Club2"

}



}

Newton



DaveFunkyJam wrote:
> 
> Genuis! I did something like this and it works. I've put the code below.
> I've spent ages trying to get this to work in Struts without any success
> since iand Tapestry does it simply and easily. Tapestry kicks ass!
> 
> Many thanks.
> 
> 
> Heres the code...
> 
> public class Index {
> 
>       @Inject
>       @Service("RequestGlobals")
>       private RequestGlobals requestGlobals;
> 
>       void onActivate(String id) {
> 
>               String servletPath =
> requestGlobals.getHTTPServletRequest().getServletPath();
>               String requestedClub = servletPath.substring(1);
>               int indexOfFirstSlash = requestedClub.indexOf("/");
>               if(indexOfFirstSlash > -1) {
>                       requestedClub = requestedClub.substring(0, 
> requestedClub.indexOf("/"));
>               }
>               
>               System.out.println("### requestedClub: " + requestedClub);
> 
>               //now send club to club page...
> 
>       }
>       
>       
> }
> 

-- 
View this message in context: 
http://www.nabble.com/Querying-request-URL-from-within-Tapestry-5-tp25202317p25208942.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to