Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Want to map all my jsp's to a common Servlet

Thread view: 
Poorna - 03 Apr 2006 19:27 GMT
I am a newbie to web application development.

When the user clicks on any link in an html page, I want all the jsp
pages to be mapped to a servlet. Here is the small snippet of html
page:

      <td width="350">
                 <a href="http://localhost:8080/EForms/Travel.jsp"
            title="Business Services - x5890 - Travel Authorization Form"
            target="_blank">
            Travel Authorization Form<br>
           </a>
          </td>
And I mapped my jsps to the servlet as follows:

<servlet>
       <servlet-name>ProcessAllForms</servlet-name>
       <servlet-class>esign.ProcessAllForms</servlet-class>
</servlet>
<servlet-mapping>
       <servlet-name>ProcessAllForms</servlet-name>
       <url-pattern>/ProcessAllForms</url-pattern>
</servlet-mapping>
<servlet-mapping>
       <servlet-name>ProcessAllForms</servlet-name>
       <url-pattern>*.jsp</url-pattern>
</servlet-mapping>

I am using Netbeans and when I deploy this application, nothing works.
The application doesn't even display the index.jsp.
If the remove the ".jsp servlet-mapping tag, everything works, but I
want my jsp's to go through a common Servlet.

Thanks.
Larry - 06 Apr 2006 20:38 GMT
When you use that pattern (*.jsp) you are telling the web server to
call your servlet (ProcessAllForms) when the browser requests any file
with an .jsp extension, including index.jsp.  This means that all
browser calls to any JSP file will forward the request to your servlet
instead (not the JSP), and it's the servlet's process thats running
(init, doGet, doPost, etc.), not the .jsp.  So when you try to load
index.jsp, it's actually forwarding the request to the servlet, and if
the servlet has no display properties (response.write) you ain't gonna
see anything   :)

I'm thinking you want this servlet to run on any FORM POST call from
your JSP's, which is not what this would do.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.