• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to customize mapping in struts-config.xml ?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have a code to test that submits file to upload to a CGI url. I have a struts application to replace CGI server that takes uploaded file. All I need is, I would like to repalce the CGI url in place of .do
Current struts URL is https://hostname/jack/FileUploadAndSave.do
struts-config.xml contains

web.xml contains

I would like to use in my jsp page as

Could someone help me out please ?
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i have understood correctly - you want to use a CGI to handle your uploads, and struts action should not handle your upload.

If this is the case, you are already set, and do not need to do anything in struts-config.xml OR web.xml. Remember as per your entry in web.xml, struts will come into play ONLY if the URL has a .do in it.

So, if your upload is pointing to a URL that does not have .do, it should just work fine - as long as you have the CGI script to receive that upload.
 
Krish baskar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply James..

you want to use a CGI to handle your uploads, and struts action should not handle your upload



Not exactly... I would like to replace my struts application instead of cgi server. But my client application should not know they submit to a different server. Let them think they submit to cgi server and i would like to handle in my struts application.

I have seen in many places submitting to htm is redirected to action classes and in the same way submitted to a" fake .cgi" will go to take my struts application...

 
James Ward
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In web.xml, your servlet mapping should look like this (note the addition of .cgi there in url pattern):


For the above to work you should be using servlet 2.5 and above.

For an earlier servlet specificiation (define it twice):



Now, any request with .cgi url pattern will be handled by struts.
 
Krish baskar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah... I did not use two <servlet-mapping>, only one is enough in my case, as this server will have only this action. So it works for me. Thanks for reply James...
 
reply
    Bookmark Topic Watch Topic
  • New Topic