Sanjay Sharma wrote:

> Craig,
> I made the mistake of giving
> "/musicshop/servlet/ShoppingServlet/MainJSP.do", instead
> of "/musicshop/MainJSP.do". Now, I get "/MainJSP.do" from getServletPath(),
> and after truncating ".do", I get what I was looking for.
>
> Is there any way of getting "/MainJSP.do" from
> "/musicshop/servlet/ShoppingServlet/MainJSP.do"?  In that case,
> I don't have to do servlet mapping in web.xml of the applicaiton.
> Thanks,
> Sanjay
>

How about chopping off the beginning of the servlet path up to (but not including)
the last slash?  That way you'd end up with "/MainJSP.do" even with your initial
action value, if that's what you want.

Since you're doing the "model 2" thing, you might also want to take a look at the
Struts framework <http://jakarta.apache.org/struts>, which does this kind of thing
and a whole bunch more.

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to