aspose file tools*
The moose likes Struts and the fly likes Dispatch action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dispatch action" Watch "Dispatch action" New topic
Author

Dispatch action

Rochal Collins
Greenhorn

Joined: Jul 31, 2007
Posts: 15
I have a struts application. I want the user to login with an email address and password. After they log in I want to direct them to update page if their information is in the database to view their information OR to a create page to insert their information in the database. Can I do this? If so which dispatch action can be used? Thanks.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I wouldn't use a dispatch action at all for this. Just create a regular action mapping with two forwards: "newUser" and "updateUser". Then have your action forward to one or the other depending on whether there is already a record in the database for the current user.


Merrill
Consultant, Sima Solutions
Rochal Collins
Greenhorn

Joined: Jul 31, 2007
Posts: 15
I would like to do that but I don't know how.

<action path="/index"
type="com.rochal.resume.SearchAction"
name="searchForm"
scope="request"
input ="/index.jsp"
parameter="ro"
validate="true">
<forward name="add" path="/create_resume" />
<forward name="view" path="/rochal" />
</action>
<action path="/rochal"
type="com.rochal.resume.SearchAction"
name="searchForm"
scope="request"
input ="/rochal.jsp">
<forward name="success" path="/myresume" />


</action>

This is what I have but its not working. I have 2 links on my index page. One to view and one to add. When the view is pressed it is forwarded to the rochal page. At that page the user is supposed to enter an email and password and then the page is forwarded to myresume. The create link should go to the create_resume page. What am I doing wrong?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Rochal,

From the questions you're asking, it appears that you're missing some of the basic concepts of Struts. Without at least some mastery of these basic concepts, it's nearly impossible to create a Struts application.

My recommendation would be to take a break from your project for a while and spend some time learning the basics of Struts. In my experience, the best way to do this is by doing a tutorial or two that walks you through the process of creating and running a basic Struts application. This link has a list of some good ones.

Please don't be offended by my suggestion. I'm sure that once you master the basics, you'll soon be coding Struts applications like a pro.
Rochal Collins
Greenhorn

Joined: Jul 31, 2007
Posts: 15
I'm definitely confused about how dispatch action is supposed to work but I have a project I have to finish by Thursday. So I really don't have alot of time. The book for my class is not that helpful. I'm thinking that I will probably write different forms to handle the create and update functions rather than trying to do it all with one form. I'm not sure if this is the answer but I'll try it.
Rochal Collins
Greenhorn

Joined: Jul 31, 2007
Posts: 15
I have a form which the user enters their email address and password. When they click the submit button I want to pass their email address and password to another page. How can this be done?
[ August 13, 2007: Message edited by: Rochal Collins ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dispatch action