| | |
general questions about jsp
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 144
Reputation:
Solved Threads: 0
i just starter to learn jsp and i have few questions.
1) in my jsp project i have jsp page and java classes that defined as jsp beans.
my jsp page contains submit button. is there a way to define that each time i press the
button the program will run a function from one of the java classes that defined as beans ?
2) is there a command that can make the jsp page to be runned again?
at the end of my jsp page i want to write:
so when i run the page at the end if the if's condition is true the page will be runned again.
3) in my jsp page i have a select form:
how can i get the string of the current selected option ?
1) in my jsp project i have jsp page and java classes that defined as jsp beans.
my jsp page contains submit button. is there a way to define that each time i press the
button the program will run a function from one of the java classes that defined as beans ?
2) is there a command that can make the jsp page to be runned again?
at the end of my jsp page i want to write:
jsp Syntax (Toggle Plain Text)
<% if (...) { %> run the page again <% } %>
so when i run the page at the end if the if's condition is true the page will be runned again.
3) in my jsp page i have a select form:
jsp Syntax (Toggle Plain Text)
<form><SELECT SIZE=1 align="center" name="mode"> <OPTION SELECTED VALUE = "UU"> user vs user </OPTION> <OPTION VALUE = "UC"> user vs computer </OPTION> <OPTION VALUE = "CU"> computer vs user </OPTION> </SELECT></form>
how can i get the string of the current selected option ?
•
•
Join Date: Nov 2007
Posts: 144
Reputation:
Solved Threads: 0
i tryed to get selected option like this:
it gives me null. what am i doing wrong ?
jsp Syntax (Toggle Plain Text)
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <select size="1" name="mode"> <option value="o1">1</option> <option value="o2">2</option> <option value="o3">3</option> </select> <% String s = request.getParameter("mode"); %> <p><%=s%> </body> </html>
it gives me null. what am i doing wrong ?
1) None of the drop-down option was declared as default to display
2) You want to run this or something similar in functionality not technology
when a change was detected on drop-down not immediately after you display it on screen. For such thing JavaScript would be more suitable
<option value="o2" selected="selected">2</option> 2) You want to run this or something similar in functionality not technology
JSP Syntax (Toggle Plain Text)
<% String s = request.getParameter("mode"); %> <p><%=s%>
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Nov 2007
Posts: 144
Reputation:
Solved Threads: 0
i tried it like this:
i think it's the right syntax when the first option is pre selected. it still doesnot work when i run the page.
i'm not allowed to use javascript only jsp
jsp Syntax (Toggle Plain Text)
<select size="1" name="mode"> <option value="o1" selected>1</option> <option value="o2">2</option> <option value="o3">3</option> </select> <p><%=(request.getParameter("mode"))%>
i think it's the right syntax when the first option is pre selected. it still doesnot work when i run the page.
i'm not allowed to use javascript only jsp
Have look at chap1 from Beginning JSP, JSF and Tomcat Web Development: From Novice to Professional pg11 onwards can be to some interest to you. Source code is available for download too
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- Starting "Java" [Java tutorials / resources / faq] (Java)
- Firefox Compatibility help with script (JavaScript / DHTML / AJAX)
- Is Stormpay a credible payment system? (eCommerce)
- Combo Box In Jsp+ Ajax Urgent Please Help Me (JSP)
- Where can i get Java? (Java)
- JavaScript/DHTML newbie -- general questions (JavaScript / DHTML / AJAX)
- Help a newbie find JSP tutorials (was: I'm a newbe, help!) (JSP)
Other Threads in the JSP Forum
- Previous Thread: updating daily news in a webpage
- Next Thread: error while forwarding page
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial update video web






