You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Karthik Nanjangude <ka...@xius-bcgi.com> on 2010/03/31 11:16:04 UTC

Hide JSP name using web.xml

Hi

SPEC :
O/s  UNIX / WIN2000 / Linux
JDK1.5
TOMCAT 5.0.20.0


Question:  How to hide the name  ( other then "index.jsp" ) of JSP in URL  for a web application  ?
For a valid reason  I have 5 jsp folders.
All 5 jsp folders Do NOT have index.jsp as primary folder but other names.

Any ideas plz ...  .:(



With regards
Karthik




Re: Hide JSP name using web.xml

Posted by 2smart4u <rc...@googlemail.com>.
hm, might be a bit of typo-work, but why not specify them in your
deployment-descriptor (aka web.xml)?

example (snippet):

        <servlet>
                <description></description>
                <display-name>SomeName</display-name>
                <servlet-name>MyServlet</servlet-name>
                <jsp-file>/WEB-INF/yourJSPFile.jsp</jsp-file>
        </servlet>
        <servlet-mapping>
                <servlet-name>MyServlet</servlet-name>
                <url-pattern>/MyServlet</url-pattern>
        </servlet-mapping>

Hope I got your requirements correctly.

Cheers

Gregor
-- 
just because you're paranoid, don't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available
@ http://pgpkeys.pca.dfn.de:11371
@ http://pgp.mit.edu:11371/
skype:rc46fi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Hide JSP name using web.xml

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/4/1 Karthik Nanjangude <ka...@xius-bcgi.com>:

> I also have roughly 300+ similar pages across folder1 /folder 2

You will either need something to generate that web.xml for you,
or some person to type in those 300 mappings (if they are all different),
or use some Filter/Servlet that performs introspection of your
resources at runtime.

Read the Servlet specification !
You can find the links in the first few sentences here:
http://wiki.apache.org/tomcat/FAQ


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Hide JSP name using web.xml

Posted by Karthik Nanjangude <ka...@xius-bcgi.com>.
Hi

I would want to request a jsp page from another page  as following

http://domain.com/folder1/abcd.jsp   to http://domain.com/folder2/xyz.jsp

Using Javascript / action

But I need both the JSP pages hidden in the URL ...... :(

With web.xml configurations should each configurations need to be done ?

I also have roughly 300+ similar pages across folder1 /folder 2
Request - Responding



With regards
Karthik




-----Original Message-----
From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com]
Sent: Thursday, April 01, 2010 12:51 AM
To: Tomcat Users List
Subject: Re: Hide JSP name using web.xml

2010/3/31 Karthik Nanjangude <ka...@xius-bcgi.com>:
> Let us say I have
>
> http://domain.com/folder1/abcd.jsp  ==> http://domain.com/folder1/
> http://domain.com/folder2/xyz.jsp   ==> http://domain.com/folder2/
> (..)

You want to have requests to http://domain.com/folder1/ to be
processed by http://domain.com/folder1/abcd.jsp.  It can be done by
calling

ServletContext.getRequestDispatcher("/folder1/abcd.jsp").forward(request,
response)

The above call can be performed by a Servlet or by a Filter.
E.g. you can use http://tuckey.org/urlrewrite/  or write your own filter.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Hide JSP name using web.xml

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/3/31 Karthik Nanjangude <ka...@xius-bcgi.com>:
> Let us say I have
>
> http://domain.com/folder1/abcd.jsp  ==> http://domain.com/folder1/
> http://domain.com/folder2/xyz.jsp   ==> http://domain.com/folder2/
> (..)

You want to have requests to http://domain.com/folder1/ to be
processed by http://domain.com/folder1/abcd.jsp.  It can be done by
calling

ServletContext.getRequestDispatcher("/folder1/abcd.jsp").forward(request,
response)

The above call can be performed by a Servlet or by a Filter.
E.g. you can use http://tuckey.org/urlrewrite/  or write your own filter.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Hide JSP name using web.xml

Posted by Karthik Nanjangude <ka...@xius-bcgi.com>.
Hi

>> http://domain.com/folder/

Let us say I have

http://domain.com/folder1/abcd.jsp  ==> http://domain.com/folder1/
http://domain.com/folder2/xyz.jsp   ==> http://domain.com/folder2/
http://domain.com/folder3/abxy.jsp  ==> http://domain.com/folder3/
http://domain.com/folder4/xyab.jsp  ==> http://domain.com/folder4/
http://domain.com/folder5/axbyd.jsp ==> http://domain.com/folder5/


How To *list of default pages in web.xml*



With regards
Karthik


-----Original Message-----
From: Andrew Bruno [mailto:andrew.bruno@gmail.com]
Sent: Wednesday, March 31, 2010 3:19 PM
To: Tomcat Users List
Subject: Re: Hide JSP name using web.xml

do you want the other names to be default?

e.g. http://domain.com/folder/soepage.jsp ==> http://domain.com/folder/

if so, you can add soepage.jsp to the list of default pages in web.xml

On Wed, Mar 31, 2010 at 8:16 PM, Karthik Nanjangude <
karthik.nanjangude@xius-bcgi.com> wrote:

> Hi
>
> SPEC :
> O/s  UNIX / WIN2000 / Linux
> JDK1.5
> TOMCAT 5.0.20.0
>
>
> Question:  How to hide the name  ( other then "index.jsp" ) of JSP in URL
>  for a web application  ?
> For a valid reason  I have 5 jsp folders.
> All 5 jsp folders Do NOT have index.jsp as primary folder but other names.
>
> Any ideas plz ...  .:(
>
>
>
> With regards
> Karthik
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Hide JSP name using web.xml

Posted by Andrew Bruno <an...@gmail.com>.
do you want the other names to be default?

e.g. http://domain.com/folder/soepage.jsp ==> http://domain.com/folder/

if so, you can add soepage.jsp to the list of default pages in web.xml

On Wed, Mar 31, 2010 at 8:16 PM, Karthik Nanjangude <
karthik.nanjangude@xius-bcgi.com> wrote:

> Hi
>
> SPEC :
> O/s  UNIX / WIN2000 / Linux
> JDK1.5
> TOMCAT 5.0.20.0
>
>
> Question:  How to hide the name  ( other then "index.jsp" ) of JSP in URL
>  for a web application  ?
> For a valid reason  I have 5 jsp folders.
> All 5 jsp folders Do NOT have index.jsp as primary folder but other names.
>
> Any ideas plz ...  .:(
>
>
>
> With regards
> Karthik
>
>
>
>