1.使用Fuego在jsp页面中传递参数,一般来说都是和jstl标签相结合:
f:invoke var="${sampleForm}" methodName="method1" retAttName="retValue" retAttScope="Page"/
然后使用
c:set var="var1" value="${retValue}"/
<c:out value="${returnValue}">c:out value="${var1}"/
就可以取到返回值了
当然更常用的组合是返回一个数组,然后用来调用:
f:invoke var="${sampleForm}" methodName="method2" retAttName="retArray" retAttScope="Page"/
c:forEach var="arrayItem" begin="0" step="1" items="${retArray}" varStatus="status"
<c:foreach var="arrayItem" begin="0" step="1" items="returnArray">
.
.
.
/c:forEach
</c:foreach>
2.要注意的是
<c:choose>c:choose
c:when /c:when
<c:when></c:when> c:when /c:when
c:otherwise /c:otherwise</c:choose></c:out>
<c:out value="${returnValue}"><c:choose>/c:choose</c:choose>
just like swith in java, so if you want to descript some if, if relationship, you should use
c:if</c:out>
<c:out value="${returnValue}">/c:if
<c:if></c:if>
<c:if></c:if><f:invoke var="${sampleForm}" method="method1" retvalue="returnValue" scope="page"><c:set var="var1" value="${returnValue}"><c:out value="${returnValue}"><f:invoke var="${sampleForm}" method="method2" retvalue="returnArray" scope="page">
</f:invoke></c:out></c:set></f:invoke></c:out>
<c:if></c:if>
分享到:
相关推荐
The page directive is written on the top of the jsp page. Html tags in jsp In this example we have used the html tag inside the println() method of the out implicit object which is used to write ...
The default behavior of this method is to return addHeader(String name, String value) on the wrapped response object. addHeader(String, String) - Method in interface javax.servlet....
@RequestMapping(value = "/example", method = RequestMethod.GET) @ResponseBody public Map, Object> example() { Map, Object> result = new HashMap(); result.put("msg", "Hello from SpringMVC!"); ...
@RequestMapping(value = "/somePage", method = RequestMethod.GET) public String showPage(Model model) { return "views/somePage"; // 假设JSP页面位于/WEB-INF/views/somePage.jsp } } ``` #### 总结 ...
@RequestMapping(method = RequestMethod.GET) public String displayForm(@ModelAttribute("user") User user, Model model) { // ... 初始化或填充user对象 ... model.addAttribute("message", "Hello from ...
return new ModelAndView("jspPage", model); } @RequestMapping(value = "/freemarker", method = RequestMethod.GET) public ModelAndView freemarkerView() { Map, Object> model = new HashMap(); model....
<form action="dologin.jsp" method="post"> 用户名: 密码: <input type="submit" value="登录" /> ``` 这个简单的HTML表单包含了用户名和密码输入框以及一个提交按钮,当用户点击“登录”...
<FORM action="" method=get name=form> <INPUT type="text" name="cat" value="1"> <INPUT TYPE="submit" value="送出" name=submit> ! public class Circle { double r; Circle(double r) { this.r = r; } ...
<form method="post" action="session2.jsp"> name: <input type="submit" value="submit"> ``` **解析:** - 此页面提供了一个表单,允许用户输入用户名。 - 用户提交表单后,数据会被发送到 `session2....
<form method="POST" action="adminlogin.jsp" name="form1" onsubmit="return check()"> ... ``` - **表单元素**: - **用户名输入框**:`<input type="text" name="Username" size="18">` - **...
<form action="CheckLogin" method="post" name="loginform" onSubmit="return checklogin();"> 用户名: 用户名长度不能超过20位 密码: 密码长度不能超过20位 <input type="submit" value="登录">...
<option value="<%=list.get(i).getId()%>"><%=list.get(i).getTypeName()%> <%}%> </select></td> 歌 曲 名: <td><input name="songName" type="text" id="songName" size="50" title="歌曲名"> ...
<form action="register.jsp" method="post"> 用户名: <input type="text" id="username" name="username" required><br> 密码: <input type="password" id="password" name="password" required><br> ...
public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } } ``` 接着,在JSP页面上,用户会填写注册表单,这些表单字段需要绑定到JavaBean的属性。当用户提交...
@RequestMapping(value="/word", method=RequestMethod.GET) public String openWord(HttpServletRequest request, Map,Object> map) { PageOfficeCtrl poCtrl = new PageOfficeCtrl(request); poCtrl....
<form action="login.jsp" method="post"> 用户名: <input type="text" id="username" name="username"><br> 密码: <input type="password" id="password" name="password"><br> <input type="submit" value=...
**JSP登录验证与Servlet交互详解** 在Web开发中,JSP(JavaServer Pages)常用于构建动态网页,而Servlet则是处理HTTP请求的核心组件。本篇文章将深入探讨如何使用JSP进行用户登录验证,并通过Servlet进行后端逻辑...
<form action="login.jsp" method="post"> 用户名: 密码: <input type="submit" value="登录" /> ``` 当用户提交表单时,数据会发送到"login.jsp",这是我们的处理页面。在JSP中,我们可以使用内置对象`...
<form action="loginCheck.jsp" method="post"> 用户名:<input type="text" name="username" required><br> 密码:<input type="password" name="password" required><br> <input type="submit" value="登录"> ...
### JSP分页查询实例代码解析 #### 一、概述 本文将对“JSP分页查询实例代码”进行详细解析。此实例展示了如何在JavaServer Pages(简称JSP)中实现基本的分页功能,具体包括:设置字符编码、加载数据库驱动、建立...