Please let me know if there is any alternative to query string for passing data. The problem is that its a link (href) through which query string is passed and hence we cannot use request or session objects. Please suggest on this..
But my problem is that the link will be visible in mobile handset and when the user clicks on it, it will connect to application and based on the query string it will retrieve information and send it back to the user. I need to find a way to remove the query string and shorten the url.
My requirement is to shorten the url. Its a link which will be visible in mobile handset with some query string in it (to say in midlet application). The midlet will communicate to application to fetch data. I am searching for an alternative to query string for shortening url.
It makes the URLs easier to read and gets rid of the query string, but makes it a bit more complicated to put them in/pull them out of the URL. They must be ordered (if you couldn't do /context/1/Steven/displayage.jsp if the page expected /context/Steven/1/displayage.jsp) and you would need to implement a control structure that can correctly parse the URL, pull out the parameters then forward to the proper display. Not a big issue if you are using a FrontController.
For small number of parameter name/value pairs the difference is minimal (as you can see above, but for large number of name/value pairs the difference is large.
The url will be generated in a dynamic way. We cannot create a separate directory for each url here. Only a single jsp page handles request and based on the query string passed, it will fetch data from the database and send it to midlet. The url looks like this http://abc.com/abc.jsp?soId=56&pd=26 I need to shorten this url and make it smaller and meaningful. Here abc.jsp handles all requests.
Using friendly URL's doesn't mean you have to use directories. But if you are using a JSP as a front controller it does make things a bit more difficult. If you were using a Servlet, for example, you could map it to something like:
And then you could have a URL like:
If the 'soId' always comes first and the 'pd' always comes second that is really easy to parse. Then you just do whatever with those values as you normally would as if they came in on a regular query string. I'd bet you can map a JSP similar to mapping a servlet but its been a while since I've done that so I'd have to go digging myself. But that does shorten your URL and makes it meaningful: