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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:04:34+00:00 2026-06-16T17:04:34+00:00

My problem is that I have a web form and I want to send

  • 0

My problem is that I have a web form and I want to send this data to a Jersey restFULL Method.

in my Javascript I have this call:

 console.log('Sending event creation ---> '+eventInJsonString);
$.ajax({
    url: "/Bxip/rest/events/",
//  dataType: 'json',
    type: 'post',
    data: eventInJsonString,
    contentType: 'multipart/form-data',
    success: function(data) {
        console.log("success ", data.response);
    },
    error: function(data) {
        console.log("error ", data.error);
    }
});

My jersey method is:

@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.TEXT_HTML)
//Retornará HTTP_STATUS 204 (on success)
public String addEvent(
        @FormParam("title") String title,
        @FormParam("fechaInicio") String fechaInicio,
        @FormParam("lugar") String lugar,
        @FormParam("categoria") String categoria,
        @FormParam("description") String description,
        @FormParam("fechaFin") String fechaFin) throws IOException {

    System.out.println("ENTRAAA    = " + title + description);

And the result before sending the data:

 Sending event creation ---> {"title":"aaaa","description":"        aaaaa","fechaInicio":"bbbb","categoria":"Beber y comer","fechaFin":"forever"}

But in the Java server side the parameters are null:

ENTRAAA    = nullnull

How can I send @POST to this jersey method from the client?

  • 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-16T17:04:35+00:00Added an answer on June 16, 2026 at 5:04 pm

    Several ways to do this. Here you have two possibilities:

    • Using from params

    To receive @FormParam’s at Jersey you should send the data url encoded in the body of the post.

    The ContentType of the request should be

    application/x-www-form-urlencoded
    

    and the content of eventInJsonString should be

    title=aaaa&description=aaaaa&fechaInicio=bbbb&categoria=Beber y comer&fechaFin=forever
    

    To process this in Jersey, you should change the @Consumes type to

    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    

    This way you will get the @FormParam’s filled.

    • Using json

    The problem is that you are trying to send the data in json. If you want to send it that way, you need to change somethings too:

    You need to change the request ContentType to

    application/json
    

    and in Jersey you need to change the @Consumes type to

    @Consumes(MediaType.APPLICATION_JSON)
    

    If you send it that way, you will also need to remove the @FormParam’s from the method:

    public String addEvent(String jsonBody) throws IOException {
    
        // Now you need to parse the json to get your parameters...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET web form. This web form has an event handler that
I have the following form and javascript function on my web page. This is
![Snapshot of the problem][2] I have a web form that uses two update panels
I have a problem of web pages being cached even though I specify that
i have bought a template that have built in contact form problem is that
I have a form JSP web page, this form contains multiple instances of the
I have a web form and I want to use a plugin for validation
my problem is that---------i have many input controls on my form, in my asp.net
please consider this scenario: we have two web page. a simple page that contains
I have a html form that sends POST data to php file. In php

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.