[opencms-dev] Re: Modify JSP without embeded HTML tag

Tom Miller tom at hostwebase.com
Tue Oct 10 05:40:27 CEST 2006


Christian,

Thank you so much for respond to my issues.

I am a new user and am trying to use Opencms to edit my .jsp 
files via the web browser.  I need some helpful hints & 
tips.  I am not able to embed the taglib into my .jsp files 
without writting a bunch of .html files to get it to work.



Here is one of my .jsp file.   Can I use the Opencms taglib 
directly within the index.jsp file?  and how.



****** beginning of index.jsp ******************


<%@ page language="java"%>
<%@ include file="init.jsp"%><head>
<jsp:include page="indexHeader.jsp" flush="true"/>

<html:errors/>

<jsp:useBean id="news" 
class="emarket.onarts.catalog.NewsBean" scope="request"> 
   <jsp:setProperty name="news" property="sessionID" 
value="<%=session.getId()%>"/>
</jsp:useBean>

<jsp:useBean id="featureGroups" 
class="emarket.onarts.catalog.FeatureBean" scope="request"> 
   <jsp:setProperty name="featureGroups" 
property="sessionID" value="<%=session.getId()%>"/>
   <jsp:setProperty name="featureGroups" property="*"/>   
</jsp:useBean>

<table width="750" border="0" cellspacing="0" 
cellpadding="0">
    <tr> 
      <td height="25" colspan="3" align="left" valign="top" 
bgcolor="#333D4A"> <img src="graphics/title_news.gif" 
width="186" height="12" /></td>
      <td height="25" bgcolor="#333D4A"> </td>
      <td height="25" bgcolor="#333D4A"> </td>
      <td colspan="2" valign="top" 
bgcolor="#333D4A"> <img 
src="graphics/title_featured.gif" width="364" 
height="11" /></td>
    </tr>
    <tr> 
      <td width="6" rowspan="6" valign="top" 
bgcolor="3D4958" class="newstext"> 
        <p align="right"><img src="graphics/dot_2.gif" 
width="1" height="312"></p></td>
      <td width="187" valign="top" class="newstext" 
bgcolor="2B3543"> <p><img src="graphics/dot_4.gif" 
width="187" height="1"></p></td>
      <td width="1" rowspan="6" valign="top" 
bgcolor="2B3543" class="newstext"><img 
src="graphics/dot_2.gif" width="1" height="312"></td>
      <td width="5" rowspan="6" valign="top" 
bgcolor="2B3543"> </td>
      <td width="5" rowspan="6" valign="top" 
bgcolor="3D4958"> </td>
      <td rowspan="7" valign="top" bgcolor="3D4958"> <div 
align="center"> 
          <table width="532" border="0" align="right" 
cellpadding="0" cellspacing="0" bgcolor="3D4958">
            <tr> 
              <td colspan="4"><img src="graphics/dot_3.gif" 
width="268" height="1"><img src="graphics/dot_3.gif" 
width="268" height="1"></td>
              <td width="1" rowspan="4" valign="top"><img 
src="graphics/dot_2.gif" width="1" height="315"></td>
            </tr>
            <% int iCount = 1; %>
                    <tr>
	      <td width="1" rowspan="3" valign="top"><img 
src="graphics/dot_2.gif" width="1" height="315"></td>
                    <logic:iterate id="featureGroup" 
name="featureGroups" property="featureGroups" 
type="emarket.onarts.catalog.FeatureEntryBean">
                      <bean:define id="featNme" 
name="featureGroup" property="featureName" 
type="java.lang.String"/>
                      <bean:define id="partNbr" 
name="featureGroup" property="partNumber" 
type="java.lang.String"/>
                      <bean:define id="featDesc" 
name="featureGroup" property="featureDesc" 
type="java.lang.String"/>
                      <bean:define id="detType" 
name="featureGroup" property="detailType" 
type="java.lang.String"/>
                      <bean:define id="ext" 
name="featureGroup" property="pictureExt" 
type="java.lang.String"/>
                      <td class="newstext"><div 
align="center">
                       <%if(!"".equals(partNbr)) { %>
                           <a href="<%=detType%>.jsp?
partNumber=<%=partNbr.toString()%>">
                       <%}%><img border="2" 
src="feature/images/<%=featNme%>.<%=ext%>"></a>
                           <%=featDesc%></div></td>
                 
                    <% if (iCount != 0 && iCount%2 == 0) { %
></tr>
                    <tr>
                    <td colspan="3"><img 
src="graphics/dot_3.gif" width="268 " height="1"><img 
src="graphics/dot_3.gif" width="268" height="1"></td>
                    </tr>
		    <% } iCount++; %>
                    </logic:iterate>
            
    <tr bgcolor="3D4958"> 
              <td colspan="7"> </td>
            </tr>
          </table>
        </div></td>
      <td width="8" rowspan="7" bgcolor="3D4958"> </td>
    </tr>
    <tr> 
      <td valign="top" bgcolor="2B3543" 
class="newstext"><br><%= news.getNewsOne()%></td>
    </tr>
    <tr> 
      <td valign="middle" bgcolor="2B3543" 
class="newstext"><img src="graphics/dot_4.gif" width="187" 
height="1"></td>
    </tr>
    <tr> 
      <td valign="top" bgcolor="2B3543" 
class="newstext"><br><%= news.getNewsTwo()%></td>
    </tr>
    <tr> 
      <td valign="middle" bgcolor="2B3543" 
class="newstext"><img src="graphics/dot_4.gif" width="187" 
height="1"></td>
    </tr>
    <tr> 
      <td valign="top" bgcolor="2B3543" 
class="newstext"><br><%= news.getNewsThree()%></td>
    </tr>
    <tr> 
      <td colspan="5" valign="middle" bgcolor="3D4958" 
class="newstext"> </td>
    </tr>
  </table>
<jsp:include page="indexBottom.jsp" 
flush="true"/></table></body></div>

*****************  end sample index.jsp file *****




Thanks much,

Tom

















  

---- Original message ----
>Date: Tue, 10 Oct 2006 01:18:30 +0200
>From: Christian Steinert <christian_steinert at web.de>  
>Subject: Re: [opencms-dev] Modify content JSP without HTML  
>To: The OpenCms mailing list <opencms-dev at opencms.org>, 
tom at hostwebase.com
>
>
>> 
>> Is there a better way to embed opencms taglib in a full 
and 
>> complex jsp file?   Is there other example beside the 
simple 
>> example in the documentation.
>> 
>> 
>
>Better in which respect?
>The taglib documentation shows the building blocks and then 
you can create your templates based on the individual tags 
that are presended there.
>
>What would be "better" for you?
>I think it largely depends on what you want to accomplish 
in your templates. Then maybe some developers here can help 
you with how to structure your code (which would be more of 
a software design question and not so much an API question).
>
>c.
>____________________________________________________________
_________
>Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten 
zu sparen!
>http://smartsurfer.web.de/?
mc=100071&distributionid=000000000066
>



More information about the opencms-dev mailing list