• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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: 42056
926
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
 
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic