我的web.xml文件有问题.错误:
元素类型"web-app"的内容必须匹配"(icon?,display-name ?, description ?, distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config ?, security -role*,ENV进入*,EJB-REF*,EJB本地-REF*)".
但是,我的web.xml文件按错误说的顺序排列.
这是我的web.xml:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
<description></description>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
Run Code Online (Sandbox Code Playgroud)
我使用WebLogic 10.3.4.对这个问题有什么看法吗?
我需要一个多对多的hibernate映射需要3个连接.我试图找出一个没有中间实体的解决方案LecturerCourse.
我的讲师和课程表之间的数据库中有很多关系.一个课程可以由几位讲师提供,而讲师可以提供几门课程.
我手头存有课程.但是,我需要为讲师分配课程.当我分配课程时,我也会存储该课程的容量.
我的数据库图:

我用hibernate和spring.当课程分配给任何讲师时,我需要一个hibernate映射.我需要在容量字段中添加值.
我的讲师映射:
@Entity
@Table(name="LECTURER")
public class Lecturer {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="LECTURER_ID_SEQ")
@SequenceGenerator(name="LECTURER_ID_SEQ", sequenceName="LECTURER_ID_SEQ")
private Long Id;
@Column(name="NAME")
private String name;
@Column(name="SURNAME")
private String surname;
@Column(name="EMAIL")
private String email;
@Column(name="USERNAME")
private String username;
@Column(name="PASSWORD")
private String Password;
@ManyToMany
@JoinTable(
name="LECTURER_COURSE",
joinColumns=@JoinColumn(name="LECTURER_ID"),
inverseJoinColumns=@JoinColumn(name="COURSE_ID")
)
private List<Course> courses;
//getters - setters
}
Run Code Online (Sandbox Code Playgroud)
我的课程映射:
@Entity
@Table(name="COURSE")
public class Course {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="COURSE_ID_SEQ")
@SequenceGenerator(name="COURSE_ID_SEQ", sequenceName="COURSE_ID_SEQ")
private Long id;
@Column(name="NAME")
private String name;
@Column(name="CODE")
private String code;
}
Run Code Online (Sandbox Code Playgroud)
知道怎么解决我的问题吗?
我正在读一本书"Beginning Java 8 Fundamentals".我看到了这一行:
//some code...
sum = sum + i; // Better to use sum += i
//more code...
Run Code Online (Sandbox Code Playgroud)
那么这是我的疑问:这是真的吗?为什么更好地使用+=运营商?我认为+=运算符只是一个更简化的表达式?如果我使用代码性能中的一个或其他含义?
我绝对是Struts2的初学者.我想跟随struts网站上的教程.我按照本教程.我有点麻烦.我在eclipse上创建了动态web项目.然后我按照教程.但是,当我运行该示例时,我收到以下错误.
There is no Action mapped for namespace [/] and action name [hello] associated with context path [/Hello_World_Struts_2]. - [unknown location]
Run Code Online (Sandbox Code Playgroud)
我有以下目录结构

我的struts.xml文件是
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="basicstruts2" extends="struts-default" namespace="/">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="org.apache.struts.helloworld.action.HelloWorldAction" method="execute">
<result name="SUCCESS">/HelloWorld.jsp</result>
</action>
</package>
</struts>
Run Code Online (Sandbox Code Playgroud)
谢谢你的回复.
我需要将Spring bean注入JSF(Primefaces)转换器.我尝试使用EL解析器注入豆子.但是,豆子null在转换器内部.
我的JSF转换器:
public class DepartmentConverter implements Converter {
private DepartmentService departmentService;
//getter setter for this property
@Override
public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
//codes
}
@Override
public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
//Codes
}
}
Run Code Online (Sandbox Code Playgroud)
faces-config.xml:
<converter>
<converter-id>DepartmentConverter</converter-id>
<converter-class>com.studinfo.jsf.converter.DepartmentConverter</converter-class>
<property>
<property-name>departmentService</property-name>
<property-class>com.studinfo.services.DepartmentService</property-class>
<default-value>#{DepartmentService}</default-value>
</property>
</converter>
Run Code Online (Sandbox Code Playgroud)
EL解析器:
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
Run Code Online (Sandbox Code Playgroud)
当我调试我的代码时,departmentService属性是null.我可以以相同的方式访问托管JSF bean中的Spring bean.
我是Web服务的新手.我需要调用一个Web服务,其定义在http://api.search.live.net/search.wsdl中.我需要使用此Web服务搜索任何关键字.我在网上搜索但找不到任何解决方案.知道如何调用Web服务.我需要使用Java.
我有两个网站说
1. firstwebsite.com
2. secondwebsite.com
Run Code Online (Sandbox Code Playgroud)
firstwebsite 中的所有页面都是静态的。现在我想将 firstwebsite.com 中的所有页面移动到 secondwebsite.com。我想关闭 firstwebsite.com 的所有服务器
我还想确保什么时候 URL firstwebsite.com/** 应该重定向到 secondwebsite.com/**
firstwebsite.com/abc.html 应该重定向到 secodnwebsite.com/abc.html
我正在使用弹簧。有人可以指导我如何做到这一点。后来我还想根据发送请求的设备做一些处理。
如果我能得到上面的一些参考,那就太好了。
java ×3
spring ×3
bytecode ×1
eclipse ×1
hibernate ×1
jsf ×1
operators ×1
performance ×1
primefaces ×1
servlets ×1
spring-mvc ×1
struts2 ×1
syntax ×1
web-services ×1
web.xml ×1
wsdl ×1