- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有这个 jsp 代码,我试图在我的网页上为用户编辑信息。我是 jsp 编程的新手,我遇到了错误。这是我的代码:
<%@page import="DatabaseTransactions.UserPhotosDataContext"%>
<%@page import="java.sql.ResultSet"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
if (session.getAttribute("id") == null) {
response.sendRedirect(request.getContextPath() + "/sign-in.jsp");
}
int userId = Integer.parseInt(session.getAttribute("id").toString());
ResultSet userInfo = UserPhotosDataContext.getUserProfileInfo(userId);
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Edit Information</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="styles.css" rel="stylesheet">
</head>
<body class="bodybg">
<jsp:include page="/navigation.jsp"/>
<% userInfo.next();%>
<div class="boxouter" style="margin-top:50px;">
<h3 class="muted">Edit Information</h3>
<!--- more code here---->
<br><br>
<form id="update-form" method="" action="">
<table style="margin:auto">
<tr>
<!--username-->
<td>
<label>Username <span id="uname-error" class="form-error"></span></label>
<input type="text" title="Use at least 6 characters"
name="username" id="uname"
value="<%=userInfo.getString("username")%>"
placeholder="Username" disabled="true">
</td>
<!--email-->
<td>
<label>Email <span id="email-error" class="form-error"></span></label>
<input type="text"
name="email" id="email"
value="<%=userInfo.getString("email")%>"
placeholder="Email" disabled="true">
</td>
</tr>
<!--- more code here---->
</table>
<center/>
<button class="btn btn-info" onclick="enablefields();" id="enablebtn" style="visibility:visible">Edit Information</button>
<a id="savelink" href="#" style="color:white;">
<button class="btn btn-info" id="savebtn" type="submit" style="visibility:hidden">Save</button>
</a>
<a href="#" style="color:white">
<button class="btn btn-info" id="deactivatebtn" style="visibility:visible">Deactivate Account</button>
</a>
</form>
</div>
</div>
<br><br>
<!--- more code here---->
<script type="text/javascript">
function setValues() {
if ("<%=userInfo.getString("gender")%>" == "Male")
$('select option:contains("Male")').prop('selected',true);
else if ("<%=userInfo.getString("gender")%>" == "Female")
$('select option:contains("Female")').prop('selected',true);
}
window.onload = setValues;
</script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap-modal.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap-popover.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap-modalmanager.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/editinfo.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/holder.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/logout.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap-dropdown.js"></script>
</body>
</html>
当我运行它时,我得到这个错误:
org.apache.jasper.JasperException: An exception occurred processing JSP page /editinfo.jsp at line 61
第 61 行是:
value="<%=userInfo.getString("email")%>"
我删除了这一行,它工作得很好(但我需要它来获取值)。当我保留第 61 行并尝试删除它时:
value="<%=userInfo.getString("username")%>"
在我页面的第 52 行,它仍然不起作用。
我还将第 52 行替换为第 61 行并且它有效。
我也遇到了这些错误:
javax.servlet.ServletException: java.sql.SQLException: Column 'email' not found. java.sql.SQLException: Column 'email' not found.
但我 100% 确定我的数据库有一个电子邮件列。此外,当我对数据库的其他列尝试此操作时,它会返回相同的错误。仅当它是“用户名”列时才有效。请帮我。我该如何解决这个问题?
最佳答案
表达式标签表示<%= .......>
在表达式末尾使用分号 (;)。
value='<%= userInfo.getString("email") ; %>'
我希望它能奏效,请试试这个。
关于java - org.apache.jasper.JasperException : An exception occurred processing JSP page/editinfo. jsp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18122530/
我有一个在旧版 iReport 3.0 中构建的 JRXML 报告,现在我想将其更新到较新的 iReport 4.7。 这样做的步骤是什么,请解释一下? 最佳答案 您可以使用位于 jasperserv
我的问题是,即使该行是空白的,它仍然占据了 band 高度的空间,因此在下一个 band 之前有比平时更大的间隙。 我的 jasper 文件中的乐队看起来像这样:
我在使用 Eclipse JasperReports Studio 时遇到了一个我无法解决的问题。我有一个非常基本的报告,其中包含返回大约 30 行的详细信息字段。我有一个要合并到主报告中的子报告,但
我有一个包含许多列但只有几行的交叉表。当我生成报告时,交叉表会重用一页中行下方的空白空间,并为相同的行呈现下一列。这样,几页被垂直压缩在一页上: 我想要第 天的列20 到天 27 (交叉表的第二部分)
我们正在使用 jaspersoft studio 创建报告,但我被困在查询部分。 从逻辑上讲,我想要的查询类型是: select * from mytable where
我想在 ireport 中创建多个组,并且数据应该以分组方式显示。例如: 首先应该完全打印 Group1 数据,然后, 第一组: 模块数据 在此之后我想完全打印 Group2 数据 组2: 类别数据
我有一个 Jasper 报告,它有一个详细信息部分,在详细信息部分内有一个来自数据库的打印字段。因此,如果我的查询返回 100 行,我会得到 100 行,这会生成一个大约 10 页长的报告,因为 10
我正在使用 Jasper 报告。我有一个页眉、详细信息和摘要带。页眉在所有页面上重复,但有时只有摘要部分移到最后一页,因为详细信息在此之前的页面中结束。标题不打印在最后一页,即摘要页。 有人知道为什么
这个问题在这里已经有了答案: How to pass ArrayList to JasperReports? (3 个回答) 上个月关闭。 如何创建将在详细信息部分迭代 arraylist 的报告,该
我有一个包含两个框架的 columnHeader 带。 如果参数为 TRUE,则第一帧必须可见,如果参数为 FALSE,则第二帧必须可见。 所以我只想显示一帧。 我按顺序放置了两帧。可见性还可以,但是
我在 jasper 报告中有一个表格,我需要该表格中某些单元格的内容垂直对齐。 我正在尝试使用 iReport 编辑报告。 在 iReport 中,我可以进入单元格的属性并看到垂直对齐设置为“中间”。
我正在尝试生成包含表格的报告。这些是 jrxml 的重要部分:
我想为文本字段绘制一个虚线底部边框,以多行显示其内容。 例如: Address: 104th Street, - - - - - - - - - - -- - - - - - - -
我在 Maven 中使用 Jasper Reports 5.2.0 和 Spring MVC。 我已经使用 JasperViewer 完成了报告,但突然出现了无法解决的错误: net.sf.jaspe
我想将图像嵌入到我的JasperReports jrxml文件中。我有这个目录结构。 Tomcat Root webapps reports -->images --> compa
我有三个不同的查询,并希望根据 jasper 报告中获取的值运行它们。查询是在 Jrxml 文件本身中编写的。如何根据不同的动态值运行不同的查询。 喜欢(这只是一个 sudo 代码) If($(a)
以下是一些演示问题的屏幕截图:首先,这是没有列表元素的设计: 这是该报告的结果(注意有两页): 现在如果我添加列表元素,设计如下: 这是摘要带的 jrxml:
我们的一份报告经常运行,其中包含大约 14,000 名司机。 参数的架构(在父报表中)如下所示: 选择(在子报表中)的 where 子句如下所示: and $X{IN, cast(e.l
背景:Jaspersoft studio 6. 有这个交叉表: 交叉表的数据集: select 'prod1' as prod, 'mon1' as month, 1 as val u
我想问一下。如何在 中的段落后添加中断一个文本字段 . 例如, 报告是为传达信息的特定目的而制作的文本作品(通常是写作、演讲、电视或电影)。 像这样:- "A report is a textual
我是一名优秀的程序员,十分优秀!