| Author |
fow to forward to an action from jsp ?
|
Bibhudutta Pradhan
Ranch Hand
Joined: Jun 24, 2011
Posts: 30
|
|
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: 56554
|
|
|
Why? That's not an appropriate action for a JSP. Why are not such decisions being made in the action?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bibhudutta Pradhan
Ranch Hand
Joined: Jun 24, 2011
Posts: 30
|
|
Because I want to display data(from database) in the same page.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
|
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: 30
|
|
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: 56554
|
|
|
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: 30
|
|
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: 56554
|
|
|
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.
|
 |
 |
|
|
subject: fow to forward to an action from jsp ?
|
|
|