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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:17:16+00:00 2026-05-22T03:17:16+00:00

When client side submit a HTML form , it will send a form object

  • 0

When client side submit a HTML form, it will send a form object to server, like:

params={username: USER_INPUT_USERNAME,
       passworkd: USER_INPUT_PASSWORD}

Then, client ajax send the params object to my Jersey server.

On the server side, how can I get and parse this HTML form object data params:

@GET
@Produces({MediaType.APPLICATION_JSON})
public FormResult getFormResult(@QueryParam("params") Object params) {
                 //How can I define the type of the "params" I received?
                 //Do I need to create a Java Bean which represent the HTML form, 
                 //and use the bean as the type of paprams? or any other way?
}

(In above code, the return type FormResult is an POJO bean which describe the result to response to client)

When I receive the params HTML form object data, how can I define the type of the params ?(above I defined it with type “Object“, which is wrong).

Do I must define a POJO bean to represent the HTML form and use that bean to describe the type of the params?? or any other way in Jersey?

(If create POJO bean for the HTML form, If there are check boxes on the HTML form, the params will be an dynamic object, only checked field will be added to the params object, which is also a problem)

Anybody can help?

  • 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-22T03:17:17+00:00Added an answer on May 22, 2026 at 3:17 am

    The @QueryParam maps an individual queryString parameter, so for a GET request you need to enumerate all your parameters as method arguments:

    @GET
    getFormResult(@QueryParam("name") String name, @QueryParam("age") int age, ... )
    

    If the params that you mentioned is actually one query string parameter (http://your.rest.service?params=somethingHere), you can map that to some class that has a constructor taking a String, or a static valueOf(String) method where you do the actual parsing.

    @GET
    getFormResult(@QueryParam("params") FormData formData);
    

    And the FormData class can look like this:

    public class FormData {
        public FormData(String s) {
            // populate fields based on the content of s
        }
    
        // getters / setters / whatever ...
    }
    

    EDIT:
    For checkboxes, it’s not as dynamic as it looks: they have the same name, so you’ll have one-, several- or no- value(s) associated with that name, depending on what the user checked. Therefore, a @QueryParam("chk") String[] checkedValues should be enough to handle the “dynamic” aspects here (actually, ‘multi-valued’ would be a better word).

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

Sidebar

Related Questions

Silverlight works on client side so putting any sensitive data like connection strings, passwords
Can you have custom client-side javascript Validation for standard ASP.NET Web Form Validators? For
I have an ASP.NET MVC 2 form that is working perfectly, doing client side
I have a Django form that needs to do some client-side validation before submitting
I have to post data from my HTML form to server in xml format,
I have a mixed client-side/server-side validation using jQuery validation plugin. The validation happens on
I'm using MVC 2. I have a question regarding client and server side validation.
I am writing a client-side Swing application (graphical font designer) on Java 5 .
Anyone who writes client-side JavaScript is familiar with the DOM - the tree structure
I am developing some client side Javascript that is using some JSON web services

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.