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 9102283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:20:48+00:00 2026-06-17T01:20:48+00:00

So, I’m a real java beginner.. I’m doing an application with lot of work

  • 0

So, I’m a real java beginner.. I’m doing an application with lot of work and researching…

The thing is. I need to post some information with multipart/form-data… I used to do it with Json HashMap. But don’t know which object to use instead… Here is my actioncontroller post:

HashMap<String, ContentDTO> cnt = new HashMap<String, ContentDTO>();

        ContentDTO contentDTO = new ContentDTO();
        contentDTO.setExternal_id("CNT1");
        contentDTO.setTemplate_type_id(103);
        contentDTO.setChannel_id("CHN1");
        contentDTO.setTitle("Conteudo1");
        contentDTO.setText("Conteudo teste 1");
        RulesDTO rules = new RulesDTO();
        SimpleDateFormat publish_date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss-SSS");
        java.util.Date pdate = publish_date.parse("2012-12-28 11:18:00-030");
        java.sql.Timestamp pubdate = new java.sql.Timestamp(pdate.getTime());
        rules.setPublish_date(pubdate);
        SimpleDateFormat expiration_date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss-SSS");
        java.util.Date edate = expiration_date.parse("2013-12-28 11:18:00-030");
        java.sql.Timestamp expdate = new java.sql.Timestamp(edate.getTime());
        rules.setExpiration_date(expdate);
        rules.setNotify_publish(true);
        rules.setNotify_expiration(false);
        rules.setHighlihted(true);

        contentDTO.setRules(rules);

        InteractionsDTO interactions = new InteractionsDTO();
        interactions.setAllow_comment(true);
        interactions.setAuto_download(false);

        contentDTO.setInteractions(interactions);


        cnt.put("content",contentDTO);




        HttpEntity<HashMap<String, ContentDTO>> request = new HttpEntity<HashMap<String, ContentDTO>>(cnt, httpHeaders);

Can anyone helps me out??

  • 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-06-17T01:20:49+00:00Added an answer on June 17, 2026 at 1:20 am

    As you are required to upload using multipart I think you must use a File object, specifically the MultipartFile from Spring.

    Using Spring you must work in the UI layer using Spring Controllers, it’s not necessary to manage the HttpEntity. Just declare the multipart resolver in your configuration file.

    <beans>
    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
    <!-- Declare explicitly, or use <context:annotation-config/> -->
    <bean id="fileUploadController" class="examples.FileUploadController"/>
    
    </beans>
    

    This is extracted from official Spring 3 Documentation. You can check there some examples. Here I will give you some more: Spring 3 File Upload Example
    , Spring MVC file upload.

    Finally I would suggest you using the MVC pattern. Don’t create the DTO and use it’s accessors inside the UI layer, create a Service or Facade in the business layer to do that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

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.