• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dispatch action

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rochal Collins
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic