小编Mah*_*leh的帖子

从url中删除面部servlet url模式和页面扩展名

我的页面中有一个命令链接,如下所示:

<h:commandLink value="Add user" action="add?faces-redirect=true" />
Run Code Online (Sandbox Code Playgroud)

当我点击它,它会转到网址:

http://localhost:8080/myapp/faces/add.xhtml
Run Code Online (Sandbox Code Playgroud)

但我希望网址是:

http://localhost:8080/myapp/add
Run Code Online (Sandbox Code Playgroud)

怎么做 ?

我正在使用spring 3,jsf 2

这是我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    id="WebApp_ID" version="2.5">

  <display-name>myapp</display-name>

  <!-- Add Support for Spring -->
  <listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
  </listener>
  <listener>
    <listener-class>
        org.springframework.web.context.request.RequestContextListener
    </listener-class>
  </listener>

  <!-- Change to "Production" when you are ready to deploy -->
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
  </context-param>

  <!-- Welcome page -->
  <welcome-file-list>
    <welcome-file>faces/users.xhtml</welcome-file>
  </welcome-file-list>

  <!-- JSF mapping -->
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <!-- Map …
Run Code Online (Sandbox Code Playgroud)

jsf friendly-url jsf-2

4
推荐指数
1
解决办法
9119
查看次数

找不到Factory:javax.faces.application.ApplicationFactory

嗨,我想一起使用以下技术:

  • JSF 2.1.0
  • 根据他们的文档,ICEFaces 2.0.2适用于JSF 2.1.x.
  • 雄猫6

我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      version="2.5"> 

  <display-name>appName</display-name>

  <listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
  </listener>

  <listener>
    <listener-class>
        org.springframework.web.context.request.RequestContextListener
    </listener-class>
  </listener>

  <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
        classpath:META-INF/spring/applicationContext.xml
        </param-value>

  </context-param>


  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
  </context-param>

  <welcome-file-list>
    <welcome-file>/</welcome-file>
  </welcome-file-list>



  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>

  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>

  <context-param>
    <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
  </context-param>


  <servlet>
    <servlet-name>Resource Servlet</servlet-name>
    <servlet-class>com.icesoft.faces.webapp.CompatResourceServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>Resource Servlet</servlet-name>
    <url-pattern>/xmlhttp/*</url-pattern>
  </servlet-mapping>

  <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>

</web-app> …
Run Code Online (Sandbox Code Playgroud)

icefaces java-ee jsf-2

4
推荐指数
1
解决办法
3万
查看次数

4
推荐指数
1
解决办法
5871
查看次数

java.lang.OutOfMemoryError:使用tomcat7 windows服务的PermGen空间

我在Windows Server 2008 R2上运行tomcat 7.0.33 (我安装了tomcat作为windows服务)

  • JDK版本: jdk1.6.0_25 64-bit
  • Tomcat选项:

    1. Java虚拟机:( C:\Program Files\Java\jre6\bin\server\jvm.dll 顺便说一句,我在jre里面没有客户端文件夹)
    2. 初始内存池: 1000 MB
    3. 最大内存池: 2000 MB

      当我检查服务器状态时,我可以看到服务器正在使用我配置的内存.

    4. 环境变量(SYSTEM VARIABLES)配置:

      • JAVA_HOME: C:\Program Files\Java\jdk1.6.0_25
      • 路径: ...;%JAVA_HOME%\bin;....

我是否还需要添加CATALINA_HOMEJAVA_OPTS系统变量?

问题:我有两个Web应用程序APP1,*APP2*,当我分别部署每个,我可以找到内存使用的

APP1 = 198 MB APP2 = 104 MB

有关申请的信息:

APP1,APP2:Spring Maven应用程序,在库中包含其他小型maven spring应用程序.

APP1:包含web2服务,APP2使用它们.

如果我试图在同一个tomcat实例上部署它们,我总是得到

java.lang.OutOfMemoryError: PermGen space
Run Code Online (Sandbox Code Playgroud)

请告知可能导致此问题的原因.

spring tomcat java-ee tomcat7

4
推荐指数
3
解决办法
3万
查看次数

如何在String中获取(n)字符索引?

假设你有像这样的字符串:

String longStr="someText1@someText2@someText3@someText@someText4@someText5@someText6@someText7@someText8@someText9@someText10@someText11@someText12@someText13@someText14";
Run Code Online (Sandbox Code Playgroud)

如何获得的指数10日将发生@在上面的字符串的字符?

我需要索引从该索引分割到结束.

java

4
推荐指数
3
解决办法
3637
查看次数

如何设置jsf/primefaces ajax请求超时?

我正在使用JSF2/Primefaces,我想知道如何使用 jsf 或 primefaces 实现超时回调?

我想将 ajax 请求的超时设置为 30 秒,如果请求超时,则执行回调操作。

jsf primefaces jsf-2.2

4
推荐指数
1
解决办法
3750
查看次数

如何检测请求的URL包含查询字符串?

大家好我想检测一个请求的网址是否包含查询字符串,怎么办?

java jsp

3
推荐指数
1
解决办法
2898
查看次数

建议使用 javaScript 验证电子邮件的好模式?

问候所有我想用 javaScript 验证电子邮件,我需要使用最佳模式进行匹配 请建议我一个好的模式

javascript regex javascript-framework

3
推荐指数
1
解决办法
1348
查看次数

如何仅从文本中删除<a>标签?

问候所有,我有一个文本,可能包含以下<a></a>标签:

hello this is a link <a href="www.google.com"> www.google.com </a> please visit it.
Run Code Online (Sandbox Code Playgroud)

我想删除这些标记并将它们保持在它们之间:

hello this is a link  www.google.com  please visit it.
Run Code Online (Sandbox Code Playgroud)

, 怎么做 ?

java regex

3
推荐指数
2
解决办法
5405
查看次数

需要Spring 3 JSF 2集成示例

我想整合Spring 3,Web Flow 2,JSF 2,我需要你向我推荐一个好的教程或示例,在此先感谢.

更新:

我使用了以下示例,它没有任何问题与我一起工作正常:

http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/

但它不使用弹簧网络流程,我不知道这种方法是否有任何问题.

spring java-ee spring-webflow jsf-2

3
推荐指数
1
解决办法
6142
查看次数