This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes How to fire an action in a JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to fire an action in a JSP" Watch "How to fire an action in a JSP" New topic
Author

How to fire an action in a JSP

Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 208

Hello Ranchers i m facing a requirement which i am not able to solve.

I will explain you my problem with a simple example

<form action="goAction">
.
.
.
.
<input type="submit"/>
</form

When i do submit the goAction will be searched in struts.xml .

So now my requirement is like i am having a index.jsp where i am checking some condition based on the status of session and gives a message to the user after giving the message
i want it to redirect to an Action class.
I tried with response.redirect and forward like response.redirect("goAction") but it does not go to action class


OCJP-90%,OCPWCD-95%
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

sagar why don't you just forward it to the action like


and anyways all .do action will be interrupted by servlet, so it will reach your action class.
Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 208

thanks it worked
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to fire an action in a JSP