*
The moose likes Struts and the fly likes Call a struts action from JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Call a struts action from JSP page" Watch "Call a struts action from JSP page" New topic
Author

Call a struts action from JSP page

Sree Jag
Ranch Hand

Joined: Oct 14, 2003
Posts: 77
Hi all,
Is it possible that we execute an action from within a JSP page?
Cheers,
Seshu


Sree Jag<br />SCJP 1.4
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Actions typically forward to JSP pages, not the other way around. What are you trying to do?
Sree Jag
Ranch Hand

Joined: Oct 14, 2003
Posts: 77
hi,
i have to display the fields from two action forms in a single JSP page.
so i'm trying to call the action file from the JSP.
If u have an idea about webwork, then webwork provides an tag called <webwork:action> that calls the action file from the JSP.
Does struts provide any such thing?
Seshu
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Here's an example:
<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
<form:form action="register.do">
UserName:<form:text property="username"/><br>
enter password:<form assword property="password1"/><br>
re-enter password:<form assword property="password2"/><br>
<form:submit value="Register"/>
</form:form>
[ March 22, 2004: Message edited by: Anthony Watson ]
Sree Jag
Ranch Hand

Joined: Oct 14, 2003
Posts: 77
But i have to get the variables or fields from that the action in the current jsp page.
The current jsp comes from the execution of a action. I want the result of another action file also in this jsp.
I'm thinking of servlet chaining.
Does Struts suuport the chaining of action execution?
Seshu
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Struts does support action chaining.
You can access data from a previously submitted action form or data that your action set by getting it out of the request or session in your JSP page.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Call a struts action from JSP page
 
Similar Threads
ArrayList and Ajax
how to send parameter from html to jsp??
Query In using action tag in Data Tag of Sruts
How an action class read values sent from jsp
Data Transmission from a JSP Page to the Struts Action class