我有一个基于Spring Web模型 - 视图 - 控制器(MVC)框架的项目.Spring Web模型 - 视图 - 控制器(MVC)框架的版本是3.2.8.
这个班
public class DeviceForm {
Device device;
List<String> selectedItems = Collections.emptyList();
public DeviceForm() {
super();
}
public Device getDevice() {
return device;
}
public void setDevice(Device device) {
this.device = device;
}
public List<String> getSelectedItems() {
return selectedItems;
}
public void setSelectedItems(List<String> selectedItems) {
this.selectedItems = selectedItems;
}
}
Run Code Online (Sandbox Code Playgroud)
还有这个
public class Device implements java.io.Serializable {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "CRITERIA")
private BaseCriteria criteria;
public BaseCriteria getCriteria() { …Run Code Online (Sandbox Code Playgroud) 我有一个基于Spring Web模型 - 视图 - 控制器(MVC)框架的项目.在WebLogic Server版本上部署的Spring Web模型 - 视图 - 控制器(MVC)框架版本为3.2.8:12.1.2.0.0
我在1 JSP中有这个表单
<form:form commandName="deviceForm"
name="deviceForm"
id="deviceFormId"
method="post"
action="${contextPath}/device/${deviceForm.device.id}"
htmlEscape="yes"
enctype="multipart/form-data">
Run Code Online (Sandbox Code Playgroud)
我使用POST方法做了几个动作..之后我使用浏览器(IE11)后退按钮,我收到了这个错误
Webpage has expired
Most likely cause:
•The local copy of this webpage is out of date, and the website requires that you download it again.
Something to try:
Click on the Refresh button on the toolbar to reload the page. After refreshing, you might need to navigate to the specific webpage again, or re-enter information.
More information …Run Code Online (Sandbox Code Playgroud) 迁移我的JAVA EE应用程序后.(从Spring到Maven的Spring Web模型 - 视图 - 控制器(MVC)框架)我在迁移之前执行Junit测试时遇到了一些错误
org.powermock.api.mockito.ClassNotPreparedException:
The class org.springframework.web.util.WebUtils not prepared for test.
To prepare this class, add class to the '@PrepareForTest' annotation.
In case if you don't use this annotation, add the annotation on class or method level.
at org.powermock.api.mockito.expectation.reporter.MockitoPowerMockReporter.classNotPrepared(MockitoPowerMockReporter.java:31)
at org.powermock.api.mockito.internal.mockcreation.MockTypeValidatorFactory$DefaultMockTypeValidator.validate(MockTypeValidatorFactory.java:38)
at org.powermock.api.mockito.internal.mockcreation.AbstractMockCreator.validateType(AbstractMockCreator.java:18)
at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMock(MockCreator.java:57)
at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:47)
at org.powermock.api.mockito.PowerMockito.mockStatic(PowerMockito.java:71)
at com.tdk.iot.controller.criteria.ProductCriteriaPeriodControllerTest.setUpTest(ProductCriteriaPeriodControllerTest.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) …Run Code Online (Sandbox Code Playgroud) 我有一个基于Spring Web模型 - 视图 - 控制器(MVC)框架的项目.Spring Web模型 - 视图 - 控制器(MVC)框架的版本是3.2.8.
我用这个方法实现了一个过滤器:
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
HttpServletRequest httpServletRequest;
ThreadContext threadContext;
//String path = ((HttpServletRequest) request).getRequestURI();
if (request instanceof HttpServletRequest) {
httpServletRequest = (HttpServletRequest) request;
threadContext = ThreadContext.getInstance();
try {
DetailedUser ecasUser = (DetailedUser) httpServletRequest.getUserPrincipal();
if (ecasUser != null) {
threadContext.setDomainUsername(ecasUser.getDomainUsername());
}
} catch (Exception e) {
e.printStackTrace();
}
if (httpServletRequest.getRemoteUser()!=null) {
threadContext.setUserID(httpServletRequest.getRemoteUser());
}
}
try {
if (filterChain != null) {
filterChain.doFilter(request, …Run Code Online (Sandbox Code Playgroud) 我有一个基于Spring Web模型 - 视图 - 控制器(MVC)框架的项目.在WebLogic Server版本上部署的Spring Web模型 - 视图 - 控制器(MVC)框架版本为3.2.8:12.1.2.0.0
我有这个错误加载1 JSP
未捕获的TypeError:$(...).tooltip不是函数
这是我加载的所有内容,我逐一检查并加载了所有这些内容
<link href="/tdk/styles/bootstrap.css" type="text/css" rel="stylesheet">
<link href="/tdk/styles/admin.css" type="text/css" rel="stylesheet">
<link href="/tdk/styles/jquery.dataTables.css" type="text/css" rel="stylesheet">
<link href="/tdk/styles/dataTables.bootstrap.css" type="text/css" rel="stylesheet">
<link href="/tdk/styles/slides.css" type="text/css" rel="stylesheet">
<script src="/tdk/scripts/jquery.min.js" type="text/javascript"></script>
<script src="/tdk/scripts/bootstrap.js" type="text/javascript"></script>
<script src="/tdk/scripts/jquery.dataTables.js" type="text/javascript"></script>
<script src="/tdk/scripts/dataTables.bootstrap.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" type="text/javascript"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
var selected = [];
var table = $('#example').DataTable({
"dom": '<"top">rt<"bottom"lp><"clear">',
"autoWidth": false,
"paging": false,
"scrollX": false,
"scrollY": 300,
"scrollCollapse": true,
"rowCallback": function(row, …Run Code Online (Sandbox Code Playgroud) 我有一个基于 Spring Web 模型-视图-控制器 (MVC) 框架的项目。Spring Web 模型-视图-控制器 (MVC) 框架的版本是 3.2.8。我想更改提交按钮上的表单操作。所以这是我的代码,但根本没有改变任何东西!
<script type="text/javascript">
$('#awardProductsButton').click(function(){
$('#devicesFormId').attr('action', 'test');
});
</script>
<form:form commandName="devicesForm" name="devicesForm" id="devicesFormId" method="post"
action="${contextPath}/newdesign/manage/devices/${devicesForm.devices.id" htmlEscape="yes" enctype="multipart/form-data">
<button id="awardProductsButton" class="btn btn-primary" type="submit">AWARD product/s</button>
</form:form>
Run Code Online (Sandbox Code Playgroud)
我也尝试过
$('#awardProductsButtonId').submit(function(event){
alert ('test');
event.preventDefault();
$('#deviceFormId').attr('action', '${contextPath}/newdesign/manage/device/${deviceForm.device.id}');
});
Run Code Online (Sandbox Code Playgroud)
但即使警报也没有出现
我有一个基于 Spring Web 模型-视图-控制器 (MVC) 框架的项目。Spring Web模型-视图-控制器(MVC)框架的版本是3.2.8,部署在WebLogic Server上版本:12.1.2.0.0
我在 1 个查询中遇到此错误
Caused By: java.lang.RuntimeException: java.sql.SQLException:
The transaction is no longer active - status: 'Marked rollback. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 31 seconds
BEA1-000D9470C1367F28EDB9]'.
No further JDBC access is allowed within this transaction., criteria [ com.tdk.books.domain.ProductSearchCriteria@c5f15d5c ], sql [ select PRODUCT_ID from V_BOOKS where category_id = ? ]
Run Code Online (Sandbox Code Playgroud)
即使我在服务方法中设置了 10000 的超时
@Transactional(timeout=10000, propagation = Propagation.REQUIRES_NEW)
Run Code Online (Sandbox Code Playgroud) 我正在检查如何使用 Spring Boot 发送电子邮件。使用标准 Spring Boot 模块发送电子邮件,并使用 Thymeleaf 模板引擎为消息准备 HTML 内容。这是我使用的依赖项
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.icegreen</groupId>
<artifactId>greenmail</artifactId>
<version>1.5.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Run Code Online (Sandbox Code Playgroud)
这是我的邮件客户端
@Service
public class MailClient {
private JavaMailSender mailSender;
private MailContentBuilder mailContentBuilder;
@Autowired
public MailClient(JavaMailSender mailSender, MailContentBuilder mailContentBuilder) {
this.mailSender = mailSender;
this.mailContentBuilder = mailContentBuilder; …Run Code Online (Sandbox Code Playgroud) 我创建了一个Guava(一个包含有用东西的库,在几乎任何Java项目中都非常方便,包括用于不可变集合的库,函数编程,I/O等等)基于CacheBuilder的缓存
LoadingCache<String, Byte[]> companyDevicesCache =
CacheBuilder.newBuilder()
.maximumSize(1000) // maximum 100 records can be cached
.expireAfterAccess(24, TimeUnit.HOURS) // cache will expire after 30 minutes of access
.build(new CacheLoader<String, Byte[]>(){ // build the cacheloader
@Override
public Byte[] load(String companyId) throws Exception {
//make the expensive call
return getFromServletContext (companyId);
}
});
Run Code Online (Sandbox Code Playgroud)
我也试过了
CacheBuilder.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES)
.maximumSize(1000)
.build(new CacheLoader<String, List<String>>() {
@Override
public List<String> load(String queryKey) throws Exception {
return null;
}
});
Run Code Online (Sandbox Code Playgroud)
并且
CacheLoader loader = new CacheLoader()
{
public String load(String key) …Run Code Online (Sandbox Code Playgroud) 我在Spring Web模型 - 视图 - 控制器(MVC)框架中有这个类.Spring Web模型 - 视图 - 控制器(MVC)框架的版本是3.2.8.
我在1 DAO中有这个方法
final StringBuilder queryString = new StringBuilder(" select app from Application app where upper (ticket_id) like :searchString and upper (id) like :searchString " );
queryString.append("where app.status != " + Status.READY.ordinal());
queryString.append(" order by app.submissionTime desc ");
try {
final Query query = getEntityManager().createQuery(queryString.toString());
searchString = searchString.replace("!", "!!")
.replace("%", "!%")
.replace("_", "!_")
.replace("[", "![")
.trim()
.toUpperCase();
query.setParameter ("searchString", searchString);
return query.getResultList();
Run Code Online (Sandbox Code Playgroud)
但我在运行时有这个错误:
org. where near line 1, column 144 …Run Code Online (Sandbox Code Playgroud) java ×8
spring-mvc ×7
spring ×6
hibernate ×3
javascript ×2
jquery ×2
jsp ×2
sql ×2
caching ×1
email ×1
guava ×1
html ×1
http ×1
java-ee ×1
junit ×1
mockito ×1
oracle11g ×1
powermockito ×1
smtp ×1
spring-boot ×1