hi,
I want to use a Java Bean.the situation is:
I use a select option to get a option value,
...
<Select ..>
<option>...</option>
....
</select>
...
then trigger to get the property of this Java Bean according to this option value. How can I do?
Because , if I use <Script>, it is easy to trigger some event, but can not access the Java Bean.
Thanks for your help!
zhousr
Discussions
Web tier: servlets, JSP, Web frameworks: Urgently! How to write code in JSP Select Option..
-
Urgently! How to write code in JSP Select Option.. (3 messages)
- Posted by: John hs
- Posted on: April 03 2001 00:41 EDT
Threaded Messages (3)
- Urgently! How to write code in JSP Select Option.. by joseph yi on April 03 2001 19:21 EDT
- Urgently! How to write code in JSP Select Option.. by joseph yi on April 03 2001 19:22 EDT
- Urgently! How to write code in JSP Select Option.. by John hs on June 13 2001 05:01 EDT
- Urgently! How to write code in JSP Select Option.. by joseph yi on April 03 2001 19:22 EDT
-
Urgently! How to write code in JSP Select Option..[ Go to top ]
- Posted by: joseph yi
- Posted on: April 03 2001 19:21 EDT
- in response to John hs
you do this this many ways (i think)
here's what i'd do. the control for this application will be
input.html -> process.jsp <--> JavaBean
input.html
----------
<form action="process.jsp" method="post">
<select name="mode">
<option value="1">mode 1
<option value="2">mode 2
</select>
<input type="submit" value="Submit">
</form>
process.jsp
-----------
<jsp:useBean id="bean" class="foo.ModeBean" scope="request" >
<jsp:setProperty name="bean" property="*" />
</jsp:useBean>
<%
String mode = bean.getMode();
if("1".equals(mode)) {
// do stuff for this mode;
}
if("2".equals(mode)) {
// do stuff for this mode; ect.
}
%>
JavaBean
--------
public class Mode {
private String mode;
public Mode() {
mode = "";
}
public void setMode(String mode) {
this.mode = mode;
}
public String getMode() {
return mode;
}
}
Hope this makes sense =P
It's a MVC wannabe design model =) -
Urgently! How to write code in JSP Select Option..[ Go to top ]
- Posted by: joseph yi
- Posted on: April 03 2001 19:22 EDT
- in response to joseph yi
whoops! this should be the mode bean... =p
public class ModeBean {
private String mode;
public ModeBean() {
mode = "";
}
public void setMode(String mode) {
this.mode = mode;
}
public String getMode() {
return mode;
}
} -
Urgently! How to write code in JSP Select Option..[ Go to top ]
- Posted by: John hs
- Posted on: June 13 2001 05:01 EDT
- in response to joseph yi
thanks