You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Caroline Jen <ji...@yahoo.com> on 2004/06/21 07:38:52 UTC

Please Help Me To Convert My JSP Scripting Elements To Tags

I am converting all the scripting elements in my JSP
to <c:.... > tags.  I have decided to go one step at
the time -- I only want to print out one basic number
as a start.

     My action class passes an object "TotalPosts" in
the following way to my JSP:

request.setAttribute( "TotalPosts", new Integer(
totalPosts ) );
return ( mapping.findForward( "success" ) );

and the following scripting elements in my JSP display
the value of TotalPosts well:

int totalPosts      = ( ( Integer
)request.getAttribute( "TotalPosts" ) ).intValue();

<%=totalPosts%>  // I am able to print out the correct

                    value without any problem.

Now, I have the struts-html-el.tld downloaded and put
the following in my application's web.xml file:

  <taglib>
    <taglib-uri>/tags/struts-html-el</taglib-uri>
   
<taglib-location>/WEB-INF/lib/struts-html-el.tld</taglib-location>
  </taglib>

And in my JSP, I imported the following:

<%@ taglib uri="/tags/struts-html-el" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/tiles" prefix="tiles" %>

I replaced:

int totalPosts = ( ( Integer )request.getAttribute(
"TotalPosts" ) ).intValue();
with 
<c:set var="totalPosts"
value="${requestScope.TotalPosts}" />

And I replaced:

<%=totalPosts%>
with
<c:out value="${requestScope.totalPosts}" /> 

I cannot print out anything.  I got a 'BLANK'.

There must be something I missed.  What did go wrong?



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Please Help Me To Convert My JSP Scripting Elements To Tags

Posted by sa...@04web.com.
> I replaced:
>
> int totalPosts = ( ( Integer )request.getAttribute(
> "TotalPosts" ) ).intValue();
> with
> <c:set var="totalPosts"
> value="${requestScope.TotalPosts}" />
>
> And I replaced:
>
> <%=totalPosts%>
> with
> <c:out value="${requestScope.totalPosts}" />
>



  You are missing the taglib uri for c.tld (included with standard taglibs
[for Tomcat 4 use standard-1.0 for Tomcat 5 use standard-1.0 or
standard-1.1]):

<!-- Change to match your deployment descriptor -->
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>

If this continues not to work, try

<c:out value='${request.TotalPosts}'/>

Regards,

Pedro Salgado



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org