URL Masking

Hey

I want to make my web pages SEO(Search Engine optimized), for that I

want to change the URLs based on the products .. like if its showing information abt Motorola cell phone it should show..abc.com/Motorola

the content of the pages are not static. So the url should change according to the products.

I am using jsf and java.

Thanx...

Sudhanshu

[398 byte] By [ojhaa] at [2007-11-27 7:31:07]
# 1
You may find HttpServletRequest#getRequestURI() and the RequestDispatcher#forward() useful.
BalusCa at 2007-7-12 19:11:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
The current scenario is.. i am able to to show the product description as www.abc/product.faces but i want the url as abc.com/Motorola or abc.com/anyproduct based on the product. which is coming from data base.plz suggest any way...
ojhaa at 2007-7-12 19:11:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Set up a Servlet to handle requests of the form /anyproduct. Use the path info to extract the particular product. Then forward the request to /product.faces, passing the product in whatever manner is appropriate.
RaymondDeCampoa at 2007-7-12 19:11:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
I'd rather to use a Filter instead of Servlet.
BalusCa at 2007-7-12 19:11:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
The filter solution seems less straight forward. You would have to wrap the request object in order to return the desired URL to the FacesServlet. Perhaps I am making it too complicated.
RaymondDeCampoa at 2007-7-12 19:11:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
I was thinking from the other side. Calliing http://example.com/webapp/motorola should let the filter dispatch the request into http://example.com/webapp/index.jsf?page=motorola or so. In the JSF side, define a managed-property for this value on #{param.page}.
BalusCa at 2007-7-12 19:11:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
I see; seems like the guts will be identical to the servlet method. I'm not seeing an advantage for either to be honest, do you see something or is it just personal preference?
RaymondDeCampoa at 2007-7-12 19:11:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
It's just from the OO design view. Filters are intented to be used to intercept between requests and the business logic (servlets). Servlets are intented to handle the actual requests and responses.
BalusCa at 2007-7-12 19:11:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...