• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL c:out tag is displaying value in JSP  RSS feed

 
Raj GuruRaj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ALL,

We are migrating from JSF 1.5 to 2.1 version and facing problem with JSTL tags in some flows only.
We are using JSTL 1.2 version.

Still we are using JSP file not xhtml file.

Working Flow :

Calling action method and action method return a String , then based on the string value(defined navigation rule) will redirected to test.JSP.
In that test.JSP we are using c:forEach and c:out which are working fine without any problem.

<h:commandButton value="Submit" id="searchNonCustomer" action="#{UserSearchBean.searchUsers}">

Not working flow:

Opening popup window through href link.

<td style="width:180px;text-align:center" class="boldContentText">
<div align="left">
<a href="javascript:MM_openBrWindow('../user/test1.faces','updateWin','resizable=yes,width=800,height=680,top=10,scrollbars=yes')">View Users List</a>
</div>
</td>

Once the popup is opened and test1.jsp will load the action method through custom tag. Given below the related code

<body onload="useStyleAgain('cpStyle');">
<f:view>

<!-- Calling the action method through custom tag -->
<bl:bload method="getUserDetails"/>

<table style="width:775px" border="0" cellpadding="2" cellspacing="0">
<b><c:out value="${userDetailsBean.userName}" /></b>

But if we change from c:out to h:outputText (JSF tag) which is working fine. But i need to fix this through JSTL since there are lot of JSTL changes are involved.

userDetailsBean is defined as request scope in face-config.xml.

The same was working fine in JSF 1.5 and JSTL 1.1 versions ... I mean before this migration.

Any help appreciated.






 
Tim Holloway
Bartender
Posts: 18664
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not going to get very far.

JSF2 does not support JSP view templates. At all. Only xhtml.

In any event, JSTL and JSF do not get along well. Actually, they got along even worse in JSF1, but regardless, despite certain Oracle documents, I cannot recommend using JSTL with JSF. JSF has native equivalents that work much better.

For example, instead of:


Use:
 
Raj GuruRaj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP file was working fine with JSF 2.1 version Since we are using the below name spaces in JSP,

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>


I can use h:outputText instead of c:out but ui:repeat(equilant of c:forEach) will not work in JSP view. It will work only xhtml.
 
Tim Holloway
Bartender
Posts: 18664
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lack of support for JSPs in JSF2 is very explicity stated by Oracle. I'm not simply saying that.

The ui:repeat tag is a facelets tag and never was intended to work with JSP, only xhtml. That was been true even in JSF1 where Facelets was an add-on, rather than part of the JSF core as it is in JSF2.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!