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 fow to forward to an action from jsp ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "fow to forward to an action from jsp ?" Watch "fow to forward to an action from jsp ?" New topic
Author

fow to forward to an action from jsp ?

Bibhudutta Pradhan
Ranch Hand

Joined: Jun 24, 2011
Posts: 31

I want to forward to an action/jsp from jsp page like this.



How can i achieve this ?

Please help.
Thanks in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Why? That's not an appropriate action for a JSP. Why are not such decisions being made in the action?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bibhudutta Pradhan
Ranch Hand

Joined: Jun 24, 2011
Posts: 31


Because I want to display data(from database) in the same page.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

That makes no sense. If you forward, you're not on the "same page" any longer.
Bibhudutta Pradhan
Ranch Hand

Joined: Jun 24, 2011
Posts: 31

Ok. sir. Thanks for your reply.

Please help me how would i display data from a database in the same page on a click of a submit button(In struts2)

please help.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

I don't use struts, so I can't help you with specifics. I just know that forward was not the right approach.
Bibhudutta Pradhan
Ranch Hand

Joined: Jun 24, 2011
Posts: 31

I am also new to struts.

I used to display data from Database in the same page(in servlet/jsp) on click of a submit button like this :

info.jsp
............................................


1)The first time the info.jsp page is called info is null.Hence dont show info.
2)When the button is clicked servlet is called. the servlet gets the data from the database and then forward the data to the info.jsp page, setting info as attribute.
Now in the info.jsp info is not null. displaying the result.

I want to know is this the right approach to display data in the same page?
And now i want to do it in the same process in struts.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Sounds like what you need is Ajax.
Simranjeet Chawla
Greenhorn

Joined: Jun 15, 2011
Posts: 3
Bibhudutta Pradhan wrote:I want to forward to an action/jsp from jsp page like this.



How can i achieve this ?

Please help.
Thanks in advance.



You can try location.href=url on click of submit button
through javascript. In the "url" part you can mention the struts mapping url.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: fow to forward to an action from jsp ?