?
Solved

How to make www.a.com/index.jsp?id=12345 to www.a.com/12345

Posted on 2006-11-11
4
Medium Priority
?
292 Views
Last Modified: 2010-04-01
Hi,

  Is there anyway when user enter www.a.com/12345 which will equals to www.a.com/index.jsp?id=12345?

Bezier
0
Comment
Question by:bezier98
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 10

Expert Comment

by:jaggernat
ID: 17927572
make  "www.a.com/12345"  contain this code

----------------------
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<c:redirect url="www.a.com/index.jsp?id=12345?"/>
---------------------
and make sure you have c.tld in /web-inf.

what you are basically doing is when user types  www.a.com/12345, you are using the JSTL code <c:redirect..>
to redirect the user to www.a.com/index.jsp?id=12345?





0
 

Author Comment

by:bezier98
ID: 17927655
thanks jaggernat, but may be there is some misunderstanding:

12345 is actually an id, which can not be hardcoded, meaning the user might type

www.a.com/24680 and is actually calling www.a.com/index.jsp?id=24680

If you have experience in wordpress (although it's in php), they seems had implement similar logic, either access an archive blog by www.a.com/archive.php?id=whatever or www.a.com/archive/whatever

of course they may do it in other way round (i.e. forward archive.php to whatever, which is much easier.

To to ensure if we can do this in jsp or not.

Regards,
Bezier
0
 
LVL 10

Accepted Solution

by:
mbvvsatish earned 2000 total points
ID: 17929243
try mapping the path / to a servlet or jsp

<servlet>
  <servlet-name>loginservlet</servlet-name>
  <servlet-class>/loginservlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>loginservlet</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>

and in th loginservlet get the requested url using request.getRequestURL() that gives you the requested url from where you can get the *id* using substring.
and then dispatch the request using RequestDispatcher.forward("/index.jsp?id"+id)

this is just an idea that i got, i am not sure whether this works, but you can do something like this.
just try it and let me know.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
The well known Cerber ransomware continues to spread this summer through spear phishing email campaigns targeting enterprises. Learn how it easily bypasses traditional defenses - and what you can do to protect your data.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question