Re: How to handle these nested tags

Sun, 09 Sep 2007 22:52:12 -0700

hmmm... the hierarchies seem to match. The only weird things I see are that your img tags are unclosed (Wicket may require valid xml templates -- I'm not sure because I always use xhtml) and your call to add the topForm component uses an explicit "this" reference. I can't remember if "this" with a method call does nothing or if it can actually interfere with dynamic binding. Either way, you don't want to do it. Just call "add(topForm)".

If neither of those suggestions work (and I kind of doubt they will), think about whether your page's superclass might be causing the problem. For instance, a weird markup inheritance scenario could conceivably cause this.

-Ryan

On Sep 9, 2007, at 9:58 PM, Kevin Liu wrote:

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.WebMarkupC ontainer, 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.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to