java - JSP:如何查找变量值是参数还是纯字符串
问题描述
我的 start.jsp 页面中有一个文本框,用户可以在其中提供任何静态值或要求从 db 中获取动态值,如图所示
@userEmail 是一个变量,其值将分配给“电子邮件”,我能够解析文本输入的静态部分,如下所示
if ( testinput.length() != 0 ) {
testinput.trim();
if ( testinput.endsWith( "&" ) || testinput.endsWith( "?" ) ) {
testinput = testinput.substring( 0, testinput.length() - 1 );
}
if ( testinput.startsWith( "&" ) || testinput.startsWith( "?" ) ) {
testinput = testinput.substring(1);
}
if ( testinput.startsWith( " " ) ) {
testinput = "";
}}
我不知道如何解决测试输入是字符串还是参数,并将其分配给变量值。
请帮我谈谈你的想法。
解决方案
推荐阅读
- javascript - MailChimp:为什么带有 javascript 的 PUT 方法返回“使用 PUT 插入或更新列表成员”
- sql-server - OFFSET 和 FETCH 对查询造成巨大的性能影响 - 包括当 OFFSET = 0 时
- rest - 使用 AWS API 网关更好地管理 API 密钥
- c - Windows GDI 中的 Alpha 颜色组件
- python - Python3 - 生成匹配多个正则表达式的字符串,而不修改它们
- java - JavaFX 对话框:仅在按下确定按钮时运行 onClosingRequest
- batch-file - 从 inno setup 以管理员身份运行批处理文件,隐藏
- sql-server - 如何在 SQL Server 中识别夏令时实施点
- python - 其他模型中的 Keras 模型
- c# - 类设计 - 带有公共设置器的 ctor 或属性