struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Struts Newsgroup (@Basebeans.com) <str...@basebeans.com>
Subject jsp exception with useBean . <%= ...%>
Date Sun, 24 Feb 2002 01:40:01 GMT
Subject: jsp exception with useBean . <%= ...%>
From: Les Dunaway <LesD@Mindspring.com>
 ===
Folks,

I'm feeling very dumb here.  I'm using struts templates and they work, 
but when I imbed a <%= someid.someMethod() %> in a sidebar.jsp which was 
put'ed and then get'ed, I get jsp exception.  When I run with 
sidebar.html (below) all is well.

Is it allowed to use <%= ...%> in a .jsp processed by 
template.put/get????  Or is there some incantation I've ommitted?

Les

sidebar.jsp

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <%@ page language="java" %>
> 
> <jsp:useBean id="draw" class="DrawSidebar" scope="application" />
> 
> <%= draw.getSidebar() %>

sidebar.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page language="java" %>


<table width="100%" valign="top" align="left" bgcolor="cyan">
<tr width="100%">
	<td width="100%" align="center">
     	<font size="+2"><b>
		<IMG SRC="/images/narrowLogo.jpg" alt="HighGear Logo" ALIGN="top"></a>
		<hr size="5" width="80%">
		<a href="navigate.jsp">About Us</a><br><hr size="5" width="80%">
         <a href="navigate.jsp">Services</a><br><hr size="5" width="80%">
         <a href="navigate.jsp">Appointments</a><br><hr size="5" 
width="80%">
         <a href="navigate.jsp">Check Your Job</a><br><hr size="5" 
width="80%">
         </b></font>
</tr>
</table>

DrawSidebar.java
/* Generated by Together */

public class DrawSidebar {
     public String[] getButtons(){
             return buttons;
         }

     public void setButtons(String[] buttons){
             this.buttons = buttons;
         }

     public String getSidebar(){
         wrk.append("<table width=\"100%\"/>" + "<font size=\"+2\"><b>");
         wrk.append("<IMG SRC=\"/images/narrowLogo.jpg\" alt=\"HighGear 
Logo\" ALIGN=\"top\"></a>");
// rest of it
		wrk.append("</table>");
         sidebar = wrk.toString();
         return sidebar;
         }

     private StringBuffer wrk;
     private String[] buttons = {"About 
Us","Services","Appointments","Check Your Job"};
     private String sidebar;
}

tmpltSetup.jsp
<%@ taglib uri="struts-template.tld" prefix="template" %>

<template:insert template="/pageTmplt.jsp">
  <template:put name="title" content="HighGear" direct="true"/>
  <template:put name="header" content="/header.html" />
  <template:put name="sidebar" content="/sidebar.jsp" />
  <template:put name="content" content="/about.html"/>
  <template:put name="mainFooter" content="/mainFooter.html" />
   <template:put name="pageFooter" content="/pageFooter.html" />
</template:insert>

pageTmplt.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="struts-template.tld" prefix="template" %>
<html>
<head>
   <title><template:get name="title"/></title>

   <link href="css/base.css" rel=stylesheet>

   <meta name="charset" content="ISO-8859-1">

   <meta name="generator" content="Screem 0.4.1">
</head>
   <body>
<table width="800" border="1" bgcolor="White">
   <tbody>
     <tr valign="Top">
       <td width="150">
       	<template:get name="sidebar"/>
       <td>
       <table border="1" width="650">
         <tbody>
           <tr>
             <td><template:get name="header"/><br>
             <br>
             </td>
           </tr>
           <tr>
             <td>
             	<template:get name="content"/><br>
             </td>
           </tr>
           <tr>
             <td><template:get name="mainFooter"/><br>
             <br>
             </td>
           </tr>
         </tbody>
       </table>
       </td>
     </tr>
     <tr>
       <td colspan="2"><template:get name="pageFooter"/></td>
     </tr>
   </tbody>
</table>
</body>
</html>




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


Mime
View raw message