• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

multiple struts config file with same action path.

 
Greenhorn
Posts: 4
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I added below code. I am new to struts.
Web.xml file:

struts-config-student.xml

struts-config-sample.xml


struts-config-employee.xml


student.jsp


sample.jsp


employee.jsp


index.jsp


StudentAction.java

EmployeeAction.java

SampleAction.java


When i call localhost:8080/multipleStrutsConfigEx/welcome.cd
output is You came here through sample action.
when i call localhost:8080/../stud/welcome
output is again You came here through sample action.
whien i call localhost:8080/../emp/welcome
output is again You came here through sample action.
but i expect You came here through student action and You came here through employee action resp.

Please correct my code. i am standing here for long time..

File Hierarchy
MultipleStrutsConfigEx
--employee folder
-----employee.jsp
--student foler
-----student.jsp
--WEB-INF
----classes
-------com.....
----lib
----struts-employee
----struts-sample
----struts-sample
----web.xml
--index.jsp
--sample.jsp
 
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To summarize that long example, you have three struts config files that all define the mapping /welcome. Two of them go with different action servlets.

I think the best advice here is "don't do that." Use a different name for each mapping/path so it isn't ambiguous where requests should be directed.
 
vignesh sankar
Greenhorn
Posts: 4
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually Thanks Jeanne for Your Advice. I fixed the problem. since org.apache.struts.action.ActionServlet is mapped to one config file. its cannot mapped to other config file. It can be solved by using module concept in Struts.

Web.xml

 
Let me tell you a story about a man named Jed. He made this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic