• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to customize mapping in struts-config.xml ?

 
Krish baskar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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 ?
 
James Ward
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic