I want to generate this table header by wicket
<tr>
<th>Actions</th>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Home Phone</th>
<th>Cell Phone</th>
</tr>
where header names are saved in arrayList
I try something like this. It generate what I want but in html code it show warning
- Invalid location of tag (div).
Good thing is that div tag is not showed in generated html code.
I dont know what tag should I use when I just want th without span tag
<tr>
<div wicket:id="seasonNames"><th wicket:id="season">[season]</th></div>
</tr>
One approach is to use DataTable component. In that case you have to pass a list of IColumn instances and use HeaderToolbar. See Wicket-examples for this approach.
Another way is to use simple repeater, like RepeatingView or ListView. In that case wicket:id="seasonNames" should be <wicket:container> instead of <div>.
Related
I have an object invoice, it has some list of Invoice Items. Now I want to get print of my invoices. For that I used Velocity Template. But my model template not getting my required format.
I used this .
I got this Output
For below template
I got this Output
But I want like this
Guys Plz help me to get requried format
Try the following code
<table>
<tr>
<th>Name</th>
<th>Desp</th>
<th>Qty></th>
<td>Unit Price</th>
<th>Disc</th>
<th>Total</th>
<th>vat rate</th>
<th>vat amount</th>
</tr>
#foreach ($titem in $!invoice.transactionItems)
<tr>
<td>$!titem.item.name</td>
<td>$!titem.description</td>
<td>$!titem.quantity</td>
<td>$!titem.unitPrice</td>
.....
</tr>
#end
</table>
Firstly,you need to write some html code as well as css,once have the html template, you can fill your object value to the html code, as your format, you need to make use of the html table label to present your result.
I have two elements with name price1 [BTW I know that having duplicate IDs is against standards, is this the same with NAME?]
<TR CLASS="Blocks" id="p_priceKILO" style="display: none ;">
<TD>Price:</TD>
<TD><INPUT TYPE="text" name="price1">$/kilo</TD>
</TR>
<TR CLASS="Blocks" id="p_pricePOUND" style="display: none ;">
<TD>Price:</TD>
<TD><INPUT TYPE="text" name="price1">$/pound</TD>
</TR>
Only one of these rows will be visible at one time (using javascript)
I use the following java code to retrieve price1
public PricePosition(HttpServletRequest request) {
this.price1=StringFunctions.StringToDouble(request
.getParameter("PRICE1"));
...
Is there any neat way to retrieve only the visible element?
I have a workaround - calling them price1a and price1b and retrieving the correct one based on my knowledge of which one is visible, but I wondered if there was another way.
You'll have to use JS again: when displaying a row, rename the inner corresponding input to displayedPrice for example, and get this parameter server-side.
When hiding a row, don't forget to rename it back.
I am using display tag in my application. In that i need to sort the table contents based on the column header click. Column header has link navigation. Instead i need to submit the form while clicking on the table column header. How can we achieve it.
As of now, my application craetes the table like this,
<display:table id="data" name="lstEntities"
sort="external" uid="row" htmlId="rowid" class="tborder"
excludedParams="*" style="width:100%"
pagesize="${pageCriteria.recordsPerPage}" partialList="true"
size="${pageCriteria.totalRecords}" export="false"
requestURI="prestigeBrandListMDA.action">
<display:column property="brandId" sortName="brand.brandId"
sortable="true" titleKey="table.title.brandId"
style="width:100px" />
<thead>
<tr>
<th class="sortable">
Sales Brand Id</th>
instead i need the link like below
<thead>
<tr>
<th class="sortable">
Sales Brand Id</th>
Yes i used Jquery to achieve this functionality.thanks.i used the following code to achieve it.
$('.sortable').each(function(event){
var obj = $(this).find('a').attr('href');
var urltext = 'javascript:submitform("'+contextPath+'/'+obj+'\")';
$(this).find('a').attr('href', urltext);
});
As far as I know, there is no way to do that using displaytag. Use the JQuery ready event to change links on the fly.
I am able get all text with in tags but I want to access only specific td tags.
Eg.I want to get data of second cell text whose first cell html contains attribute
a name="manufacturer"
or Content.I am using Jsoup.
<tabel>
<tr>
<td><a name="Manufacturer"></a>manufacturer</td>
<td>happiness</td>
</tr>
<td>manuf</td>
<td>hap</td>
</tr>
<tr>
<td>tents</td>
<td>acd</td>
</tr>
<tr>
<td><a name="Content"></a>Contents</td>
<td>abcd</td>
</tr>
</tabel>
I am using the code ..
doc.select("a[name=Manufacturer]");
..but its giving me the reference of cell one ,I need to go to cell two get cell two text
You need to use selector like [attr=value]: elements with attribute value, e.g. [width=500].
Take a look at official documentation Selector Syntax
I have a jsp in which I have a drop down as
<s:select name="newQuestion.CertificationId" list="certificationList"
listKey="certificationId" listValue="certificationName"
headerKey="" headerValue="Select Certification"
label="Certification Name"
onchange="getQuestionsList(this.value)" />
When the dropdown value changes I can getQuestionsList. In the javascript function I submit to an action class where I modify the value of a questionList which is displayed in my JSP via an iterator.
The values of the questionList contain all questions and when I select a value from the above drop down I need to populate only those questions which belong to the id selected in the drop down. (I query the DB to load the questions in action class.)
Initially when the page is loaded I have all questions in questionList but after selecting a value from drop down I have the updated questions in the action class.
For displaying the values of question list I use a iterator tag
<div id="questionDetails" class="registrationDetails" style="display: none;">
<span><b>Question List</b></span>
<br>
<table class="registrationDetailsTable">
<tr class="tabledataheader">
<td>Question Id</td>
<td>Question Description</td>
</tr>
<s:iterator value="questionList">
<tr class="tabledatarow">
<td><s:property value="questionId" /></td>
<td><s:property value="questionDesc" /></td>
</tr>
</s:iterator>
</table>
</div>
The div is initially hidden and on select of a value in drop down I need to display the values of questionList which is taking old values as the page is not reloaded.
When I again come back to this jsp I am not seeing the new value as it is not getting updated.
Any heads up please
Why don't you try Struts2 Jquery Plugin. Here is the showcase with code.
What you need is
<sj:select ...> tag.
Let me know if you still need an example.
You would need to make few changes to the code. Let me list them down:
Move the following part in your initial JSP to another jsp, say questionList.jsp. The below part should be the only thing which should be inside the newly created jsp.
<span><b>Question List</b></span>
<br>
<table class="registrationDetailsTable">
<tr class="tabledataheader">
<td>Question Id</td>
<td>Question Description</td>
</tr>
<s:iterator value="questionList">
<tr class="tabledatarow">
<td><s:property value="questionId" /></td>
<td><s:property value="questionDesc" /></td>
</tr>
</s:iterator>
</table>
In your main page, you would need to replace the above code part with
<jsp:include page="questionList.jsp" flush="true"/>
Now deploy and see if everything is in place as before.
In your getQuestionsList() javascript function, make an ajax call to another action mapping say showQuestionList.action?certification=12. Here, 12 will be the id of the certification, which you will handle in the action. If you use certification as an action property, add a variable with the same name with getter and setter methods.
In your action method say showQuestionList(), retrieve the questionList and assign to the action variable.
On return of SUCCESS of the above method, the result should send only questionList.jsp. This will have the part to list just the necessary fields.
In the getQuestionsList() javascript function, after the ajax call being success, get the data and put it into the div with id questionDetails.
Show the div.