Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3322496
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:11:20+00:00 2026-05-17T23:11:20+00:00

Hey, I’m using Spring MVC and I got used to sending DTO to a

  • 0

Hey,
I’m using Spring MVC and I got used to “sending” DTO to a view without populating servlet request directly, which is very flexible and effective. I’m trying to figure out how to do something similar in Struts, because as far as I can see, the only way how to “send” DTO to view is via request dispatcher where servlet request is populated with DTOs in key – value style manually by programmer.

This results in having too much logic in view layer (JSPs) in comparison with Spring MVC.

Is this the only way of DTO transfer from handlers to a view layer ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:11:20+00:00Added an answer on May 17, 2026 at 11:11 pm

    Generally the way I have seen it being done in Struts is via Form objects. This form class extends ActionForm. Then in the struts-config.xml you define this form as a a form bean. Then add a reference to the form bean in the action class bean definition. Then in the jsp you rerefence the form to get data from the DTO.

    For example:-

    The Action class:
    
    public class SomeAction extends DispatchAction {
     public ActionForward someRequest(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)
                throws Exception {
      SomeForm someForm = ( SomeForm) form;
      List<SomeDTO> someList = populateDto();
      someForm.setSomeList(someList);
      return mapping.findForward("someAction");
    
    }
    The Form class:
    
    public class SomeForm extends ActionForm{
    
       List<SomeDTO> someList;
       //getter and setters for someList
    }
    
    StrutsConfig:
    
    <form-beans>
        <form-bean name="someForm" type="my.forms.SomeForm" />
    </form-beans>
    
    <action path="/someRequest"
                type="my.actions.SomeAction"
                name="someForm" scope="request" >
    <forward name="someAction" path="goesSomeWhere" />
    
    </action>
    
    View:
    
    <c:forEach items="${someForm.someList}" var="someThing" varStatus="someCounter">
        <c:out value="${someThing.foo}" /> <!-- assuming foo is a member in SomeThing DTO -->
    </c:forEach>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I got the same error when I was using kiwi to install
Hey folks I am trying to implement a search functionality in a website using
Hey I can't figure out an error I got. I had my App working
Hey everyone I am a newbie and would love some help. I got the
Hey guys I am making a terminal application using Swing and Apache Commons. I
Hey people I've been searching over the internet for the following problem without success...
Hey guys here is my question. im using JCombobox. if a student have CB
hey i got a contnet type that i made and i want to twweak
Hey I'm trying to creare a link that passes the link's text directly to
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.