This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

specifying result path in struts.xml

 
James Peter
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic