Hello everybody........
Please, Please, Please, Please......... help me out.....
I am using struts framework.
What actually I need to do was:
If an user enters in the url bar as
http://zoramurl.com/anything then the application has to redirect to the home page of the application so that I can check the last word i.e 'anything' in the database and redirect it to its respective url. Something that is similar to
www.tinyurl.com This is what my client has said.........but i couldn't get through...
*************************************************************
The way you deal with this issue has and will create a lot of problems:
1. Having Apache to rewrite the URLs make our application depending on other
server setting, making deployment and maintenance difficult; e.g. what if we
need to a subdirectory (e.g. zoramurl.com/info/*) ? What if we decided to do
away with Apache, instead just use Tomcat?
Apache URL rewriting function is limited comparing to what a RequestProcessor can do; and what you suggested is not its intended usage.
2. Can not handle *.jsp file unless they are hard-coded as action (*.do);
3. Bloated index.jsp, acting partially as a controller
All these problem can be solved by simply using the RequestProcessor:
--> all incoming requests get directed to zoramurl RequestProcessor; (avoid
problem #1)
--> If it is a /*,jsp request, directly dispatch it to *.jsp (avoid problem
#2)
--> If it is a /*.do request, continue let the Struts controller handle it;
--> If it is a /alias request, forward to the alias-resolving action; If
unresolvable, display a friendly message to the user.
>>>
3. It seems that the retrieving/redirecting function has been lagging
behind. To make it work, you probably will need to either write your own
requestProcesser class(preferred) , or extends the ActionServlet class and
use it in web.xml.
All requests including /*.do, /aliases /*.jsp will be processed by this
class and it will then treat them differently.
*************************************************************
I have been trying to do it but all in pain.....
I just couldnt get through.....
Please give me some useful suggestions......
Thanking you for all your help in this forum