aspose file tools*
The moose likes Struts and the fly likes problem in seperate modules in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem in seperate modules in struts" Watch "problem in seperate modules in struts" New topic
Author

problem in seperate modules in struts

anuj km
Greenhorn

Joined: May 03, 2006
Posts: 7
hi

my original app name is app1, in that i have followed the normal directory structure and made an app that is working fine.it has 2 jsp pages...view.jsp and quote.jsp.....when user logs in he gets view.jsp page and when he submits his request he gets quote.jsp page

next i want to add a seperate module so this is what i have done--
create a new folder in app1 and named it app2....in app2 i have the same 2 jsp pages..view.jsp and quote.jsp....
i have made a entry in web.xml file informing of my new struts-config-app2.sml file.....and i ahve doen the neccesary mappings in my new struts-config-app2 file.

next i access it by http;//localhost:8080/app1/app2/index.jsp....here i get the rquired jsp that is in app2 directory,,,,but when i submitt i get the view from app1 directory

pl help
ram gaurav
Ranch Hand

Joined: Mar 29, 2006
Posts: 208
Please check your new struts-config.xml , which belongs to your new module , that is app2.
In that , on submision you have to give the URL as app1/app2/requeiredPage.jsp .

Check that URL which you have given there.
anuj km
Greenhorn

Joined: May 03, 2006
Posts: 7
i think that link is ok.....let me giev u all the details....

app1/WEB-INF
app1/the 2 jsp pages

app1/WEB-INF/classes , lib, struts-config.xml , struts-config-app2.xml and web.xml

app1/app2/the 2 jsp

contents fo web.xml
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/app2</param-name>
<param-value>/WEB-INF/struts-config-app2.xml</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>

contents of struts-config.xml

<action className="ch08.WroxActionMapping"
path="/Lookup"
type="ch03.LookupAction"
name="lookupForm"
validate="true"
input="/index.jsp">
<set-property property="logResults" value="true"/>
<forward name="success" path="/quote.jsp"/>
<forward name="failure" path="/index.jsp"/>
</action>



contents of struts-config-app2.xml

<action-mappings>

<action className="ch08.WroxActionMapping"
path="/Lookup"
type="ch03.LookupAction"
name="lookupForm"
validate="true"
input="/app2/index.jsp">
<set-property property="logResults" value="true"/>
<forward name="success" path="/app2/quote.jsp"/>
<forward name="failure" path="/app2/index.jsp"/>
</action>

now what i think is that the controller is taking the maping frm strust-config.xml wheras it sud take the mapinf frm strust-config-app2.xml.....right....correct me if i am wrong....

thanks
anuj km
Greenhorn

Joined: May 03, 2006
Posts: 7
pl reply i need it urgently
ram gaurav
Ranch Hand

Joined: Mar 29, 2006
Posts: 208
Hi

The code seems to be correct.
I think that this problem is coming due to ambiguity , means that in both directories you have files with same name.

Try to change the name of files and also in config files just try to change the parameters "success" and "failure".

I am also trying this on my end and will let you know.

Regards
Gaurav
anuj km
Greenhorn

Joined: May 03, 2006
Posts: 7
Hi,

I changed the names of the 2 jsp files but that does not solve the problem....

not able to figure out where i am goin wrong ,, tried to search on net but cud nt get anythign usefull.....if i can get a working example of a module in struts app....then i think i will be able to figure out the problem...

thanks
anuj km
Greenhorn

Joined: May 03, 2006
Posts: 7
one way it cud be doen is by adding switchaction in struts-config.xml file but if i do that what is the use of the new struts file that i am making..???
anuj km
Greenhorn

Joined: May 03, 2006
Posts: 7
help pl
anuj km
Greenhorn

Joined: May 03, 2006
Posts: 7
??? no answers from anyone...............
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in seperate modules in struts