• 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

A Simple web application is this the correct way to use struts

 
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is probably a very simple question, but I am more used to using servlets and JSPs with a forward controller servlet as a point of contact with a session facade and used to load JSP pages.

Is this the correct way to build a web application using struts:

If I have the following pages which will represent the View:
�Login.jsp
�Welcome.jsp
�CreateNewUser.jsp
�CreateNewAccount.jsp
�DisplayUsers.jsp
�DisplayAccounts.jsp

As I see it with struts I will create the following beans for the forms: also part of the view:
�LoginForm.java
�NewUserForm.java
�NewAccountForm.java

Then instead of using a control servlet as control I create three actions to deal with the three forms this would validate and call the beans below:
�LoginAction.java
�NewUserAction
�NewAccountAction

For the Model I would have three beans that would either connect straight to a database or too a EJB container:

�GetUserDetails (for login)
�CreateNewUser
�CreateNewAccount

To call the two pages I would have had a link to a servlet to load the data which would then call the page to display it: In struts would you use a the same logic or would you call a action that would load the data and then call the page to display the data.
�DisplayUsers.jsp
�DisplayAccounts.jsp

Thanks for any input

Tony
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tony,
To call the two pages, you would call an action (or more specifically a path representing the action) which would then forward to the jsp page. I think you have a good handle on the structure of Struts!
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

To call the two pages I would have had a link to a servlet to load the data which would then call the page to display it: In struts would you use a the same logic or would you call a action that would load the data and then call the page to display the data.



Yes, you should be used Struts.

you should create link to some action that it's configed in struts_config.xml.
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tony, if you allow, why are you trying to use Struts and not anything else? (I think there are a few web frameworks out there more cleaner than struts).

./pope
 
Tony Evans
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone, Pope to awnser your question, I am not using struts but as a software developer like everyone else I have to know everything otherwise an IT recruitment agency would not look twice at me.

Tony
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A courageous goal:


but as a software developer like everyone else I have to know everything



best wishes

./pope
 
reply
    Bookmark Topic Watch Topic
  • New Topic