• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirect url with in the action class

 
meMalik Ahmed
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friend i am new to struts2 me want to redirect my action with in the action class without using Struts.XML
let suppose my requested URL is
http://localhost:8080/my/myidex.jsp
to
http://localhost:8080/my/jsp/myidex.jsp
internally from action class without changing the URL in the browser. Like filter in Spring
sorry if me cant explain you clearly but if any one know please post some material
Thanks
 
Srinivas Kollaparthi
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets us see if my understanding is correct.
your config xml looks like

Usually in your action class, you will return ActionForward object by calling mapping.findForward("success") to go to "/myindex.jsp"
If you want to redirect to some other page without specifying in config xml,
you will get actionforward object by instantiating it with your new path and return it.
 
meMalik Ahmed
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks brother for your reply..
but my question is little bit different..
actually me want to internally redirect my request to any action without feel changing my URL to user.
Let me explain more clearly
my requested URL is
http://localhost:8080/my/myindex.action
me call this action then request will go in the myindex.action class
from that class me want to internally redirect to some other action class e.g
http://localhost:8080/my/home.action and do some process and takes value from that then com back to
http://localhost:8080/my/myindex.action...
means internally redirect
hope me define some more clear picture...
sorry if there is any confusion


 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use interceptors to perform task that you want .
In interceptor you can call any Action .
 
meMalik Ahmed
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear brother you suggested me to use interceptor.
now the problem i am facing is that me can only call interceptor before or after result..
how we can manually call a interceptor a specific point in the action..
let suppose me in the action class
public String execute()
{

1...........
2...........
3...........
4.(call interceptor)
5..........


}
in the method after execute me want to call interceptor and pass some parameters to interceptor...
and in the interceptor on behalf of the parameter i can do further processing then i can send any data(List) back to action..
thank in advance
and sorry if any confusion occur

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic