webMathematica: Avoid reset the input in a menu with different options?

Posted 1 month ago
349 Views
|
2 Replies
|
0 Total Likes
|
 In the below jsp file the user chooses between 3 options: A, B, C. When the menu is evaluated the output is fine, but the menu reset to the initial state. For instance: If I choose B, and evaluate the ouput is B (it is OK), but the input menu resest to A, how could I get that it stays in my last election (B)? <%@ page language="java" %> <%@ taglib uri="/webMathematica-taglib" prefix="msp" %>
Select a option:

MSPBlock[$$element,$$element ] 
2 Replies
Sort By:
Posted 1 month ago
 So a slightly reorganized version of your code with some less loose interpretations of valid HTML(https://www.w3schools.com/js/js_reserved.asp). So a jsp page called "Test2.jsp" <%@ page language="java" %> <%@ taglib uri="/webMathematica-taglib" prefix="msp" %>
Select a option:

MSPBlock[$$drops,$$drops] The "Test2.jsp" page rendered by Tomcat/webMathematica. webMathematica provides internal built function HTMLSelect which may help you. So a jsp page called "Test3.jsp" <%@ page language="java" %> <%@ taglib uri="/webMathematica-taglib" prefix="msp" %>
Select a option: HTMLSelect[{"A","B","C"},{"OptionA","OptionB","OptionC"}, "drops", SelectedValues -> {$$drops}] MSPBlock[$$drops, drops] The "Test3.jsp" page rendered by Tomcat/webMathematica. The above is a rudimentary example, no handling of null (nil) case. If your case is more complicated, you may want to make your own function that streams out and HTML Select.