Method POST or GET

how to create a formular with 'POST' or 'GET' method

You would set URLRequest.method property to either URLRequestMethod.POST or URLRequestMethod.GET
Kenneth Kawamoto
http://www.materiaprima.co.uk/

Similar Messages

  • Form method=post - Nevermind, I fixed it.

    I have a weird problem.
    If I make the form method=get, then everything works fine when I submit the form. However, when I make form method=post, I get this error message when I try to submit the form:
    Your request cannot be completed. The server got the following error:
    javax.servlet.jsp.JspTagException
    Does anyone have any idea why this would happen?
    Thanks for your time. Any help is greatly appreciated.
    Message was edited by:
    user449101

    Nevermind, I found my problem.

  • Urgent , Post or Get method?

    hello all;
    when i deploy a servelt on growser with the GET method , the servlet is working all right, but when i use POST method (to change database) , i have error , please tell me how and when i use Post method?

    GET and POST are two different ways of passing data from a browser to a server. With the GET method, the browser constructs a Query String (?var1=val&var2=val...) which is passed to the server as part of the URL. With the POST method, the data from the browser is passed via standard input to the server. You determine which method is used when you build the HTML form:
    <FORM ACTION="/path/action_servlet" METHOD="POST">
    OR
    <FORM ACTION="/path/action_servlet" METHOD="GET">
    <INPUT TYPE="TEXT" NAME="var1">
    <INPUT TYPE="TEXT" NAME="var2">
    <INPUT TYPE="SUBMIT">
    </FORM>
    In the case of servlets, either the doGet() or doPost() method will be executed depending on how the data is passed from the browser.
    In general, use the GET method for debugging or if you want the client to be able to bookmark the entire URL (with parameters). If you have an application where you are "changing the database", you probably want to use the POST method.
    -- Brian
    null

  • NavigateToURL where URLRequest method = POST always defaults to GET

    Hi there
    I'm trying to invoke a PHP URL using the HTTP POST method combined with parameters to pass to a form. The test app is an AIR application as per the code below. Whilst the default browser is launched with the URL specified, my issue is that the method used at runtime is always HTTP GET not POST. I'm not sure what I'm doing wrong. I'd be really grateful if somebody could review and point out my mistake!
    Many thanks
    Ed
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
    <![CDATA[
    import flash.net.navigateToURL;
      private function newWin(url:String):void {
                    var urlRequest:URLRequest = new URLRequest(url);
    var variables:URLVariables = new URLVariables();
        var rhArray:Array = new Array(new URLRequestHeader("Content-Type", "text/html"));
    urlRequest.requestHeaders = rhArray;
                variables.username = "admin";
                variables.password = "admin";
                variables.domain   = "Default";
                urlRequest.data = variables;               
    urlRequest.method = "POST";
                    navigateToURL(urlRequest);
    private function buttonclick() : void
    this.newWin("http://10.0.5.176/contactq/index.php");
    ]]>
    </mx:Script>
    <mx:Canvas id = "myCanvas" height="400" width="400">
    <mx:Button id="myButton" click="buttonclick();" x="169" y="166" width="91" label="Invoke URL"/>
    </mx:Canvas>
    </mx:WindowedApplication>

    Firefox stores certificates that a server sends automatically in cert8.db for easier access, but that can also cause conflict if servers sends a certificate that is already stored.

  • Post and Get value in jsp page

    I have two pages
    1. Occasion.jsp
    2. Occasionsdetail.jsp
    i select values from database in occasion for example
    a
    b
    c
    they become links when i click on one of these links it call Occasiondetail form. Where i want to display details of that particular record
    On occasion page i am passing value which is displaying in last of address bar of occasionsdetail page
    How can i use that value in occasiondetail form
    both files code is pasted
    Occasions.jsp
    <head>
    <title>
    Riphah International University
    </title>
    </head>
    <body bgcolor="#ffffff">
    <form method="POST" action="occasionDetails.jsp">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td align="center" bgcolor="#6633FF"> <strong><font color="#000000">Occasions</font></strong> </td>
    </tr>
    <% org.riu.db.utility.DBHandler dbHandler = new org.riu.db.utility.DBHandler();
    if ( dbHandler.getConnection() ) {
    org.riu.db.datastructureaccess.OccasionAccess occasionAccess = new org.riu.db.datastructureaccess.OccasionAccess(dbHandler);
    java.util.ArrayList occasions = occasionAccess.getOccasions();
    if ( occasions == null || occasions.isEmpty() ) { %>
    <tr>
    <td align="center">
    </td>
    </tr>
    <% } else {
    for ( int i = 0; i < occasions.size(); i++ ) {
    org.riu.db.datastructure.Occasion occasion = (org.riu.db.datastructure.Occasion) occasions.get(i); %>
    <tr>
    <td align="center">
    <a href="occasionDetails.jsp?OccasionID <%=occasion.getOccasionID() %> "><%= occasion.getName() %></a> <%= " on " + occasion.getDate() %><%= + occasion.getSemesterID()%>
    </td>
    </tr>
    <tr>
    <td align="center">
    <hr />
    </td>
    </tr>
    <% }
    } %>
    </table>
    <p align="center">Back</p>
    </form>
    </body>
    </html>
    OccasionDetail.jsp
    <head>
    <title>
    Riphah International University
    </title>
    </head>
    <body bgcolor="#ffffff">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td align="center" bgcolor="#6633FF"> <strong><font color="#000000">Occasion Details</font></strong> </td>
    </tr>
    <% org.riu.db.utility.DBHandler dbHandler = new org.riu.db.utility.DBHandler();
    if ( dbHandler.getConnection() ) {
    org.riu.db.datastructureaccess.OccasionAccess occasionAccess = new org.riu.db.datastructureaccess.OccasionAccess(dbHandler);
    java.util.ArrayList occasions = occasionAccess.getOccasionswhere(I want to use that value here);
    // new Integer(request.getParameter("OccasionID")).intValue();
    if ( occasions == null || occasions.isEmpty() ) { %>
    <tr>
    <td align="center">
    </td>
    </tr>
    <% } else {
    for ( int i = 0; i < occasions.size(); i++ ) {
    org.riu.db.datastructure.Occasion occasion = (org.riu.db.datastructure.Occasion) occasions.get(i);%>
    <tr>
    <td align="center">
    Venue: <%= occasion.getVenue()%>
    </td>
    </tr>
    <tr>
    <td align="center">
    Time: <%= occasion.getTime() %>
    </td>
    </tr>
    <tr>
    <td align="center">
    <hr />
    </td>
    </tr>
    <% }
    } %>
    </table>
    <p align="center">Back</p>
    </body>
    </html>

    Are your records javascript variables? If so, you can use a json formatter to serialize the records to a string and send it from PageA to PageB using mechanism that supports strings (i.e. query parameter, cookie, etc).
    You can learn more about json at http://www.json.org/ and about a json serializer/parser at http://www.json.org/js.html .

  • How to post and get data from server using Get Webrequest

    Hi:-)
    I'm trying to send a username and password argument my server and the server is suppose to send some string back. The following code, that I got of the web, just dies. I think this line:
    HttpWebRequestpreq = result.AsyncState
    asHttpWebRequest;
    is null. Can you kindly fix this for me? Thank you in advance:-)
    notes: I have a few textboxes with the values for the request params
    I'm targeting Windows Phone 8.0 and Windows Phone 8.1 devices
    privatevoidBtnSignUpSubmit_Tab(objectsender,
    RoutedEventArgse)
    //show error if Username == Username
    if(TbUN.Text.ToString() ==
    "Username")
    MessageBox.Show("You
    must fill in your Username in the Username textbox.\nThank you.");
    return;
    //make sure all fields are filled in
    if(TbUN.Text.ToString() ==
    ""|| TbPW.Text.ToString()
    == ""|| TbCPW.Text.ToString()
    == "")
    MessageBox.Show("All
    fields must be filled in.\nThank you.");
    return;
    //make sure Password is the same as Confirm Password
    if(TbPW.Text.CompareTo(TbCPW.Text) !=
    0)
    MessageBox.Show("Your
    Password should be the same as Confirm Password.\nThank you.");
    return;
    //make sure Username contains valid characters
    boolbValid = IsUsernameValid(TbUN.Text);
    if(bValid)
                    bSignUp =
    true;
    //disable textboxes
                    TbUN.IsEnabled =
    false;
                    TbPW.IsEnabled =
    false;
                    TbCPW.IsEnabled =
    false;
                    TbEmail.IsEnabled =
    false;
                    BtnSignUpSubmit.IsEnabled =
    false;
                    title.Text =
    "requesting...";
    //make Post request top-server
    //add parameters
    stringdata =
    "username="+TbUN.Text+"&Password="+TbPW.Text;
    if(TbEmail.Text.Contains("@")
    && TbEmail.Text.Contains("."))
                        data +=
    "&email="+ TbEmail.Text;
                    System.
    UriURL =
    newUri("http://www.iclips.co.za/RegisterUsernameAndPassword.php");
    WebRequestwebRequest =
    WebRequest.Create(URL);
                    webRequest.Method =
    "POST";
                    webRequest.ContentType =
    "application/x-www-form-urlencoded";
                    webRequest.ContentLength = data.Length;
    //we first obtain an input stream to which to write the body of the HTTP POST
                    webRequest.BeginGetRequestStream((
    IAsyncResultresult) =>
    HttpWebRequestpreq = result.AsyncState
    asHttpWebRequest;
    if(preq !=
    null)
    StreampostStream = preq.EndGetRequestStream(result);
    //guess one could just accept a byte[] [via function argument] for arbitrary data types - images, audio,...
    byte[] dataStream =
    Encoding.UTF8.GetBytes(data);
                            postStream.Write(dataStream, 0, dataStream.Length);
                            postStream.Close();
    //we can then finalize the request...
                            preq.BeginGetResponse((
    IAsyncResultfinal_result) =>
    HttpWebRequestreq = final_result.AsyncState
    asHttpWebRequest;
    if(req !=
    null)
    try
    //we call the success callback as long as we get a response stream
    WebResponseresponse = req.EndGetResponse(final_result);
                                        success_callback(response.GetResponseStream());
    catch(WebExceptionwe)
    //otherwise call the error/failure callback
                                        error_callback(we.Message);
    return;
                            }, preq);
                    }, URL);
    privatevoiderror_callback(stringp)
    if(bSignUp)
                    bSignUp =
    false;
    // Show error message
    MessageBox.Show("Connection
    Error!\n\n"+ p);
    //enable input
    //disable textboxes
                    TbUN.IsEnabled =
    true;
                    TbPW.IsEnabled =
    true;
                    TbCPW.IsEnabled =
    true;
                    TbEmail.IsEnabled =
    true;
                    BtnSignUpSubmit.IsEnabled =
    false;
                    title.Text =
    "try again";
    privatevoidsuccess_callback(Streamstream)
    if(bSignUp)
                    bSignUp =
    false;
    // Open the stream using a StreamReader for easy access.
    StreamReaderreader =
    newStreamReader(stream);
    // Read the content.
    stringresponse = reader.ReadToEnd();
    // Display the content.
    MessageBox.Show(response);
    // Clean up the streams.
                    reader.Close();

    // Directives
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Navigation;
    using Microsoft.Phone.Controls;
    using Microsoft.Phone.Shell;
    using iClips.Resources;
    using System.ComponentModel;
    using System.Threading;
    using System.IO;
    using System.IO.IsolatedStorage;
    using Microsoft.Devices;
    using System.Windows.Media;
    using Microsoft.Xna.Framework.Media;
    using System.Windows.Media.Imaging;
    using System.Threading.Tasks;
    using System.Text;
    using Windows.Storage;
    using System.Windows.Threading;
    using System.Diagnostics;
    using System.Globalization;
    namespace iClips
    public partial class MainPage : PhoneApplicationPage
    Boolean bSignUp;
    HyperlinkButton BtnSignIn, BtnSignUp, BtnSignUpSubmit;
    TextBox TbUN, TbPW, TbCPW, TbEmail;
    TextBlock un, title;
    System.DateTime startTime;
    // Viewfinder for capturing video.
    private VideoBrush videoRecorderBrush;
    // Source and device for capturing video.
    private CaptureSource captureSource;
    private CaptureDevice vcDevice;
    double w, h;
    // File details for storing the recording.
    private IsolatedStorageFileStream isoVideoFile;
    private FileSink fileSink;
    private string isoVideoFileName = "CameraMovie.mp4";
    // For managing button and application state.
    private enum ButtonState { Initialized, Stopped, Ready, Recording, Playback, Paused, NoChange, CameraNotSupported };
    private ButtonState currentAppState;
    //create reference to SocketClient
    SocketClient sock = new SocketClient();
    // Constructor
    public MainPage()
    InitializeComponent();
    //setup recording
    // Prepare ApplicationBar and buttons.
    PhoneAppBar = (ApplicationBar)ApplicationBar;
    PhoneAppBar.IsVisible = true;
    StartRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[0]);
    StopPlaybackRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[1]);
    StartPlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[2]);
    PausePlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[3]);
    //display a welcome message
    txtDebug.Text = "Welcome to iClips.";
    string result = sock.Connect("197.189.214.116", 5000);
    txtOutput.Text = result;
    if(result.Contains("success")){
    sock.Send("#testing_");
    SetScreenResolution();
    //set image on load friends
    /*Uri uri = new Uri("/Assets/home_icons/myFriends.png", UriKind.Relative);
    BitmapImage imgSource = new BitmapImage(uri);
    Image image = new Image();
    image.Source = imgSource;
    load_friends.Content = image;*/
    SignIn();
    private void SignIn()
    // remove all elements inside sign grid
    for (int index = MyGrid.Children.Count - 1; index >= 0; index--)
    MyGrid.Children.RemoveAt(index);
    BtnSignIn = new HyperlinkButton();
    BtnSignIn.Content = "<< Sign In >>";
    BtnSignIn.Click += new RoutedEventHandler(SignIn_Tab);
    BtnSignIn.VerticalAlignment = VerticalAlignment.Bottom;
    BtnSignUp = new HyperlinkButton();
    BtnSignUp.Content = "<< I'm new here. Sign Up. >>";
    BtnSignUp.Click += new RoutedEventHandler(SignUp_Tab);
    BtnSignUp.VerticalAlignment = VerticalAlignment.Bottom;
    un = new TextBlock();
    un.Text = "Enter your Username:";
    un.VerticalAlignment = VerticalAlignment.Bottom;
    un.HorizontalAlignment = HorizontalAlignment.Center;
    TextBlock pw = new TextBlock();
    pw.Text = "Enter your Password:";
    pw.VerticalAlignment = VerticalAlignment.Bottom;
    pw.HorizontalAlignment = HorizontalAlignment.Center;
    //setup username textbox
    TbUN = new TextBox();
    TbUN.Opacity = 0.5;
    TbUN.Text = "";
    TbUN.FontSize = 16;
    TbUN.FontWeight = FontWeights.ExtraBold;
    TbUN.Foreground = new SolidColorBrush(Colors.Black);
    TbUN.Background = new SolidColorBrush(Colors.Transparent);
    TbUN.VerticalAlignment = VerticalAlignment.Top;
    TbUN.Height = 70;
    TbUN.Tap += TbUN_Tap;
    //setup password textbox
    TbPW = new TextBox();
    TbPW.Opacity = 0.5;
    TbPW.Text = "";
    TbPW.FontSize = 16;
    TbPW.FontWeight = FontWeights.ExtraBold;
    TbPW.Foreground = new SolidColorBrush(Colors.Black);
    TbPW.Background = new SolidColorBrush(Colors.Transparent);
    TbPW.VerticalAlignment = VerticalAlignment.Top;
    TbPW.Height = 70;
    TbPW.Tap += TbPW_Tap;
    //Show the background color of MyGrid
    MyGrid.Background = new SolidColorBrush(Colors.Blue);
    // Create Row for Username Textblock
    RowDefinition gridRow0 = new RowDefinition();
    gridRow0.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow0);
    // Create Row for Username
    RowDefinition gridRow1 = new RowDefinition();
    gridRow1.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow1);
    //create row for password Textblock
    RowDefinition gridRow2a = new RowDefinition();
    gridRow2a.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow2a);
    //create row for password
    RowDefinition gridRow2 = new RowDefinition();
    gridRow2.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow2);
    //create row for << Sign In >>
    RowDefinition gridRow3 = new RowDefinition();
    gridRow3.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow3);
    //create row for << Sign Up >>
    RowDefinition gridRow4 = new RowDefinition();
    gridRow4.Height = new GridLength(120);
    MyGrid.RowDefinitions.Add(gridRow4);
    Grid.SetRow(un, 0);
    Grid.SetColumn(un, 0);
    Grid.SetRow(TbUN, 1);
    Grid.SetColumn(TbUN, 0);
    Grid.SetRow(pw, 2);
    Grid.SetColumn(pw, 0);
    Grid.SetRow(TbPW, 3);
    Grid.SetColumn(TbPW, 0);
    Grid.SetRow(BtnSignIn, 4);
    Grid.SetColumn(BtnSignIn, 0);
    Grid.SetRow(BtnSignUp, 5);
    Grid.SetColumn(BtnSignUp, 0);
    MyGrid.Children.Add(un);
    MyGrid.Children.Add(TbUN);
    MyGrid.Children.Add(pw);
    MyGrid.Children.Add(TbPW);
    MyGrid.Children.Add(BtnSignIn);
    MyGrid.Children.Add(BtnSignUp);
    private void SignUp_Tab(object sender, RoutedEventArgs e)
    MessageBox.Show("Welcome to Sign up.\n\nYou need 3 things to create an account:\n1. A unique Case-Sensitive Username. ex 'iClips' is not the same as 'Iclips'\n2. A password to secure you account. \n3. A profile photo for easy recognition.\nThank you.");
    // remove all elements inside sign grid
    for (int index = MyGrid.Children.Count - 1; index >= 0; index--)
    MyGrid.Children.RemoveAt(index);
    //repopulate grid with Sign Up elements
    //create title
    title = new TextBlock();
    title.Text = "--- Sign Up 1/2 ---";
    title.VerticalAlignment = VerticalAlignment.Top;
    title.HorizontalAlignment = HorizontalAlignment.Center;
    //field for Username
    TbUN = new TextBox();
    TbUN.Opacity = 0.5;
    TbUN.Text = "Username";
    TbUN.FontSize = 16;
    TbUN.FontWeight = FontWeights.ExtraBold;
    TbUN.Foreground = new SolidColorBrush(Colors.Black);
    TbUN.Background = new SolidColorBrush(Colors.Transparent);
    TbUN.VerticalAlignment = VerticalAlignment.Top;
    TbUN.Height = 70;
    TbUN.Tap += TbUN_Tap;
    //field for Password
    TbPW = new TextBox();
    TbPW.Opacity = 0.5;
    TbPW.Text = "Password";
    TbPW.FontSize = 16;
    TbPW.FontWeight = FontWeights.ExtraBold;
    TbPW.Foreground = new SolidColorBrush(Colors.Black);
    TbPW.Background = new SolidColorBrush(Colors.Transparent);
    TbPW.VerticalAlignment = VerticalAlignment.Top;
    TbPW.Height = 70;
    TbPW.Tap += TbPW_Tap;
    //field Confirm for Password
    TbCPW = new TextBox();
    TbCPW.Opacity = 0.5;
    TbCPW.Text = "Confirm Password";
    TbCPW.FontSize = 16;
    TbCPW.FontWeight = FontWeights.ExtraBold;
    TbCPW.Foreground = new SolidColorBrush(Colors.Black);
    TbCPW.Background = new SolidColorBrush(Colors.Transparent);
    TbCPW.VerticalAlignment = VerticalAlignment.Top;
    TbCPW.Height = 70;
    TbCPW.Tap += TbCPW_Tap;
    //field for Optional Email
    TbEmail = new TextBox();
    TbEmail.Opacity = 0.5;
    TbEmail.Text = "Email (Optional)";
    TbEmail.FontSize = 16;
    TbEmail.FontWeight = FontWeights.ExtraBold;
    TbEmail.Foreground = new SolidColorBrush(Colors.Black);
    TbEmail.Background = new SolidColorBrush(Colors.Transparent);
    TbEmail.VerticalAlignment = VerticalAlignment.Top;
    TbEmail.Height = 70;
    TbEmail.Tap += TbEmail_Tap;
    HyperlinkButton BtnGoBack = new HyperlinkButton();
    BtnGoBack.Content = "<< Go Back ";
    BtnGoBack.Click += new RoutedEventHandler(BtnGoBack_Tab);
    BtnGoBack.VerticalAlignment = VerticalAlignment.Bottom;
    BtnSignUpSubmit = new HyperlinkButton();
    BtnSignUpSubmit.Content = "<< Sign Up >>";
    BtnSignUpSubmit.Click += new RoutedEventHandler(BtnSignUpSubmit_Tab);
    BtnSignUpSubmit.VerticalAlignment = VerticalAlignment.Bottom;
    // Create Row for title
    RowDefinition gridRow0 = new RowDefinition();
    gridRow0.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow0);
    // Create Row for Username
    RowDefinition gridRow1 = new RowDefinition();
    gridRow1.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow1);
    //create row for password Textblock
    RowDefinition gridRow2a = new RowDefinition();
    gridRow2a.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow2a);
    //create row for Confirm password
    RowDefinition gridRow2 = new RowDefinition();
    gridRow2.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow2);
    //create row for email
    RowDefinition gridRow3 = new RowDefinition();
    gridRow3.Height = new GridLength(60);
    MyGrid.RowDefinitions.Add(gridRow3);
    //create row for << Sign Up >>
    RowDefinition gridRow4 = new RowDefinition();
    gridRow4.Height = new GridLength(120);
    MyGrid.RowDefinitions.Add(gridRow4);
    //create row for << Go Back >>
    RowDefinition gridRow5 = new RowDefinition();
    gridRow5.Height = new GridLength(120);
    MyGrid.RowDefinitions.Add(gridRow5);
    Grid.SetRow(title, 0);
    Grid.SetColumn(title, 0);
    Grid.SetRow(TbUN, 1);
    Grid.SetColumn(TbUN, 0);
    Grid.SetRow(TbPW, 2);
    Grid.SetColumn(TbPW, 0);
    Grid.SetRow(TbCPW, 3);
    Grid.SetColumn(TbCPW, 0);
    Grid.SetRow(TbEmail, 4);
    Grid.SetColumn(TbEmail, 0);
    Grid.SetRow(BtnSignUpSubmit, 5);
    Grid.SetColumn(BtnSignUpSubmit, 0);
    Grid.SetRow(BtnGoBack, 6);
    Grid.SetColumn(BtnGoBack, 0);
    MyGrid.Children.Add(title);
    MyGrid.Children.Add(TbUN);
    MyGrid.Children.Add(TbPW);
    MyGrid.Children.Add(TbCPW);
    MyGrid.Children.Add(TbEmail);
    MyGrid.Children.Add(BtnSignUpSubmit);
    MyGrid.Children.Add(BtnGoBack);
    BtnSignUp.Content = "<< Sign Up >>";
    private bool IsUsernameValid(string str)
    int d;
    if (str.Length > 30)
    MessageBox.Show("You may only use a maximum of 30 characters for your Username.\nThank you.");
    return false;
    for (d = 0; d < str.Length; d++)
    if (str.Contains("~") || str.Contains("!") || str.Contains("@") || str.Contains("$")
    || str.Contains("#") || str.Contains("%") || str.Contains("|") || str.Contains("_"))
    MessageBox.Show("Your Username may not contain any of the follwing characters: \n~ ! @ # $ % | _\nThank you.");
    return false;
    return true;
    private void BtnSignUpSubmit_Tab(object sender, RoutedEventArgs e)
    //show error if Username == Username
    if (TbUN.Text.ToString() == "Username")
    MessageBox.Show("You must fill in your Username in the Username textbox.\nThank you.");
    return;
    //make sure all fields are filled in
    if (TbUN.Text.ToString() == "" || TbPW.Text.ToString() == "" || TbCPW.Text.ToString() == "")
    MessageBox.Show("All fields must be filled in.\nThank you.");
    return;
    //make sure Password is the same as Confirm Password
    if (TbPW.Text.CompareTo(TbCPW.Text) != 0)
    MessageBox.Show("Your Password should be the same as Confirm Password.\nThank you.");
    return;
    //make sure Username contains valid characters
    bool bValid = IsUsernameValid(TbUN.Text);
    if (bValid)
    bSignUp = true;
    //disable textboxes
    TbUN.IsEnabled = false;
    TbPW.IsEnabled = false;
    TbCPW.IsEnabled = false;
    TbEmail.IsEnabled = false;
    BtnSignUpSubmit.IsEnabled = false;
    title.Text = "requesting...";
    //make Post request top-server
    //add parameters
    string data = "username="+TbUN.Text+"&Password="+TbPW.Text;
    if(TbEmail.Text.Contains("@") && TbEmail.Text.Contains("."))
    data += "&email=" + TbEmail.Text;
    System.Uri URL = new Uri("http://www.iclips.co.za/RegisterUsernameAndPassword.php");
    WebRequest webRequest = WebRequest.Create(URL);
    webRequest.Method = "POST";
    webRequest.ContentType = "application/x-www-form-urlencoded";
    webRequest.ContentLength = data.Length;
    //we first obtain an input stream to which to write the body of the HTTP POST
    webRequest.BeginGetRequestStream((IAsyncResult result) =>
    HttpWebRequest preq = result.AsyncState as HttpWebRequest;
    if (preq != null)
    Stream postStream = preq.EndGetRequestStream(result);
    //guess one could just accept a byte[] [via function argument] for arbitrary data types - images, audio,...
    byte[] dataStream = Encoding.UTF8.GetBytes(data);
    postStream.Write(dataStream, 0, dataStream.Length);
    postStream.Close();
    //we can then finalize the request...
    preq.BeginGetResponse((IAsyncResult final_result) =>
    HttpWebRequest req = final_result.AsyncState as HttpWebRequest;
    if (req != null)
    try
    //we call the success callback as long as we get a response stream
    WebResponse response = req.EndGetResponse(final_result);
    success_callback(response.GetResponseStream());
    catch (WebException we)
    //otherwise call the error/failure callback
    error_callback(we.Message);
    return;
    }, preq);
    }, URL);
    private void error_callback(string p)
    if (bSignUp)
    bSignUp = false;
    // Show error message
    MessageBox.Show("Connection Error!\n\n" + p);
    //enable input
    //disable textboxes
    TbUN.IsEnabled = true;
    TbPW.IsEnabled = true;
    TbCPW.IsEnabled = true;
    TbEmail.IsEnabled = true;
    BtnSignUpSubmit.IsEnabled = false;
    title.Text = "try again";
    private void success_callback(Stream stream)
    if (bSignUp)
    bSignUp = false;
    // Open the stream using a StreamReader for easy access.
    StreamReader reader = new StreamReader(stream);
    // Read the content.
    string response = reader.ReadToEnd();
    // Display the content.
    MessageBox.Show(response);
    // Clean up the streams.
    reader.Close();
    private void BtnGoBack_Tab(object sender, RoutedEventArgs e)
    SignIn();
    private void TbEmail_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    TbEmail.SelectAll();
    private void TbCPW_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    TbCPW.SelectAll();
    private void SignIn_Tab(object sender, RoutedEventArgs e)
    if (TbUN.Text.ToString() == "" || TbPW.Text.ToString() == "")
    MessageBox.Show("Your Username or Password cannot be empty.\nThank you.");
    return;
    private void TbUN_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    TbUN.SelectAll();
    un.Text = "Usernames are Case-Sensitive.\n'Iclips' is not the same as 'iClips'.";
    private void TbPW_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    TbPW.SelectAll();
    protected override void OnNavigatedTo(NavigationEventArgs e)
    base.OnNavigatedTo(e);
    // Initialize the video recorder.
    InitializeVideoRecorder();
    CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;
    // The event is fired when the shutter button receives a full press.
    CameraButtons.ShutterKeyPressed += OnButtonFullPress;
    // The event is fired when the shutter button is released.
    CameraButtons.ShutterKeyReleased += OnButtonRelease;
    protected override void OnNavigatedFrom(NavigationEventArgs e)
    // Dispose of camera and media objects.
    DisposeVideoPlayer();
    DisposeVideoRecorder();
    base.OnNavigatedFrom(e);
    CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress;
    CameraButtons.ShutterKeyPressed -= OnButtonFullPress;
    CameraButtons.ShutterKeyReleased -= OnButtonRelease;
    // Ensure that the viewfinder is upright in LandscapeRight.
    protected override void OnOrientationChanged(OrientationChangedEventArgs e)
    if (vcDevice != null)
    if (e.Orientation == PageOrientation.LandscapeLeft)
    txtDebug.Text = "LandscapeLeft";
    videoRecorderBrush.RelativeTransform =
    new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
    //rotate logo
    if (logo != null)
    RotateTransform rt = new RotateTransform();
    rt.Angle = 90;
    //default rotation is around top left corner of the control,
    //but you sometimes want to rotate around the center of the control
    //to do that, you need to set the RenderTransFormOrigin
    //of the item you're going to rotate
    //I did not test this approach, maybe You're going to need to use actual coordinates
    //so this bit is for information purposes only
    logo.RenderTransformOrigin = new Point(0.5, 0.5);
    logo.RenderTransform = rt;
    //rotate sign in link
    if (MyGrid != null)
    RotateTransform rt = new RotateTransform();
    rt.Angle = 90;
    //default rotation is around top left corner of the control,
    //but you sometimes want to rotate around the center of the control
    //to do that, you need to set the RenderTransFormOrigin
    //of the item you're going to rotate
    //I did not test this approach, maybe You're going to need to use actual coordinates
    //so this bit is for information purposes only
    MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
    MyGrid.RenderTransform = rt;
    if (e.Orientation == PageOrientation.PortraitUp)
    txtDebug.Text = "PortraitUp";
    videoRecorderBrush.RelativeTransform =
    new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 0 };
    //rotate logo
    if (logo != null)
    RotateTransform rt = new RotateTransform();
    rt.Angle = 0;
    //default rotation is around top left corner of the control,
    //but you sometimes want to rotate around the center of the control
    //to do that, you need to set the RenderTransFormOrigin
    //of the item you're going to rotate
    //I did not test this approach, maybe You're going to need to use actual coordinates
    //so this bit is for information purposes only
    logo.RenderTransformOrigin = new Point(0.5, 0.5);
    logo.RenderTransform = rt;
    //rotate sign in link
    if (MyGrid != null)
    RotateTransform rt = new RotateTransform();
    rt.Angle = 0;
    //default rotation is around top left corner of the control,
    //but you sometimes want to rotate around the center of the control
    //to do that, you need to set the RenderTransFormOrigin
    //of the item you're going to rotate
    //I did not test this approach, maybe You're going to need to use actual coordinates
    //so this bit is for information purposes only
    MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
    MyGrid.RenderTransform = rt;
    if (e.Orientation == PageOrientation.LandscapeRight)
    txtDebug.Text = "LandscapeRight";
    // Rotate for LandscapeRight orientation.
    //videoRecorderBrush.RelativeTransform =
    //new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 180 };
    //rotate logo
    if (logo != null)
    RotateTransform rt = new RotateTransform();
    rt.Angle = -90;
    //default rotation is around top left corner of the control,
    //but you sometimes want to rotate around the center of the control
    //to do that, you need to set the RenderTransFormOrigin
    //of the item you're going to rotate
    //I did not test this approach, maybe You're going to need to use actual coordinates
    //so this bit is for information purposes only
    logo.RenderTransformOrigin = new Point(0.5, 0.5);
    logo.RenderTransform = rt;
    //rotate sign in link
    if (MyGrid != null)
    RotateTransform rt = new RotateTransform();
    rt.Angle = -90;
    //default rotation is around top left corner of the control,
    //but you sometimes want to rotate around the center of the control
    //to do that, you need to set the RenderTransFormOrigin
    //of the item you're going to rotate
    //I did not test this approach, maybe You're going to need to use actual coordinates
    //so this bit is for information purposes only
    MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
    MyGrid.RenderTransform = rt;
    if (e.Orientation == PageOrientation.PortraitDown)
    txtDebug.Text = "PortraitDown";
    videoRecorderBrush.RelativeTransform =
    new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 270 };
    // Provide auto-focus with a half button press using the hardware shutter button.
    private void OnButtonHalfPress(object sender, EventArgs e)
    // Focus when a capture is not in progress.
    try
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = "Half Button Press: Auto Focus";
    catch (Exception focusError)
    // Cannot focus when a capture is in progress.
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = focusError.Message;
    // Capture the image with a full button press using the hardware shutter button.
    private void OnButtonFullPress(object sender, EventArgs e)
    // Focus when a capture is not in progress.
    try
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = "Full Button Press: Auto Focus";
    catch (Exception focusError)
    // Cannot focus when a capture is in progress.
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = focusError.Message;
    // Cancel the focus if the half button press is released using the hardware shutter button.
    private void OnButtonRelease(object sender, EventArgs e)
    try
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = "Shutter is released: Auto Focus";
    catch (Exception focusError)
    // Cannot focus when a capture is in progress.
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = focusError.Message;
    // Update the buttons and text on the UI thread based on app state.
    private void UpdateUI(ButtonState currentButtonState, string statusMessage)
    // Run code on the UI thread.
    Dispatcher.BeginInvoke(delegate
    switch (currentButtonState)
    // When the camera is not supported by the phone.
    case ButtonState.CameraNotSupported:
    StartRecording.IsEnabled = false;
    StopPlaybackRecording.IsEnabled = false;
    StartPlayback.IsEnabled = false;
    PausePlayback.IsEnabled = false;
    break;
    // First launch of the application, so no video is available.
    case ButtonState.Initialized:
    StartRecording.IsEnabled = true;
    StopPlaybackRecording.IsEnabled = false;
    StartPlayback.IsEnabled = false;
    PausePlayback.IsEnabled = false;
    break;
    // Ready to record, so video is available for viewing.
    case ButtonState.Ready:
    StartRecording.IsEnabled = true;
    StopPlaybackRecording.IsEnabled = false;
    StartPlayback.IsEnabled = true;
    PausePlayback.IsEnabled = false;
    break;
    // Video recording is in progress.
    case ButtonState.Recording:
    StartRecording.IsEnabled = false;
    StopPlaybackRecording.IsEnabled = true;
    StartPlayback.IsEnabled = false;
    PausePlayback.IsEnabled = false;
    break;
    // Video playback is in progress.
    case ButtonState.Playback:
    StartRecording.IsEnabled = false;
    StopPlaybackRecording.IsEnabled = true;
    StartPlayback.IsEnabled = false;
    PausePlayback.IsEnabled = true;
    break;
    // Video playback has been paused.
    case ButtonState.Paused:
    StartRecording.IsEnabled = false;
    StopPlaybackRecording.IsEnabled = true;
    StartPlayback.IsEnabled = true;
    PausePlayback.IsEnabled = false;
    break;
    default:
    break;
    // Display a message.
    txtDebug.Text = statusMessage;
    // Note the current application state.
    currentAppState = currentButtonState;
    public void InitializeVideoRecorder()
    if (captureSource == null)
    // Create the VideoRecorder objects.
    captureSource = new CaptureSource();
    fileSink = new FileSink();
    vcDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
    // Add eventhandlers for captureSource.
    captureSource.CaptureFailed += new EventHandler<ExceptionRoutedEventArgs>(OnCaptureFailed);
    // Initialize the camera if it exists on the phone.
    if (vcDevice != null)
    // Create the VideoBrush for the viewfinder.
    videoRecorderBrush = new VideoBrush();
    videoRecorderBrush.SetSource(captureSource);
    // Display the viewfinder image on the rectangle.
    viewfinderRectangle.Fill = videoRecorderBrush;
    // Start video capture and display it on the viewfinder.
    captureSource.Start();
    // Set the button state and the message.
    UpdateUI(ButtonState.Initialized, "Tap record to start recording...");
    else
    // Disable buttons when the camera is not supported by the phone.
    UpdateUI(ButtonState.CameraNotSupported, "A camera is not supported on this phone.");
    // Set recording state: start recording.
    private void StartVideoRecording()
    try
    // Connect fileSink to captureSource.
    if (captureSource.VideoCaptureDevice != null
    && captureSource.State == CaptureState.Started)
    captureSource.Stop();
    // Connect the input and output of fileSink.
    fileSink.CaptureSource = captureSource;
    fileSink.IsolatedStorageFileName = isoVideoFileName;
    // Begin recording.
    if (captureSource.VideoCaptureDevice != null
    && captureSource.State == CaptureState.Stopped)
    captureSource.Start();
    // Set the button states and the message.
    UpdateUI(ButtonState.Recording, "Recording...");
    StartTimer();
    // If recording fails, display an error.
    catch (Exception e)
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = "ERROR: " + e.Message.ToString();
    //start the timer
    private void StartTimer()
    dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
    dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
    dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
    dispatcherTimer.Start();
    startTime = System.DateTime.Now;
    private void StopTimer()
    dispatcherTimer.Stop();
    private void dispatcherTimer_Tick(object sender, EventArgs e)
    System.DateTime now = System.DateTime.Now;
    txtRecTime.Text = now.Subtract(startTime).ToString();
    // Set the recording state: stop recording.
    private void StopVideoRecording()
    try
    // Stop recording.
    if (captureSource.VideoCaptureDevice != null
    && captureSource.State == CaptureState.Started)
    captureSource.Stop();
    // Disconnect fileSink.
    fileSink.CaptureSource = null;
    fileSink.IsolatedStorageFileName = null;
    // Set the button states and the message.
    UpdateUI(ButtonState.Stopped, "Preparing viewfinder...");
    StopTimer();
    StartVideoPreview();
    // If stop fails, display an error.
    catch (Exception e)
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = "ERROR: " + e.Message.ToString();
    // Set the recording state: display the video on the viewfinder.
    private void StartVideoPreview()
    try
    // Display the video on the viewfinder.
    if (captureSource.VideoCaptureDevice != null
    && captureSource.State == CaptureState.Stopped)
    // Add captureSource to videoBrush.
    videoRecorderBrush.SetSource(captureSource);
    // Add videoBrush to the visual tree.
    viewfinderRectangle.Fill = videoRecorderBrush;
    captureSource.Start();
    // Set the button states and the message.
    UpdateUI(ButtonState.Ready, "Ready to record.");
    // If preview fails, display an error.
    catch (Exception e)
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = "ERROR: " + e.Message.ToString();
    // Start the video recording.
    private void StartRecording_Click(object sender, EventArgs e)
    // Avoid duplicate taps.
    StartRecording.IsEnabled = false;
    StartVideoRecording();
    // Handle stop requests.
    private void StopPlaybackRecording_Click(object sender, EventArgs e)
    // Avoid duplicate taps.
    StopPlaybackRecording.IsEnabled = false;
    // Stop during video recording.
    if (currentAppState == ButtonState.Recording)
    StopVideoRecording();
    // Set the button state and the message.
    UpdateUI(ButtonState.NoChange, "Recording stopped.");
    // Stop during video playback.
    else
    // Remove playback objects.
    DisposeVideoPlayer();
    StartVideoPreview();
    // Set the button state and the message.
    UpdateUI(ButtonState.NoChange, "Playback stopped.");
    // Start video playback.
    private void StartPlayback_Click(object sender, EventArgs e)
    // Avoid duplicate taps.
    StartPlayback.IsEnabled = false;
    // Start video playback when the file stream exists.
    if (isoVideoFile != null)
    VideoPlayer.Play();
    // Start the video for the first time.
    else
    // Stop the capture source.
    captureSource.Stop();
    // Remove VideoBrush from the tree.
    viewfinderRectangle.Fill = null;
    // Create the file stream and attach it to the MediaElement.
    isoVideoFile = new IsolatedStorageFileStream(isoVideoFileName,
    FileMode.Open, FileAccess.Read,
    IsolatedStorageFile.GetUserStoreForApplication());
    VideoPlayer.SetSource(isoVideoFile);
    // Add an event handler for the end of playback.
    VideoPlayer.MediaEnded += new RoutedEventHandler(VideoPlayerMediaEnded);
    // Start video playback.
    VideoPlayer.Play();
    // Set the button state and the message.
    UpdateUI(ButtonState.Playback, "Playback started.");
    // Pause video playback.
    private void PausePlayback_Click(object sender, EventArgs e)
    // Avoid duplicate taps.
    PausePlayback.IsEnabled = false;
    // If mediaElement exists, pause playback.
    if (VideoPlayer != null)
    VideoPlayer.Pause();
    // Set the button state and the message.
    UpdateUI(ButtonState.Paused, "Playback paused.");
    private void DisposeVideoPlayer()
    if (VideoPlayer != null)
    // Stop the VideoPlayer MediaElement.
    VideoPlayer.Stop();
    // Remove playback objects.
    VideoPlayer.Source = null;
    isoVideoFile = null;
    // Remove the event handler.
    VideoPlayer.MediaEnded -= VideoPlayerMediaEnded;
    private void DisposeVideoRecorder()
    if (captureSource != null)
    // Stop captureSource if it is running.
    if (captureSource.VideoCaptureDevice != null
    && captureSource.State == CaptureState.Started)
    captureSource.Stop();
    // Remove the event handler for captureSource.
    captureSource.CaptureFailed -= OnCaptureFailed;
    // Remove the video recording objects.
    captureSource = null;
    vcDevice = null;
    fileSink = null;
    videoRecorderBrush = null;
    // If recording fails, display an error message.
    private void OnCaptureFailed(object sender, ExceptionRoutedEventArgs e)
    this.Dispatcher.BeginInvoke(delegate()
    txtDebug.Text = "ERROR: " + e.ErrorException.Message.ToString();
    // Display the viewfinder when playback ends.
    public void VideoPlayerMediaEnded(object sender, RoutedEventArgs e)
    // Remove the playback objects.
    DisposeVideoPlayer();
    StartVideoPreview();
    public void SetScreenResolution()
    w = Application.Current.Host.Content.ActualWidth;
    h = Application.Current.Host.Content.ActualHeight;
    setResViewF(w, h);
    public void setResViewF(double width, double height)
    viewfinderRectangle.Width = width;
    viewfinderRectangle.Height = height;
    resMI.Content = "resolution: " + width + "*" + height;
    private void resMI_Click(object sender, RoutedEventArgs e)
    switch (resMI.Content.ToString())
    case "resolution: 176*220":
    setResViewF(240, 320);
    break;
    case "resolution: 240*320":
    setResViewF(360, 480);
    break;
    case "resolution: 360*480":
    setResViewF(480, 800);
    break;
    case "resolution: 480*800":
    setResViewF(1440, 720);
    break;
    case "resolution: 1440*720":
    setResViewF(1920, 1080);
    break;
    case "resolution: 1920*1080":
    setResViewF(176, 220);
    break;
    default:
    setResViewF(176, 220);
    break;
    public void WriteToFile(string key, string value)
    var Iso_settings = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings;
    if (!Iso_settings.Contains(key))
    Iso_settings.Add(key, value);
    Iso_settings.Save();//This will save your data in isolated storage.
    public string ReadFromFile(string key)
    var Iso_settings = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings;
    if (Iso_settings.Contains(key))
    return (string)Iso_settings[key];
    else
    return null;
    public DispatcherTimer dispatcherTimer { get; set; }
    private void ToggleZoom(MediaElement media)
    if (media.Stretch != Stretch.UniformToFill)
    // zoom
    media.Stretch = Stretch.UniformToFill;
    else
    // unzoom
    media.Stretch = Stretch.Uniform;
    BtnSignUpSubmit_Tab is the HyperLinkButton that would trigger the web request process. I need this code to work perfectly because a lot of people will use this. If you can simplify the http web request that already feels so good. Thank you. 

  • OC4J Form method="post" don't working

    Hello!
    I have a J2EE Application with Servlets and jsp's, with OC4J v.10.1.3 installed in my computer, with one page called index.jsp with this code:
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <%@page import="java.util.Enumeration"%>
    <%
    String auth = request.getHeader("Authorization");
    String usuario = "";
    if (auth == null) {
    response.setStatus(response.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "NTLM");
    return;
    if (auth.startsWith("NTLM ")) {
    byte[] msg =
    new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));
    int off = 0, length, offset;
    if (msg[8] == 1) {
    off = 18;
    byte z = 0;
    byte[] msg1 =
    {(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S',
    (byte)'S', (byte)'P', z,
    (byte)2, z, z, z, z, z, z, z,
    (byte)40, z, z, z, (byte)1, (byte)130, z, z,
    z, (byte)2, (byte)2, (byte)2, z, z, z, z, //
    z, z, z, z, z, z, z, z};
    response.setStatus(response.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "NTLM "
    + new sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());
    return;
    else if (msg[8] == 3) {
    off = 30;
    length = msg[off+17]*256 + msg[off+16];
    offset = msg[off+19]*256 + msg[off+18];
    usuario = new String(msg, offset, length);
    //out.println(s + " ");
    else
    return;
    length = msg[off+1]*256 + msg[off];
    offset = msg[off+3]*256 + msg[off+2];
    usuario = new String(msg, offset, length);
    //out.println(s + " ");
    length = msg[off+9]*256 + msg[off+8];
    offset = msg[off+11]*256 + msg[off+10];
    usuario = new String(msg, offset, length);
    usuario = usuario.replaceAll(" ", "");
    usuario = usuario.trim();
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <script type="text/javascript">
         function enviarForm() {
              document.frmLogin.submit();
              return true;
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Mapfre Asistencia</title>
    </head>
    <body onload="javascript:enviarForm();return true">
    <form name="frmLogin" method="post" action="/mapfre_content/ConectorOCDB" enctype="application/x-www-form-urlencoded; charset=UTF-8">
    <%
         Enumeration num = request.getParameterNames();
         while (num.hasMoreElements()) {
              String param = (String) num.nextElement();
              String valor = request.getParameter(param);
              request.getSession().setAttribute(param, valor);
    %>
    <input type="hidden" name="<%=param%>" value="<%=valor%>"/>
    <% } %>
    <input type="hidden" name="user" value="<%=usuario%>"/>
    </form>
    </body>
    </html>
    The first part is to obtain the Windows username and last, the part to generate the form dinamically, because the number of parameters may vary, well, all works perfectly but when I send the form to the Servlet, the parameters value appears as NULL.
    Curiosly, the parameters arrives well if I change the form method to GET, ¿what's wrong with this code or with the server configuration?
    Thank You!!

    set the form to multipart/form-data (required for file uploads, as a little research could have told you) and use Apache FileUpload to parse the request.

  • ERROR RENDERING PDF IN SERVLET WITH FORM method="post"

    Hello,
    we are trying to render a dinamic PDF document in a servlet building with XSL:FO apache or itext.
    The problem ocurs when we sending a Form data with method post, the output of the servlet is a blank page instead of the pdf document. Also if we send the form data with method "get" we can view the pdf document corretly.
    But we need to send amount information, and can?t use method get.
    Thank

    You can always use GET to send information by generating a dynamic URL in the query string (after the '?'). Granted, you don't want to send file data that way, but it will work for small numbers of arguments where privacy is not a concern.
    As to why you see the PDF in one instance and not another, I'm not sure. There is no difference from an HTTP standpoint. You sent a request, you are getting a response. The browser should treat the response the same, regardless of GET vs POST.
    Are you setting the content-type to application/pdf? Are you doing something fishy with Javascript? Do you have conditional logic in your code that fires on a POST but not on a GET that actually has a bug in it (since GET works but it was designed for POST)?
    - Saish
    "My karma ran over your dogma." - Anon

  • How to use method POST to send XML using utl_http?

    Hi,
    I am trying to work out how to use the POST method to mimic submitting data from a HTML form, using utl_http.
    I cannot use SOAP for this as the people I am sending the data to are just expecting an XML document to be sent to a standard CGI script running on their web server.
    There is a lot of documentation on how to submit data using the POST method (using Utl_Http.Write_Text etc), but I cannot find anything that tells me how to submit form variables.
    The examples on OTN say this:
    "Alternatively use method => 'POST' and Utl_Http.Write_Text to
    build an arbitrarily long message"
    but don't tell me how to actually place the data into the required input parameters of the CGI program I am hitting.
    I need to hit a URL such as
    www.asite.com/cgiprogram
    and pass in a parameter, eg
    in_param="test+data"
    I am currently doing this as a GET, which works, but the XML document I am passing in could potentially be bigger than the GET method will allow.
    Any help would be greatly appreciated.
    Thanks,
    Leon.

    Please try the PL/SQl forum

  • Method Post

    Hi to evrtybody, I'm new here.
    I have a problem with method post:
    I have a webapp that shows filter and report pages, I generate it with XHTML, through my Servlet.
    For example when I get back at previous page, from my report page; that one results expired; so I have to refresh it.
    I don't think that the problem consists in the set filter datas again, but probably in some browser configuration.
    I'm sure to find many answers and to improve my java knowledge.
    Thanks in advance.

    Usually, with content returned to the user's browser with the POST method, this occurs regularly. It would be asking too much to consider a scheme where the objects that you need information from (such as the objects used to create your dynamic XHTML stuff in the servlet) be available in a greater web application context, such as the user's session or even the application context. If, for example, you used Struts as your framework, you would be much better off.

  • Method POST of the HTTP

    Hello,
    I'm using a CSS11501 with 7.30.00 software version.
    During the work sessions, users must fillfull a virtual shop cart, so they use the method POST.
    From the servers logs, I have found that the css passes to the servers only the url and no the content sent by users. So the requests fail.
    If I remove the css from the system, the servers work properly.
    Is it caused by a bug of the software version css is using? How can I resolve it?
    Thanks.
    Regards
    Bye

    Would you happen to be doing a redirect of the HTTP POST? Such as to HTTPS or another HTTP url. I found that when an HTTP POST is redirected the client changes to an HTTP GET when sending to the new URL.
    If you are redirecting, look at the forum post below:
    Content Networking
    CSM redirect problem: http to https (http post changed to get)
    Hope this helps,
    Mark

  • Defining container for BO FIPP method POST

    Hi Experts,
    New to workflow, we are creating a program that instantiate BO FIPP method POST, how to create container for this fields?
    object-key-documentno. object-key-sourcecompanycode. object-key-fiscalyear.
    We will populate this from parameters.
    Thanks!

    Hi John
    I am not sure if I got your requirement clearly, but if you are trying to call the processing of POST method of FIPP via a stand alone ABAP code, you can use the following:
    Call FM SWO_CREATE where objtype = 'FIPP' and objkey = concatenated string of Doc No, Source Company Code and Fiscal year (including spaces and/or leading zeros ... iam assuming that you have this key in your ABAP program)
    You will get the FIPP object Reference in parameter "object"
    Now using this reference, call FM SWO_INVOKE  where Access = 'C' (that is, call a method......if you need to read an attribute, you can make this as 'G'), Object = the object reference from above call to SWO_CREATE and VERB = 'POST' (if left blank, the default method of the BO is called for access 'C' and for access 'G', the default attribute is returned if no value is given). Pass any method data in "container".
    Hope this is what you were looking for....if not... please elaborate on your requirement.
    Regards,
    Modak

  • Method POST no Allowed error. See my code, please.

    What happend here?.
    At submit the form I see the next error:
    Method Not Allowed
    The requested method POST is not allowed for the URL filesend.jsp.
    Thanks.
    **** filesend.jsp file ******
    <%
    if (request.getParameter("fichero")==null)
    %>
    <html>
    <head>
    <title>How send a file</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <form name="form1" enctype="multipart/form-data" method="post" action="filesend.jsp">
    <input type="file" name="fichero">
    <input type="submit">
    </form>
    </body>
    </html>
    <%
    else
    // Here the code for load the data after post submit
    %>

    Your web server must be told that this kind of page (.jsp) can accept the POST method (default is GET only). It is not an error in the code. Talk to your server admin.

  • OAM - Method POST Not Allowed

    Hi,
    I have OAM setup with WebLogic Server using OHS as a Webserver. I am not complete yet but just to check I have created a sample login page which will be prompted (Or user wil be redirected) when I will try to access a resource (WebPage) hosted on WLS. I have created this page in 'Orahome_2/Apache/htdocs/login.html'. I can access this page manually on 'http://IP_ADDRESS:PORT/login.html' as following;
    >
    <html>
    <head>
    <title>T24 SSO Login</title>
    <script language="JavaScript">
    function submitForm() {
    document.forms[0].submit();
    </script>
    </head>
    <body bgcolor="#ffffff" onLoad="self.focus();document.loginform.login.focus()">
    <center>
    <h2>T24 SSO Login</h2>
    <form name="loginform" action="/webgateaccess/oblix/apps/webgate/bin/webgate.dll" method="post">
    <table cellspacing="0" cellpadding="0" border="0">
    <tr><td valign="center" align="left"><b>Username</b></td>
    <td>    </td><td valign="center" align="left">
    <input type="username" name="userid" size="20" value=""></td>
    </tr>
    <tr>
    <td valign="center" align="left"><b>Password</b></td>
    <td>    </td><td valign="center" align="left">
    <input type="password" name="password" size="20" value=""></td>
    </tr>
    </table>
    <input type=submit id=submit name=submit value=submit />
    </form>
    </body>
    </html>
    When I Press Submit I Get Following Error On Page_
    Method Not Allowed
    The requested method POST is not allowed for the URL /webgateaccess/oblix/apps/webgate/bin/webgate.dll.
    Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server Server at ukdsk-hpoplaw.europe.temenosgroup.com Port 7777
    What could be the possible reason???
    Thanks,
    Sjunejo
    Edited by: Sheeraz Junejo on 05-Oct-2009 13:30

    Hi Miller,
    I am using '/webgateaccess/oblix' because there is already an alias which is pointing towards access server installation directory and it was completely failing by giving an error message that 'File not found on server' and there was no file even directory called webgate inside access server installation. So I declare one more alai called webgateaccess/oblix and point it towards the 'Webgate/access/oblix' which has 'apps/common/webgate/bin/webgate.dll' file and that what we are lokkiing for is it???
    Yes at this point both of my defaul Policy domains were not enabled so I enabled it but its still giving me the same error message. could you please post a link for Form based authentication tips.
    Finally, I was searching and had this comment that this error can be ommit out by providing a +Execcgi rights to this directory or file explicitly using following xml (Something like);
    <Location /webgateaccess/oblix/apps/common/webgate/bin>
    Options +Execgi
    Order Allow,deny
    Allow from all
    </Location>
    Is it???
    Thanks,
    Sjunejo

  • Binding ArrayCollection to HTTPService method="POST" xml result

    Hi All,
    Firstly apologies for posting all this code!
    I have the following app that adds & displays in a
    datagrid the data from a mysql db, works fine so far.
    #########################<START
    SNIP>##########################
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns="*" layout="absolute"
    backgroundGradientColors="[#0080ff,#80ffff]"
    creationComplete="send_data()">
    <!-- This is the Script to SetUp Functions-->
    <mx:Script>
    <![CDATA[
    private function youveClicked():void {
    mx.controls.Alert.show('You Clicked!!!');
    private function send_data():void {
    staffcodeRequest.send();
    ]]>
    </mx:Script>
    <!-- This is the HTTPService-->
    <mx:HTTPService id="staffcodeRequest" url="
    http://192.168.0.84/amfphp/services/staffcode.php"
    useProxy="false" method="POST">
    <mx:request xmlns="">
    <firstname>{firstname.text}</firstname><surname>{surname.text}</surname><staffcode>{staff code.text}</staffcode><emailaddress>{emailaddress.text}</emailaddress><department>{departm ent.text}</department>
    </mx:request>
    </mx:HTTPService>
    ###########################<END
    SNIP>##########################
    I'm thinking of Binding the the xml formated results into an
    arrayCollection & then use the filterFunction to allow a user
    to filter the data (is this possible?).
    (Below is some code that I found in a thread & am using
    to work from as an example)
    #########################<START
    SNIP>##########################
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical" creationComplete="initData()">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    [Bindable]
    private var dataList:ArrayCollection ;
    private function initData():void{
    dataList= new ArrayCollection([
    {name:"school A", city:"Dartford"},
    {name:"school B", city:"Pomona "},
    {name:"School C", city:"Phillipsburg"}
    private function filterDemo():void{
    dataList.filterFunction = searchDemo;
    dataList.refresh();
    private function searchDemo(item:Object):Boolean{
    var isMatch:Boolean = false
    if(item.name.toLowerCase().search(search.text.toLowerCase())
    != -1){
    isMatch = true
    return isMatch;
    private function clearSearch():void{
    dataList.filterFunction = null;
    dataList.refresh();
    search.text = '';
    ]]>
    </mx:Script>
    ###########################<END
    SNIP>##########################
    If it is possible, I need some help in integrating the
    following code, (I've tried but keep getting {1151: A conflict
    exists with definition staffcodeRequest in namespace internal.})
    #########################<START
    SNIP>##########################
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns="*" layout="absolute"
    backgroundGradientColors="[#0080ff,#80ffff]"
    creationComplete="send_data()">
    <!-- This is the Script to SetUp Functions-->
    <mx:Script>
    <![CDATA[
    private function youveClicked():void {
    mx.controls.Alert.show('You Clicked!!!');
    private function send_data():void {
    staffcodeRequest.send();
    <!--Can I just Bind the arrayCollection here-->
    import mx.collections.ArrayCollection;
    [Bindable]
    private var staffcodeRequest:ArrayCollection;
    private function filterDemo():void{
    staffcodeRequest.filterFunction = searchDemo;
    staffcodeRequest.refresh();
    private function searchDemo(item:Object):Boolean{
    var isMatch:Boolean = false
    if(item.staffcode.toLowerCase().search(search.text.toLowerCase())
    != -1){
    isMatch = true}
    return isMatch;
    private function clearSearch():void{
    staffcodeRequest.filterFunction = null;
    staffcodeRequest.refresh();
    search.text = '';
    ]]>
    </mx:Script>
    <!-- This is the HTTPService-->
    <mx:HTTPService id="staffcodeRequest" url="
    http://192.168.0.84/amfphp/services/staffcode.php"
    useProxy="false" method="POST">
    <mx:request xmlns="">
    <firstname>{firstname.text}</firstname><surname>{surname.text}</surname><staffcode>{staff code.text}</staffcode><emailaddress>{emailaddress.text}</emailaddress><department>{departm ent.text}</department>
    </mx:request>
    </mx:HTTPService>
    ###########################<END
    SNIP>##########################
    What I am strugling with is BINDING the returned xml formated
    results to an arrayCollection, and changing from the static xml
    file example to mxl formated txt received from the mysql db on the
    fly.
    Help would be grate ;-)
    TIA
    Danny

    From what I've read, it seems that a Proxy Server, such as
    BlazeDS or FDS, is required if you want to use anything other than
    GET or POST and set the useProxy property to true.
    What is the motivation of requiring a proxy server to support
    HTTP PUT or DELETE?

Maybe you are looking for

  • Error while control update

    I have a problem. I have a large project and I need to modify it. I want to add some elements to control (Strict Type Def.). My control - it is a cluster with numbers (or arrays). But I can't to do it. When I want to save a new (modify) control, it a

  • Error 829 in SOST tcode while sending an email attachment ??

    Hi.. I am using the function module "SO_NEW_DOCUMENT_ATT_SEND_API1" to send an email attachment. The program is getting executed successfully but when i see in SOST transaction, i am getting an error message. Error number is 829 and it says " Interna

  • Droid Pro Cycling On and Off

    My brand new Droid Pro keeps going on and off.  Bought it yesterday, can't get it to stop.  Suggestions please before I return to store?

  • How should i need to do keyboard not working in mac

    Last Saturday I opened my macbook but I cannot used keyboard and other social network as well. I was tried to take off battery and restarted again and again but I cannot used keyboard till date. One more thing my Itunes also out off date. I didn't us

  • Problem with call barring password

    I have a 3310 which I bought secondhand, it works perfectly except it won't recognise the call barring password. I called my service provider Vodafone who gave me the default password but that doesn't work. The previous owner had used the phone on Or