How to get the information in a form

i need to get the information from the next form and write it to a file:

<FORM>
<SELECT name="UType" >
     <OPTION value="Provider">Chamberlain Provider</OPTION>
     <OPTION value="Intern">Chamberlain User</OPTION>
</SELECT>
<input type=hidden value="1" name="1"/>
<input type=submit value=Submit>
</FORM>
LVL 2
mmarthaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ldbkuttyCommented:
hi mmartha,
do you mean you want to get the form information and write it into a text file !?
why do you have hidden field !?
can you be more specific ?
0
mmarthaAuthor Commented:
yes, I meant to get the form information and write it into a text file. Ignore the hidden field.
0
TimYatesCommented:
<%
    String uType = request.getParameter( "UType" ) ;
%>
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

TimYatesCommented:
Then, to write it into a file:

<%
    String uType = request.getParameter( "UType" ) ;
    FileWriter fw = null ;
    try
    {
        fw = new FileWriter( "/stats.txt", true ) ;
        fw.write( uType ) ;
        fw.write( "\n" ) ;
    }
    catch( IOException ex )
    {
        ex.printStackTrace() ;
    }
    finally
    {
        try { if( fw != null ) fw.close() ; } catch( IOException ex ) {}
    }
%>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TimYatesCommented:
that will append lines to the file "stats.txt" in the root folder of your machine...
0
ldbkuttyCommented:
If the file does not already exist, it is automatically created.
    try {
        BufferedWriter out = new BufferedWriter(new FileWriter("outfilename"));
        out.write(request.getParameter( "UType" ));
        out.close();
    } catch (IOException e) {
    }

0
TimYatesCommented:
You will need to add:

<%@ page import="java.io.*" %>

to the top of the jsp too ;-)
0
ldbkuttyCommented:
seems i am late... ;)
0
TimYatesCommented:
>  If the file does not already exist, it is automatically created.

That too ;-)
0
MacroLandCommented:
seems everything is all set :)
0
TimYatesCommented:
mmartha, how's it going?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.