Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to pass parameter to java program??

 
Ann Toh
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
can anybody tell me how to pass parameter from a form in a JSP page to a java program???
<FORM ACTION="http://localhost:8080/SDC1/servlet/parserupload?Name=<%= session.getAttribute("theName")%>" METHOD=POST ENCTYPE="multipart/form-data">
the above codes is the form tag but how to put <%=session.getAttribute("theName")%> into a string so that i can pass the string to my program???


Thanx in advance...
 
sumana ar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i usually use a string to store the url and pass that string to the action..this is shown below..
-------------------------
<%
String att = (String) session.getAttribute("theName");
String url = "http://localhost:8080/SDC1/servlet/parserupload?Name="+att;
%>
<FORM ACTION=<%=url%> METHOD=POST ENCTYPE="multipart/form-data">
---------------
hope this helps solve u'r problem

--sumana
 
Ann Toh
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sumana,
thanx alot, my things can work already....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic