• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

accessing jsp directly?

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Seems to be a stupid question, sorry.
But since all JSPs must not be accessed in struts directly (is it true?) but through actions, is it some kind of uncomfortable? For example i've got menu in my application like "create quote", "update quote", "create deal" etc. So i have to have action class for each page to call it through action mapping like createQuote.do or smth. Then each page with form will have FormBean and another action which will control this page after submit. So i've got 2 actions: 1 to get to this jsp, second to submit it.
Then if i need page which will just display some table from database (like display all users), can i directly call some function from some class which returns Collection and then iterate it? Seems that this collection must be puted to request by action. Is it true?
Sorry, im just started to use struts, dont be too strict
 
author & internet detective
Posts: 41502
881
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
Ilja,
Yes, it is true that JSPs should be accessed by going through actions. In your database example, the actions would call the function. As you said, you would put the collection in the request so the jsp could iterate through it. Your understand is correct. The idea is to keep stuff out of the jsp as much as possible.
 
author
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ilja,
If you just want to show a JSP in Struts, use the in-built action, ForwardAction to achieve what you want. Configure the ForwardAction directly in your struts-config.xml
Hope that helps
 
reply
    Bookmark Topic Watch Topic
  • New Topic