PHP Programmer that's new to Java/JSP have a quick question or two!

Hi All:

I’m a PHP programmer who’s new to I’m new to Java and JSP as a whole and am having some difficulties understanding some seemingly basic concepts.

Is a “servlet” essentially a compiled application that sits on a server that a JSP script can interact with? i.e. if I built a servlet that could handle addition - I could pass two numbers to a servlet and it will spit back ?

Also, pardon my ignorance but - what is an “action”(as it relates to Struts2)? I ask because I am trying to figure out the process of how this code works. I have a piece of HTML that links to “/go/login” - which the location is defined in a struts-config.xml file as an action with a type of a method (com.xxx.xxx…) - which then redirects the browser t a URL that it builds (including data tacked on to the URL originally to pass via GET)…

I need to change this to POST instead of GET… is that terribly difficult? It seems as much.

Essentially I have:
String data1Key=“Data1Name”;
String data2Key=“Data2Name”;
String data1 = datasource.getData1();
String data2 = datasource.getData2();
String urlToPost = datasource.postingURL();

and need to (I made up my own syntax, but I think you may get the idea :slight_smile: )

response.sendRedirectViaPost(urlToPost, (data1Key => data1, data2Key => data2));

Thanks,

Matrocka

A WEB Browser requests a Web page from a WEB server. The web server sends back the page to the
WEB Browser for display. A web browser may also send information to a web server like information
in a form. The web server must process this information. CGI programming is used when a server
has to process information from a web browser like a form. CGI stands for Common Gateway
Interface. CGI is not a programming language in itself but uses languages like Perl, C, C++ and now
Java to do the communication between the WEB Browser and the WEB Server.
When Java is used on a Web Server it is called a servlet. The data sent between the web page and
the server still uses http protocol. The servlets just process the data received from the web browser
and sends the data back to the web browser using http protocol. CGI programming using Java
servlets are much easier to use, then by using languages like Perl, C or C++.

Thanks. That didn’t directly answer my question, but it gave me some great insight!