JSP页面
<%@ page language="java" pageEncoding="gb2312"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
<html:base />
<title>userResult.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<logic:present name="result" scope="request">
<h1>该用户存在</h1>说明:name="result"中result与Action类中的request.setAttribute("result", flag);对应
</logic:present>
<logic:present name="null" scope="request">
<h1>该用户不存在</h1>
</logic:present>
</body>
</html:html>
Action类
package bao.action;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import bao.form.SecletOneForm;
import bao.omygod.a;
publicclass UserSelectAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SecletOneForm secletOneForm = (SecletOneForm) form; a a = new a();
String id = secletOneForm.getId();
String sql = "select * from userinfo where userid = '"+id+"'";
int flag = a.executeUpdate(sql);
System.out.println("flag = " + flag);
if(flag == 0){
request.setAttribute("null", flag);
}else{
request.setAttribute("result", flag);
}
return mapping.findForward("show");
}
}
分享到:
相关推荐
jsp脚本和<logic:iterate>标签:实现循环和分支逻辑 jsp脚本和<logic:iterate>标签:实现循环和分支逻辑 jsp脚本和<logic:iterate>标签:实现循环和分支逻辑
1. Map里存放的是bean时 <br><logic:iterate id="destMap" name="srcMap"> <br> <bean:define id="bean" name="destMap" property="value" /> <br> <bean:write name="bean" property="name" /> <br></...
我就是靠这个文档实现logic:iterate的循环的 struts 标签 logic:iterate使用 logic:iterate <br>第一页 是struts官方的说明, 第二页 是个例子 第三页 是我实现的arrayList放入标签的方法。 这是页面...
Struts Logic标签Struts Logic标签Struts Logic标签Struts Logic标签Struts Logic标签
struts标签库 文章目录 bean:cookie 2 bean:define 3 bean:header 4 bean:include 5 ...logic:present 23 logic:messagesPresent 23 logic:empty 24 logic:match 24 logic:equal 25 logic:forward 26 总结 26
logic:iterate 产生问题的图
精通struts1的logic标签的使用方法,比传统的web jsp技术更能节省代码开销,提高系统的运行效率
Iterate主要用来处理在页面上输出集合类,集合一般来说是下列之一: 1、 java对象的数组 2、 ArrayList、Vector、HashMap等
</logic:present> <logic:notPresent name="loginFormBean"> </logic:notPresent> <html:errors property="username" /> <td><bean:message key="login.page.password" /> <td><logic:present name=...
struts logic:iterater 换行
关于struts学习中遇到的关于logic标签的一些问题和解答,logic标签的一些问题和解答。
Struts标签 logic标签所有应用源代码 看懂了这个,你就会明白bean标签所有的使用方法 我还上传了html标签、bean标签,这三种标签在Struts中用得最多的,希望能给你一些帮助
struts-logic iterate标签学习指南 这标签还不错
<logic:equal value="true" name="page" property="hasPrePage"> ${msg }">首页 href="getConsultationAUser.do?index=prew&pageno=${page.currentPage -1}&msg=${msg }...
逻辑的引擎 Engines of Logic 马丁・戴维斯(Martin Davis)
<logic:iterate id="tr" name="grid" indexId="index2"> <html:link action="/jsp/office/exchange/preModifyExchangeDoc" paramId="exchangeDocOID" paramName="tr" paramProperty="key"> ...
django-business-logic:django的Visual DSL框架
该模块将安装sumologic_stdout和sumologic_json报告处理程序。 它还包含人偶代码,以管理他们所需的所有设置。 sumologic_json将使用danzilio / report_all_the_things将报告转换为大型JSON文件并将其发送到指定的...
Struts标签库html标签、logic标签、bean标签
Struts标签 -LOGIC标签