How to handle these nested tags

Sun, 09 Sep 2007 22:04:57 -0700

I have a html page that displays "welcome ,XXX" ,or something like that, the 
"XXX" is the current user name, and I use Label to display it. But there is an 
exception when it runs.
   
  Unable to find component with id 'userName' in [MarkupContainer [Component id 
= _relative_path_prefix_14, page = com.cmip.web.pages.TopFrame, path = 
3:topForm:_relative_path_prefix_13:_relative_path_prefix_14.WebMarkupContainer, 
isVisible = true, isVersioned = true]]. This means that you declared 
wicket:id=userName in your markup, but that you either did not add the 
component to your page at all, or that the hierarchy does not match.

   
  The code:
  public TopFrame(){
  super();
  String name = ((CMIPSession)this.getSession()).getUser().getUserName();
  Label userName = new Label("userName",new Model(name));
  Form topForm = new Form("topForm");
  topForm.add(userName);
  this.add(topForm);
   
   
  html:
   
  <body style="padding: 0px 0px 0px 0px;margin: 0px 0px 0px 0px;">
  <form wicket:id="topForm">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td width="485"><img src="images/logo_top.gif" width="485" height="85"></td>
    <td background="images/bg_top.gif">&nbsp;</td>
    <td width="260" align="right" background="images/bg_top.gif">
<table width="242" height="80" border="0" cellpadding="5" cellspacing="0">
        <tr valign="top"> 
<td colspan="2" align="right" class="whiteText">°æ±¾ºÅ£ºV1.0</td>
        </tr>
        <tr align="center"> 
            <td height="37"><a href="Main.html" target="mainframe"><img 
src="images/button_desktop.gif" width="112" height="27" border="0" 
alt="·µ»ØÖ÷Ò³" onClick="javascript:self.location='Top.html'"></a></td>
          <td><a href="../public/Logout.html" target="mainframe"><img 
src="images/button_logout.gif" width="112" height="27" border="0"></a></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
  
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="485" height="1"><img src="images/spacer.gif" width="1" 
height="1"></td>
  </tr>
  <tr bgcolor="#38E089"> 
    <td height="4"><img src="images/spacer.gif" width="4" height="4"></td>
  </tr>
  <tr> 
    <td height="1"><img src="images/spacer.gif" width="1" height="1"></td>
  </tr>
  <tr background="images/bg_3D_bar.gif"> 
    <td height="28" background="images/bg_3D_bar.gif"><table width="100%" 
border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="140" align="center" class="whiteText"><span 
id="serverTime"> </span></td>
          <td width="2"><img src="images/pic_shr.gif" width="2" 
height="23"></td>
          <td><table width="316" border="0" cellspacing="0" cellpadding="1">
              <tr> 
                <td width="28">&nbsp;</td>
                <td width="284" align="center" class="welcomeBox">
        ¡¡  Welcome <label wicket:id="userName"></label>
                </td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
 <script language="javascript">
           updateTime();
    </script>
</form>
</body>


-Kevin Liu
       
---------------------------------
Pinpoint customers who are looking for what you sell. 

Reply via email to