File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes specifying result path in struts.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "specifying result path in struts.xml" Watch "specifying result path in struts.xml" New topic
Author

specifying result path in struts.xml

James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi all,

In my struts.xml I specified like below



but in content folder i want to create subfolder like student,teacher,staff etc...

how to specify this in struts.xml and also in action like below ?

{ @Result(location = "student/studentEnroll.jsp",

Please let me know correct way of doing it.

Thanks
Peter
Chris Montgomery
Ranch Hand

Joined: Jan 14, 2004
Posts: 141
I'm not completely sure if what you are doing is trying to manipulate a redirect, but I'm going to assume you are. Here's an example of what you can do with action variables and your struts.xml:


an alternative you can experiment with is something like this:


And depending on what happens within your action, update the value of your myDirectory variable accordingly.

James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi,

Thanks for reply. Sorry my explanation was not clear. Here I try to explain again.
I am using a convention plugin and all my action classes and results are being specified using annotations.
Below is my structs.xml content.


and here is annotation in action class.


because of specifying result.path as /WEB-INF/content action is looking all jsp pages in the content folder.
But I want to place jsp files in sub folders of content folder as per their category like (student,teacher,staff etc...)


If I created a sub folder with name student in content folder (content/student) and place my student-form.jsp in student folder then action class is not able to locate this jsp page. I used below method. But not working. I want to know what is the correct way. Please let me know if you know the solution.



Thanks
Peter
selvaraju sellamuthu
Ranch Hand

Joined: Jun 28, 2007
Posts: 53
Keep your jsp files outside WebINF folder and inside of your project folder. Then in your result path location: read your jsp from your application context path.
for example, StudentManagementSystem/student/ student-form.jsp. Here StudentManagementSystem is your application context path, student is sub folder
James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi,

Thanks for suggestion. But is it not possible if we keep our jsp pages in web-inf/content folder itself?
is there no way to achieve this?


Thanks
Peter
Chris Montgomery
Ranch Hand

Joined: Jan 14, 2004
Posts: 141
If you remove the annotations and use just the struts.xml approach, are you able to achieve the desired result?
Annotations may not be the best option for you given the situation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: specifying result path in struts.xml