Some users recently reported that they learned how to call a servlet from jsp without a form.
Approved: Fortect
This may be a second question, sorry. I wrote a jsp page that contains buttons. Each button has its own servlet to invoke. I want to know if it is possible to call these servlets without using a form, because the user can choose any of the three offered functions.
Configurations <%String [] label = "Main Port", "Baud Rate", "Symbol Size", "Stop Bits", "Parity", "RTU Port", "Baud Rate", "Symbol Size", "Stop Bits", " Parity ";integer i = 0;%>
$ dataValues.get (0) Header1 <% = label [i ++]%>: $ data
Header2 <% = label [i ++]%>: $ data
This configuration will be done immediately
This layout is NOT running
thought Feb 13 ’12 at 6:49 am
347
Can’t Find The Answer You’re Looking For? Find Similar Questions With Tag Java Javascript HTML JSP Servlets Or Ask Your Own Question.
-
Change the form url based on each button with JavaScript, true, before submitting the POST request;
-
Just in case, use Develop and the same servlet. In the servlet, you have to find out what was clicked next to the button (you recognize this as a passed request parameter) and then act accordinglyin the appropriate way.
68.3k
Approved: Fortect
Fortect is the world's most popular and effective PC repair tool. It is trusted by millions of people to keep their systems running fast, smooth, and error-free. With its simple user interface and powerful scanning engine, Fortect quickly finds and fixes a broad range of Windows problems - from system instability and security issues to memory management and performance bottlenecks.
answered Feb 13 ’12 at 6:56
920
To do this, you can take full advantage of Ajax or a terrible but effective way to change the current URL of the main window and reload our page.
I recommend you use Ajax if you want to use ExtJS. See Using Ext.Ajax
68.3k
answered Feb 13 ’12 at 6:59
1488
You can also use javascript and after that when the user clicks the button, call the script, dynamically change the url and submit this form.
Here’s an example …..
Work for you runConfiguration (actionName) var config = $ dataValues.get (0); goToPage (action name); // call the servlet EditConfiguration element (actionName) var config = $ dataValues.get (0); goToPage (action name) // call the servlet DeleteConfiguration element (actionName) var config = $ dataValues.get (0); goToPage (action name) // call the servlet Gotopage function (action name) document.formName = action name; document.formName.submit ();
answered Feb 13 12 at 8:33 am
1.226