title: javax.servlet.jsp.JspException: Cannot find bean: "CommentsUpdated" in any scope
body: <p><strong><code>Struts-config.xml</code>:</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
  
  &lt;!DOCTYPE struts-config PUBLIC
        &quot;-//Apache Software Foundation//DTD Struts Configuration 1.2//EN&quot;
        &quot;http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd&quot;&gt;
  &lt;struts-config&gt;
    &lt;form-beans&gt;
    &lt;/form-beans&gt;
  
    &lt;global-exceptions&gt;
    &lt;/global-exceptions&gt;
  
  &lt;global-forwards&gt;
      &lt;forward name=&quot;welcome&quot;  path=&quot;/Welcome.do&quot;/&gt;
  &lt;/global-forwards&gt;
  
  &lt;action-mappings&gt;
      &lt;action path=&quot;/Link&quot; parameter=&quot;method&quot; type=&quot;com.sicmsb.action.LinkAction&quot;&gt;
          &lt;forward name=&quot;search&quot; path=&quot;search&quot;/&gt;
      &lt;/action&gt;
      &lt;action path=&quot;/Welcome&quot; forward=&quot;/welcomeStruts.jsp&quot;/&gt;
  &lt;/action-mappings&gt;
  
  &lt;controller processorClass=&quot;org.apache.struts.tiles.TilesRequestProcessor&quot;/&gt;
  
  &lt;message-resources parameter=&quot;com/vaannila/ApplicationResource&quot;/&gt;
  
  &lt;plug-in className=&quot;org.apache.struts.tiles.TilesPlugin&quot; &gt;
      &lt;set-property property=&quot;definitions-config&quot; value=&quot;/WEB-INF/tiles-defs.xml&quot; /&gt;      
      &lt;set-property property=&quot;moduleAware&quot; value=&quot;true&quot; /&gt;
  &lt;/plug-in&gt;
  
  &lt;plug-in className=&quot;org.apache.struts.validator.ValidatorPlugIn&quot;&gt;
      &lt;set-property
          property=&quot;pathnames&quot;
          value=&quot;/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml&quot;/&gt;
  &lt;/plug-in&gt;
  
  &lt;/struts-config&gt;
  </code></pre>
  <p><strong><code>tiles-defs.xml</code>:</strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
  
   &lt;!DOCTYPE tiles-definitions PUBLIC
         &quot;-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN&quot;
         &quot;http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd&quot;&gt;
  &lt;tiles-definitions&gt;
      &lt;definition name=&quot;baseLayout&quot; path=&quot;/common-layout.jsp&quot;&gt;
          &lt;put name=&quot;header&quot; value=&quot;/header.jsp&quot; /&gt;
          &lt;put name=&quot;body&quot; value=&quot;/body.jsp&quot; /&gt;
          &lt;put name=&quot;footer&quot; value=&quot;/footer.jsp&quot; /&gt;
      &lt;/definition&gt;
      &lt;definition name=&quot;search&quot; extends=&quot;baseLayout&quot;&gt;
  
          &lt;put name=&quot;body&quot; value=&quot;/searchMyUser.jsp&quot; /&gt;
      &lt;/definition&gt;
  &lt;/tiles-definitions&gt;
  </code></pre>
  <p><strong><code>common-layout.jsp</code>:</strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;%@page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot;%&gt;
  &lt;%@ taglib uri=&quot;http://struts.apache.org/tags-html&quot; prefix=&quot;html&quot; %&gt;
  &lt;%@ taglib uri=&quot;http://struts.apache.org/tags-tiles&quot; prefix=&quot;tiles&quot;%&gt;
  &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
     &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
  &lt;html&gt;
  
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
       &lt;table border=&quot;1&quot;  width=&quot;100%&quot; height=&quot;100%&quot;&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;tiles:insert attribute=&quot;header&quot; /&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td&gt;&lt;tiles:insert attribute=&quot;body&quot; /&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td&gt;&lt;tiles:insert attribute=&quot;footer&quot; /&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p><strong><code>searchMyUser.jsp</code>:</strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;%@page import=&quot;com.sicmsb.bean.Comments&quot;%&gt;
  &lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=ISO-8859-1&quot;
      pageEncoding=&quot;ISO-8859-1&quot;%&gt;
  &lt;%@ taglib uri=&quot;http://struts.apache.org/tags-bean&quot; prefix=&quot;bean&quot;%&gt;
  &lt;%@ taglib uri=&quot;http://struts.apache.org/tags-html&quot; prefix=&quot;html&quot;%&gt;
  &lt;%@ taglib uri=&quot;http://struts.apache.org/tags-logic&quot; prefix=&quot;logic&quot;%&gt;
  
  &lt;%@ taglib uri=&quot;http://struts.apache.org/tags-tiles&quot; prefix=&quot;tiles&quot;%&gt;
  &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
      function submitAdd(form) {
          form.submit();
      }
  
      function goDetail(commentId) {
          var myform = document['detForm'];
          //myform.action = &quot;/detail.do&quot;;
          myform['commentId'].value = commentId;
          myform.submit();
      }
  &lt;/script&gt;
  &lt;style&gt;
  A {
      text-decoration: underline;
      color: blue;
      cursor: pointer;
  }
  &lt;/style&gt;
  
  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
  
  &lt;title&gt;Search here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form name=&quot;detForm&quot; action=&quot;details.do&quot; method=&quot;post&quot;&gt;
          &lt;input type=&quot;hidden&quot; name=&quot;commentId&quot; /&gt;
      &lt;/form&gt;
  
      &lt;h1&gt;Search in MyUser&lt;/h1&gt;
  
      &lt;form action=&quot;SearchUser.do&quot; method=&quot;post&quot;&gt;
          &lt;table cellpadding=&quot;3pt&quot;&gt;
              &lt;tr&gt;
                  &lt;td&gt;Insert Name : &lt;html:text name=&quot;CommentsUpdated&quot;
                          property=&quot;myUser&quot; size=&quot;30&quot;&gt;&lt;/html:text&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
          &lt;p /&gt;
          &lt;input type=&quot;button&quot; value=&quot;Search&quot;
              onclick=&quot;this.disabled=true; submitAdd(this.form)&quot; /&gt;
      &lt;/form&gt;
  
      &lt;hr /&gt;
  
      &lt;table&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Email&lt;/th&gt;
              &lt;th&gt;Webpage&lt;/th&gt;
              &lt;th&gt;Summary&lt;/th&gt;
              &lt;th&gt;Comments&lt;/th&gt;
          &lt;/tr&gt;
  
          &lt;logic:iterate id=&quot;comment&quot; name=&quot;listComments&quot;
              type=&quot;com.sicmsb.bean.Comments&quot;&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;a onclick=&quot;goDetail('&lt;%=comment.getCommentId()%&gt;')&quot;&gt; &lt;bean:write
                              name=&quot;comment&quot; property=&quot;myuser&quot; /&gt;
                  &lt;/a&gt;
                  &lt;td&gt;|&lt;bean:write name=&quot;comment&quot; property=&quot;email&quot; /&gt;
                  &lt;td&gt;|&lt;bean:write name=&quot;comment&quot; property=&quot;webpage&quot; /&gt;
                  &lt;td&gt;|&lt;bean:write name=&quot;comment&quot; property=&quot;summary&quot; /&gt;
                  &lt;td&gt;|&lt;bean:write name=&quot;comment&quot; property=&quot;comments&quot; /&gt;
              &lt;/tr&gt;
          &lt;/logic:iterate&gt;
      &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p><strong><code>LinkAction.java</code>:</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>package com.sicmsb.action;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.struts.actions.DispatchAction;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionMapping;
  import org.apache.struts.action.ActionForward;
  
  public class LinkAction extends DispatchAction {
      public ActionForward Search(ActionMapping mapping, ActionForm  form,
              HttpServletRequest request, HttpServletResponse response)
              throws Exception {
          return mapping.findForward(&quot;search&quot;);
      }
  }
  </code></pre>
  <p>I managed to create the template and call in the forms without the &quot;name&quot; attributes.It worked, then i realized i have to call in forms that have names attribute(<code>CommentsUpdated</code>) so that i able to pass the variables for digging the data from database.Unluckily it throws error like this:</p>
  <p><code>javax.servlet.jsp.JspException: Cannot find bean: &quot;CommentsUpdated&quot; in any scope</code>.</p>
  <p>i understand that the name attribute in my <code>serachMyUser.jsp</code> causing this error, but i'm stuck on this part, i've tried to search in google for examples, but all i get is the forms were called in without names attribute in it.</p>