In that case I wouldn't bother trying this at the serverside.

Theoretically you can access the html markup and fiddle with it, but that's generally not how wicket is meant to be used. (Trust me, we've been doing quite some advanced stuff with wicket over the years).

If all you want to do is change the html code, you can also do that with some javascript code. E.g. override renderHead() in your page and contribute some javascript code for onLoad.

But before doing such things: is there a particular reason why you are using static html instead of a component tree?
Are you able and willing to switch to a component tree?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 23-1-2013 20:53, schreef Michael Jaruska:
Problem is that uls and lis (let's call whole structure "menu") is static html code.


On 23.1.2013 20:50, Bas Gooren wrote:
Hi!

What you want to accomplish (e.g. changing some html attributes) can be done by adding an attributemodifier to each <li> component.

In pseudocode:

RepeatingView uls = ...
for_every_li:
WebMarkupContainer li = ...
uls.add(li);

now, you can do something like this:
li.add(new AttributeAppender(...) {
     isEnabled() {
         return true if you want to append a html attribute;
     }
});

Or alternatively:

WebMarkupContainer li = new WMC() {
     onComponentTag(ComponentTag tag) {
         super(tag);

         tag.put("my-html-attribute", value);
     }
}

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 23-1-2013 20:45, schreef Michael Jaruska:
Hi,

is there a way I can find specific html tag in markup?

I have this html structure:
<ul class="mymenu">
  <li>
    <a href="./mypage.html?cid=menu">menu</a>
  <ul>
    <li>
      <a href="./mypage.html?cid=menu/submenu">submenu</a>
    <ul>
      <li>
<a href="./mypage.html?cid=menu/submenu/subsubmenu1">subsubmenu1</a>
      </li>
      <li>
<a href="./mypage.html?cid=menu/submenu/subsubmenu2">subsubmenu2</a>
      </li>
      <li>
<a href="./mypage.html?cid=menu/submenu/subsubmenu3">subsubmenu3</a>
      </li>
    </ul>
  </ul>
</ul>

I'm processing clicks on anchors with my page:
public PageTest(PageParameters parameters){
  //cid = category id
  String category = parameters.get("cid").toString();
  ...
}

Now I need some way I can add atribute into parent <li> tag of <a> tag on which I do click.
Somethink like (pseudocode):
public PageTest(PageParameters parameters){
  //cid = category id
  String category = parameters.get("cid").toString();
  //find corresponding <a> tag
Tag anchorTag = go_from_top_ul_tag_and_find_a_tag_by_category(category)
  //have corresponding anchor tag, get parrent tag of the anchor tag
  Tag anchorParentTag = anchorTag.getParent();
  //and now I can do my mysterious things with menu...
}

But I don't know where to start my search and I totaly don't know whot to look for in docu.

Please, help :-)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Reply via email to