How to Submit doGet and doPost request using javascript ?

Hi,
My requirement is:
Need to submit form to two different methods doGet and doPost.
doGet will authenticate the request by asking to enter username and password.
After successful authentication we need to call doPost to submit the data of form.
I tried using Get(url); and Post(url,data,type); methods of FormCalc but i am not able to retrive the attribute and its value using Post.
my FormCalc script is
Get("https://server:port/servlet"); //I am able to call doGet method successfully
Post("https://server:port/servler","user=abcd&password=123456"); //I am able to call doPost method but I am not able to retrive the attribute user and password in doPost method.
i tried request.getAttribute("user"); and also i tried request.getParameter("user");
both are coming as null. How to submit form data to doPost method of servlet.
Also I would like to know is there any javascript for the same.

Why do you want to use javascript..? Why not action listener..? You can check whether its an empty string by checking
if(str != null && !str.equals("")) {..}
where str is the variable for inputText value.
If this is not helpful, do provide more details on which version of JDev you are using and what are you trying (your usecase).
regards,
~Krithika

Similar Messages

  • Is it possible to use doGet() and doPost method in one jsp

    i am having a jsp form which will perform upload as well as download.There is a seperate servlet for download and upload.For downloading i use doGet method and doPost for the upload.how can i change the method dynamically for the above cases.

    Hi,
    in your jsp, if you call:
    request.getMethod();
    it should the string "GET" or "POST" depending on the HTTP method used, so you could do something like
    <%
    String httpMethod = request.getMethod();
    if ( "GET".equals(httpMethod) ) {
    // code to handle get requests
    else if ( "POST".equals(httpMethod) ) {
    // code to handle post requests
    %>
    I probably would of done it in a servlet(override doGet and doPost), or 2 seperate jsps
    Hope this helps
    Dominic

  • How does SingleThreadModel handles doget and dopost?

    Hi,
    I have a requirement to synchronize the DB transactions but my servlet has doGet and doPost methods instead of service method.
    public class EMEATPRates extends HttpServlet implements SingleThreadModel{
    doGet(){
    synchronized(){
    ---Gets the data from DB and displayes on a page
    doPost(){
    synchronized(){
    ----saves the changes to the DB
    I need to get a lock when an user requests for page(doGet()) and release the lock only after he saves it(doPost).
    Does SingleThreadModel handles this?

    HTTP GET requests submit any form parameters within the URL of the request itself. HTTP POST requests submit any form parameters within the HTTP message body. Let's say you have two forms for a logon screen:
    userid, password
    HTTP GET: http://localhost:8080/LoginServlet?userid=foo&password=bar
    [http headers]
    [http body (empty)]
    HTTP POST: http://localhost:8080/LoginServlet
    [http headers]
    userid=foo&password=bar
    Clearly, for something like a logon screen, you would want to POST (no need to see the user's password in a URL if someone walks by). Otherwise, the implementation is up to you. I personally like cleaner-looking URL's, so I usually POST.
    - Saish

  • Write a servlet without doGet() and doPost() methods

    Hi,
    Can we write a servlet without doGet() and doPost() methods ?

    public class MyCoolServlet extends HttpServlet
    public void init(ServletConfig servletConfig) throws ServletException
    public void service(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
    // your code here
    }Just an example on how to do it.
    A servlet is loaded by server (before any request). It will run the init function. Then pick up an request, spawn a thread and put this servlet code into the thread, give it session, request and response objects, then call serivce.
    Remember that init is called before, outside the thread, while service is inside the thread and the last to be called. Nice place to put your code.
    If you need to have some sort of init function to be called first on every request PR USER, then make your own function, and call it first in service method.
    Stuff that are put in init() function might only get runned once in the entire server lifetime. Until restart.

  • Difference Between doGet() and doPost

    Hi Everyone !!!
    I'm very new to servlets.I dont know what is the difference between doGet() and doPost() Method.
    Can anyone explain me .
    Can any give me details and differences between these two
    thanks in advance

    As you mention Why developer will use GET, if POST have all the advantages. Please look into, it may clear you doubts
    GET
    the GET type request is normally used for simple HTML page requests. The types of events that generate this type of request are clicking on a hyperlink, changing the address directly by typing in the address textbox on a browser or application that has HTML functionality, and submitting an HTML form where the method header is set to get as in method=get. Also, a GET request is triggered when selecting a favorite from the Favorites list and using JavaScript to change location.href. Usually the browser is configured to send a GET request even if no method is set explicitly by the HTML.
    The benefits of the GET method are
    1. It retrieves information such as a simple HTML page or the results of a database query.
    2. It supports query strings (name-value pairs appended to URL). Servers usually limit query strings to about      
         1024 characters.
    3. It allows bookmarks.
    POST
    This occurs when a browser or application submits an HTML form with the method attribute set to post as in method=post.
    The benefits of the POST method are
    1. It sends information to the server such as form fields, large text bodies, and key-value pairs.
    2. It hides form data because it isn't passed as a query string, but in the message body.
    3. It sends unlimited length data as part of its HTTP request body.
    4. It disallows bookmarks.
    Conclusion, always prefer to use GET, except mentioned in the following reason:
    1. If data is sensitive
    2. It is greater than 1024 characters
    3. If your application don't need bookmarks
    As because GET is more faster than POST.
    Both are used to send the request to the server, if you analyze than you may make the differnces like
    In the case of GET means send the request to get the simple HTML page from server whereas, in the case of POST means send the request to post the data to server.
    By Ausaf Ahmad
    Message was edited by:
    Genius_Brainware

  • Jave servlets- doget() and dopost() methods.

    Iam trying to learn servlets but got confused on these doget() and dopost() methods usage. I just want to know generally what does these methods do in general (like the doget() sets the header..but what about dopost()?). I saw some example code where doget() is called within a dopost()method so Iam not clear about their purposes.
    I'd appreciate any help possible. Thank you.

    The doPost() and doGet() (also doHead() etc.) methods are all designed to handle specific HTTP request types. eg: doGet() handles HTTP GET requests (requests caused by common HTML links or typing a URL in your browser's address bar) while POST handles HTTP POST requests (commonly generated by HTML form submissions).
    When you see an example of a serlvet's doGet() being called within it's doPost(), it is because, at least for part of the processing, the servlet will be treating the two request types the same way.

  • Custom Component : How to detect what charset the request used?

    I want to write a file upload component, this component must use the same charset as the request used to decode file name from data post from web browser, How to detect what charset the request used?

    Hi Eddie,
    As Arjit suggested, there are a bunch of functions available in WEBI like GetDominantPreferredViewingLocale(), GetLocale() and GetPreferredViewingLocale(), etc. that you could use.
    There are no such specific functions provided within Dashboards tool.
    So, you can create a WEBI report, and have one of these formulas specified in a variable in the webi report. Then, have the block published as a BIWS and use this BIWS in your dashboard.

  • The Differrence between doget and dopost

    doget and dopost are urally used in the same class, but the function which afford seem the same. Except that doget resposes get, dopost responses post, what are the other or real difference between them?
    Can E-Mail:[email protected]

    difrent is between send param option in HTTP protocol
    if you use GET method param send in URL You can see http://something?param=1&param2=1
    if you use POST method param send in body You can't see param in URL
    if you want use doGet for both method (GET,POST) you have to write
    public void doPost(...){
    doGet(...);
    public void doGet(...){
    your code
    Siplo

  • How do I edit and sign documents using adobe?

    How do I edit and sign documents using adobe?

    To edit a document you will need Acrobat Pro.

  • How can I design and send emailers using Adobe Muse?

    Hello Geeks,
    How can I design and send emailers using this wonderful software called Adobe Muse?

    Hi
    Are you referring , creating email templates or sending marketing campaigns ?
    We cannot create templates as Muse doesn't output HTML optimized for e-mail output.
    Regarding email campaigns, you can setup this from hosting platform end.
    More details :
    https://forums.adobe.com/message/5469744
    Re: Is it possible to create email templates using Muse?
    Thanks,
    Sanjit

  • How to create Profit and loss account using report painter

    Dear All,
    Can some one guide me as to how to create Profit and loss account using report painter.
    If some one can share the document having steps to be done,would be of great help.
    Thanks in advance.
    Regards,
    Gokul

    Hi,
    Could you please re-phrase your question? As the report painter is a reporting tool I assume you want to report on P&L accounts and not u201Ccreateu201D them. A few more details on what you intend to report would be useful.
    Regards
    Karl

  • How could JAVA API and ABAP API useful to MDM.

    Hi Experts,
    How could JAVA API and ABAP API useful to MDM, and any coding in Java or ABAP is required in MDM.

    Hi Reema,
    Java API and ABAP API are verry usefull to MDM to integrate MDM with other SAP componants like SAP R\3, EP etc. :
    It dose not required any coding in MDM infact in JAVA API coding can be done on NWDS(Netweaver Developer Studio).And for ABAP API coding is done on SAP R\3 System in ABAP editor.
    JAVA API:
    By using Java API MDM client operations can be performed.For one need to install NWDS and to deploy some .jar files and with the help of standard classes and interfaces it can be connected to MDM server and various operations like create repository ,connect to repository ,Data mainuplation etc.
    ABAP API:
    Suppose you have an Expert abaper and you want him to perform MDM operations.In that case he need not to learn MDM basic Data types infact by doing some settings on R\3 and MDM server side an ABAPer  can perform
    MDM Cnsole and MDM Data Manager level operations.
    you can go through these links
    http://help.sap.com/javadocs/MDM/SP06/overview-summary.html
    /people/bv.pillai/blog/2006/11/28/installing-mdmtech-add-on-and-configuring-the-mdm4a-mdm-for-abap-api
    Here the coding is done on SAP R\3 system.
    hope it will give you some idea about Java API and ABAP API
    Reward if helpful
    Thanks ,
    Vinay Yadav

  • I have a iPad2 you tell me how to view movies and games to use facebook

    I have a iPad2 you tell me how to view movies and games to use facebook.
    Thanks and best regards,
    Luigi Vitali

    Hi Luigi,
    well, your Question is not very concrete.
    you can watch Film with Itunes. You can rent or buy there Movies.
    You also can sync movies from your mac to the Ipad - just add them to the Mediathek and sync the Folder/File. Quick Time give you the Function - put these open Video File to Itunes. You also have the possibilty in imvoie. 
    With Facebook games, i cant help help you - i dont like Facebook, and i dont use this service. But when these games are Flash Games you arenot able to use them with you Ipad, because ipad have not Flash support.

  • I bought this ipod 4 from a friend the lock button does not work and he doesnt know the password? how do i reset and i cant use my computer????   HELP!!!!!!

    i bought this ipod 4 from a friend the lock button does not work and he doesnt know the password? how do i reset and i cant use my computer????
    HELP!!!!!!

    Place the iOS device in recovery mode usning this program and then then restore via iTunes. The iPod will be erased.
    RecBoot: Easy Way to Put iPhone into Recovery Mode
    For how to restore:
    iTunes: Restoring iOS software

  • How to get inputtext's inputvalue by using javascript

    how to get inputtext's inputvalue by using javascript?
    and how to judge whether its be filled or empty string

    Why do you want to use javascript..? Why not action listener..? You can check whether its an empty string by checking
    if(str != null && !str.equals("")) {..}
    where str is the variable for inputText value.
    If this is not helpful, do provide more details on which version of JDev you are using and what are you trying (your usecase).
    regards,
    ~Krithika

Maybe you are looking for