输入两个字符串,点击提交显示他们相连(像是进制转换的网页都可以做了)
原理:在jsp,在body中《%%》写java语句
test.jsp
<body
>
<form action
="test1.jsp" method
="post">
请输入字符串
1:
<input type
="text" name
="a" >
请输入字符串
2:
<input type
="text" name
="b" >
<input type
="submit" value
="转换">
</form
>
</body
>
test1.jsp
<body
>
<% String a
=request
.getParameter("a");
String b
=request
.getParameter("b");
String c
=a
.concat(b
);%>
<%=c
%>
</body
>
如果用getparameter处理一个int类型数字
b= Integer.parseInt(a);
<%String a
=request
.getParameter("num");
int b
=0;
b
= Integer
.parseInt(a
);
b
+=1;%>
转载请注明原文地址:https://tech.qufami.com/read-26711.html