• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JSP Submit from java code  RSS feed

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I wonder can some one help me here? Basically i have a very simple jsp page which on a submit press will forward an email address to a servlet which does processing on the email address which all works grand when the button is pressed manually.

Now so want im trying to do is perform a java http post to the web server on
my computer from a simple java app, the java app builds the address and
parameters then does a http post which works but the actually jsp does not do submit, all i get back on the in stream from the http post is the jsp contents and not the results that would have occurred if the jsp had submitted the info to the servlet my java app posted to it.

Its like my address is built ok but all it makes the jsp do is a refresh and not a post. If ya get me?



Above is what i send on the http post, Does anybody know how to make my JSP submit to the servlet from java code?

Best
Mark
 
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is a bit confusing. What are you trying to do ?

a. Submit to the servlet from a JSP
b. Submit to the servlet from a java standalone app
c. Submit to the servlet using a JSP from a standalone app

option c actually does not make sense but I am just trying to figure out what you want to do. You can submit from the JSP using the 'submit' input type or my using javascript to submit your form
 
Mark Hughes
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
b. Submit to the servlet from a java standalone app
c. Submit to the servlet using a JSP from a standalone app

I guess option b is ultimately what i want to do but i did not know a stand alone app can communicate with a servlet, i thought only a jsp could do that which is why i was trying option c.

stand alone app communicates with a jsp which communciate with a servlet.

The jsp works by communicating with servlet but i want it to be automatic so a user will never actually see the jsp page or servlet, only use a standalone java app which talks to a server.
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to submit to a URL from a standalone Java app, look at
URLConnection.html and its subclasses.

There is also a higher level Apache project that could save you some coding
http://jakarta.apache.org/commons/httpclient


Since this is no longer about JSP, I'm going to move it to our Sockets and Internet Protocols forum.
 
Mark Hughes
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thanks ill look at them.

best
Mark
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!