Unable to find incomplete job in HTML - java

I have completed HTML project and works find and no ERROR
Now my problem is that I am unable to find incomplete job in my Project. I use Netbeans for creating this project is there a way to find any incomplete work in existing project?
I used HTML, Flash, java, to create this entire project. Is there a tool to find this incomplete work or can I find it using Netbeans
So, how do I find incomplete work?
Thanks in advance
CODE
<!DOCTYPE html>
<html>
<head>
<title>Atomic Structure and Chemical Bonds</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type='text/css' rel='stylesheet' href='assets/css/bootstrap.min.css' />
<link type='text/css' rel='stylesheet' href='assets/css/VLAB.css' />
<link type='text/css' rel='stylesheet' href='assets/css/E20.css' />
<!--<link type='text/css' rel='stylesheet' href='assets/css/bootstrap-theme.min.css' />-->
<!--for Font-->
<link rel="stylesheet" type="text/css" media="screen" href="assets/fonts/webfontkit_proximaNova_reg/ProximaNova-Regular.css" />
<link rel="stylesheet" type="text/css" media="screen" href="assets/fonts/webfontkit_proximanova_sb/ProximaNova-Semibold.css" />
<script src="assets/js/jquery-1.9.1.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="assets/js/jquery.ui.touch-punch.js"></script>
<script type="text/javascript" src="assets/js/jquery.shuffle.js"></script>
<script type="text/javascript" src="assets/js/calc.js"></script>
<!-- Icon Assets -->
<script type="text/javascript" src="assets/js/journal.js"></script>
<script type="text/javascript" src="assets/js/sound.js"></script>
<script type="text/javascript" src="assets/js/print.js"></script>
<script type="text/javascript" src="assets/js/main.js"></script>
<script type="text/javascript">
function incrementButtons( upBtn, downBtn, qtyField )
{
var step = parseFloat( qtyField.value ) || 1,
currentValue = step;
downBtn.onclick = function()
{
currentValue = parseFloat( qtyField.value ) || step;
qtyField.value = ( currentValue -= Math.min( step, currentValue - step ) );
}
upBtn.onclick = function()
{
currentValue = parseFloat( qtyField.value ) || step;
qtyField.value = ( currentValue += step );
}
}
</script>
</head>
<body>
<div class="overlay"></div>
<div class="VLAB_container">
<header>
<div class="VLAB_head">VIRTUAL LABS</div>
<div class="VLAB_exit">X</div>
<div class="VLAB_print"></div>
<div class="VLAB_audio"></div>
</header>
<!-- Table Popup -->
<div id="VLAB_table" class="VLAB_table"
style="display:none;z-index:101;">
<div class="VLAB_table_title">Table <div class="VLAB_table_exit">X</div></div>
<div class="VLAB_table_subtitle">Title here </div>
<br/>
<div>
<table id="answered">
<thead>
<tr>
<th>Value 1</th>
<th>Value 2</th>
<th>Value 3</th>
<th>Value 4</th>
</tr>
</thead>
<tbody>
<tr>
<td data-id="all"><input type='text' value='' /></td>
<td data-id="all"><input type='text' value='' /></td>
<td data-id="all"><input type='text' value='' /></td>
<td data-id="all"><input type='text' value='' /></td>
</tr>
<tr>
<td data-id="all"><input type='text' value='' /></td>
<td data-id="all"><input type='text' value='' /></td>
<td data-id="all"><input type='text' value='' /></td>
<td data-id="all"><input type='text' value='' /></td>
</tr>
<tr>
<td data-id="all"><input type='text' value='' /></td>
<td data-id="all"><input type='text' value='' /></td>
<td data-id="all"><input type='text' value='' /></td>
<td data-id="all"><input type='text' value='' /></td>
</tr>
</tbody>
</table>
</div>
<div class="VLAB_table_buttons">
<button type="button" class="btn disabled">Graph</button>
<button type="button" class="btn">Save</button>
<button type="button" class="btn">Print</button>
</div>
</div>
<!-- Table Popup ENDS-->
<!-- Journal Popup-->
<div id="VLAB_journal" class="VLAB_journal" style="display:none;z-index:101;">
<div class="VLAB_journal_title">Journal <div class="VLAB_journal_navigation"><div class="VLAB_journal_exit">X</div>
<div class="VLAB_journal_next"></div>
<span class="VLAB_journal_Qno"></span>
<div class="VLAB_journal_prev"></div>
</div>
</div>
<div class="VLAB_journal_subtitle"></div>
<div id="journalQuestions" style="display:none;z-index:101;">
<form action="#" class="regform" method="get">
<p>What part of the digestive system would you see in a cross-section anterior to the gizzard?<br/>
<textarea class="VLAB_journal_text_area" id="Answer1"
name="Question1" placeholder=""></textarea></p>
<p>What structure in the earthworm has a similar function as the human heart? Explain your answer.<br/>
<textarea class="VLAB_journal_text_area" id="Answer2"
name="Question2" placeholder=""></textarea></p>
<p>What do two earthworms exchange during mating? Explain your answer.<br/>
<textarea class="VLAB_journal_text_area" id="Answer3"
name="Question3" placeholder=""></textarea></p>
<p>Describe the difference between a closed and an open circulatory system.<br/>
<textarea class="VLAB_journal_text_area" id="Answer4"
name="Question4" placeholder=""></textarea></p>
<p>Do earthworms have a front and a back end? Explain your answer.<br/>
<textarea class="VLAB_journal_text_area" id="Answer5"
name="Question5" placeholder=""></textarea></p>
<p>What characteristics distinguish an annelid from other worms?<br/>
<textarea class="VLAB_journal_text_area" id="Answer6"
name="Question6" placeholder=""></textarea></p>
</form>
</div>
<div class="VLAB_journal_buttons">
<button type="button" class="btn">Save</button>
<button id="journalPrint" type="button" class="btn">Print</button>
</div>
</div>
<!-- Journal Popup ENDS-->
<!-- AUDIO START -->
<div style="display:none;">
<audio preload="metadata" id="a1" class="a1">
<source class="aud_src" src="assets/audio/sound2drag.mp3" type = "audio/mp3">
<source class="aud_src" src="assets/audio/sound2drag.ogg" type = "audio/ogg">
</audio>
</div>
<!-- AUDIO END -->
<!-- Calculator -->
<form>
<div class="VLAB_CALC">
<div class="VLAB_CALC_title">Calculator
<div class="VLAB_CALC_exit">X</div>
</div>
<div class="VLAB_CALC_screen">
<input type="text" id="memory" class="pull-left" value="" readonly /> <input type="text" id="displayPanel" class="pull-right" value="0" readonly /> </div>
<div class="VLAB_CALC_buttonpad">
<div class="dark" onclick='ac()'>AC</div>
<div class="dark" onclick='ce()'>CE/C</div>
<div class="dark" onclick='perc()' > %</div>
<div class="dark right" onclick='getoperator("/")'>/</div>
<div onclick='getdigit("1")'>1</div>
<div onclick='getdigit("2")'>2</div>
<div onclick='getdigit("3")'>3</div>
<div class="dark right" onclick='getoperator("*")'>×</div>
<div onclick='getdigit("4")'>4</div>
<div onclick='getdigit("5")'>5</div>
<div onclick='getdigit("6")'>6</div>
<div class="dark right" onclick='getoperator("+")'>&plus;</div>
<div onclick='getdigit("7")'>7</div>
<div onclick='getdigit("8")'>8</div>
<div onclick='getdigit("9")'>9</div>
<div class="dark right" onclick='getoperator("-")'>−</div>
<div onclick='getdigit("0")'>0</div>
<div class="dark" onclick='v(".")'>.</div>
<div class="dark right equal-sign" onclick='e()'>=</div>
<div class="dark lastrow" onclick='sto()' >STO</div>
<div class="dark lastrow" id="memoryBtn" onclick='rcl()'>RCL</div>
<div class="dark right lastrow" onclick=' sum_m()'>SUM</div>
</div>
</div>
</form>
<!-- Calculator END -->
<div id="VLAB_leftPanel" class="VLAB_leftPanel">
<div class="VLAB_leftPanel_head">Measurements</div>
<div class="VLAB_leftPanel_subhead">What are the structures and body systems of an earthworm?</div>
<div class="VLAB_leftPanel_content">
<p>We study earthworms to learn the structures and functions of segmented worms, also called annelids. Segmentation supports diversified functions of body parts and tissues. Studying the anatomy and body systems of annelids helps us understand the bodies of higher-level organisms. <br/><br/>Earthworms are classified in the phylum <i>Annelida</i>. (Kingdom: Animal; Phylum; Annelida; Class: Oligochaeta; Order: Opisthopora; Family: Lumbricidae; Genus: <i>Lumbricus</i>; Species:<i>Lumbricus terrestris</i>) The Annelida also include leeches and bristleworms. Segmented worms have bilateral symmetry and have a coelom, which is a fluid-filled body cavity surrounded by mesoderm. Earthworms have two body openings, a mouth and an anus. The basic body plan of segmented worms consists of a digestive tract within a tube. Earthworms are hermaphrodites, which means that an individual animal produces both sperm and eggs. During mating, two earthworms exchange sperm. Each earthworm forms a capsule for the eggs and sperm in which the eggs are fertilized. The capsule is left behind in the soil where the young earthworms emerge from the eggs in two to three weeks. Earthworms are herbivores. They obtain food by eating through the soil and extracting nutrients from it as food passes through the digestive tract. As an earthworm burrows, it loosens, aerates, and fertilizes the soil. Earthworm burrows provide passageways for plant roots and improve drainage of the soil.<br/><br/>
<b>Procedure</b><br/><br/> <b>1</b>. Click the <b>Lab manual</b> to read about earthworm anatomy.<br/><br/><b>2</b>. Click the <b>External anatomy button</b> to view a diagram of the external features of an earthworm.<br/><br/><b>3</b>. Drag and drop the <b>Labels</b> to the matching structures of the illustration.<br/><br/><b>4</b>. When all structures are labeled, the <b>Check button</b> is enabled. Click the <b>Check button</b> to receive feedback on whether the labels are matched with the correct structures. Correct the highlighted incorrect labels.<br/><br/><b>5</b>. Click the <b>Internal anatomy button</b> to view a diagram of the internal features of the earthworm and repeat steps 3 and 4.<br/><br/><b>6</b>. Answer the <b>Journal Questions</b>.</p>
</div>
<div class="VLAB_leftPanel_buttons">
<button id="journalBtn" type="button" class="btn">Journal</button>
<button id="calcBtn" type="button" class="btn">Calculator</button>
<button id="tableBtn" type="button" class="btn">Table</button>
</div>
</div>
<!-- right Panel for Interactivity part-->
<div class="VLAB_rightPanel">
<div id="page_content">
<div id="vlab_assets">
<!-- for development -->
<div calss="lab"><img height="683" width="700" src="assets/img/main.png" alt="image" style="position:absolute;"/></div>
<div style="position:absolute;margin-left:12px;margin-top:101px;"><img height="545" width="667" src="assets/img/bg_yellow.png" alt="image" style="position:absolute;"/></div>
<button id="me1" class="button">Hydrogen</button>
<button id="me2" class="button" style="margin-left:184px;">Hydrogen</button>
<button id="me3" class="button" style="margin-left:348px;">Hydrogen</button>
<button id="me4" class="button" style="margin-left:512px;width:160px;">Hydrogen</button>
<!--a class="term" id="pop1"><button class="buttona" style="margin-top:113px;margin-left:530px;width:122px;height:30px;">Show Labels</button></a-->
<script language="javascript">
var _0xd7e2=["\x6D\x61\x74\x63\x68","\x75\x73\x65\x72\x41\x67\x65\x6E\x74","\x74\x6F\x75\x63\x68\x73\x74\x61\x72\x74","\x63\x6C\x69\x63\x6B","\x6E\x6F\x43\x6F\x6E\x66\x6C\x69\x63\x74","\x68\x69\x64\x65","\x2E\x41\x6E\x73\x5F\x31\x50\x6F\x70","\x66\x61\x64\x65\x54\x6F\x67\x67\x6C\x65","\x73\x70\x61\x6E","\x63\x68\x69\x6C\x64\x72\x65\x6E","\x2E\x41\x6E\x73\x5F\x31","\x76\x61\x6C","\x53\x68\x6F\x77","\x48\x69\x64\x65","\x62\x69\x6E\x64","\x23\x62\x74\x6E\x53\x68\x6F\x77","\x72\x65\x61\x64\x79"];var what=(navigator[_0xd7e2[1]][_0xd7e2[0]](/iPad/i))?_0xd7e2[2]:_0xd7e2[3];var $=jQuery[_0xd7e2[4]]();$(document)[_0xd7e2[16]](function (_0xf214x3){$(_0xd7e2[6])[_0xd7e2[5]]();$(_0xd7e2[15])[_0xd7e2[14]](what,function (_0xf214x3){var _0xf214x4=$(this);$(_0xd7e2[10])[_0xd7e2[9]](_0xd7e2[8])[_0xd7e2[7]]();_0xf214x4[_0xd7e2[11]](_0xf214x4[_0xd7e2[11]]()==_0xd7e2[12]?_0xd7e2[13]:_0xd7e2[12]);} );} );
</script>
<script type="text/javascript" src="assets/js/jquery.1.10.2.min.js"></script>
<div class="Ans_1" style="position:absolute;margin-top:160px;margin-left:23px;opacity:1;">
<span style="opacity:1;" class="Ans_1Pop" ><img height="410" width="490" src="assets/img/label.png" alt="image"/></span>
</div>
<input type="button" id="btnShow" value="Show Labels" style="position:absolute;margin-top:113px;margin-left:530px;width:122px;height:30px;" />
<form id="f1" style="position:absolute;">
<p><input class="form-control transparent-input" type='text' name='qty' id='qty' value='0' readonly='readonly' style="position:absolute;font-family:verdana;font-weight:bold;margin-top:295px;margin-left:240px;width:55px;height:40px;border:black;background:black;color:white;text-align:center;"/></p>
<p><input type='button' name='add' value='' style="margin-top:277px;margin-left:317px;position:absolute;width:20px;height10px;opacity:0;"/></p>
<p><input type='button' name='subtract' value='' style="margin-top:305px;margin-left:317px;position:absolute;width:20px;height10px;opacity:0;"/></p>
</form>
<script type="text/javascript">
with( document.getElementById( 'f1' ) )
incrementButtons( add, subtract, qty );
</script>
<form id="f2" style="position:absolute;">
<p><input class="form-control transparent-input" type='text' name='qty' id='qty' value='0' readonly='readonly' style="position:absolute;font-family:verdana;font-weight:bold;margin-top:350px;margin-left:240px;width:55px;height:40px;border:black;background:black;color:white;text-align:center;"/></p>
<p><input type='button' name='add' value='' style="position:absolute;margin-top:347px;margin-left:317px;width:20px;height:20px;opacity:0;"/></p>
<p><input type='button' name='subtract' value='' style="position:absolute;margin-top:369px;margin-left:317px;width:20px;height:20px;opacity:0;"/></p>
</form>
<script type="text/javascript">
with( document.getElementById( 'f2' ) )
incrementButtons( add, subtract, qty );
</script>
<button id="check" class="buttona" style="margin-top:494px;margin-left:535px;width:102px;height:30px;">Check</button>
<form id="f3" style="position:absolute;">
<p><input class="form-control transparent-input" type='text' name='qty' id='qty' value='0' readonly='readonly' style="position:absolute;font-family:verdana;font-weight:bold;margin-top:574px;margin-left:342px;width:55px;height:40px;border:black;background:black;color:white;text-align:right;"/></p>
<p><input type='button' name='add' value='' style="position:absolute;margin-top:571px;margin-left:407px;width:12px;height:12px;opacity:0;"/></p>
<p><input type='button' name='subtract' value='' style="position:absolute;margin-top:586px;margin-left:407px;width:12px;height:12px;opacity:0;"/></p>
</form>
<script type="text/javascript">
with( document.getElementById( 'f3' ) )
incrementButtons( add, subtract, qty );
</script>
<form id="f4" style="position:absolute;">
<p><input class="form-control transparent-input" type='text' name='qty' id='qty' value='0' readonly='readonly' style="position:absolute;font-family:verdana;font-weight:bold;margin-top:574px;margin-left:428px;width:55px;height:40px;border:black;background:black;color:white;text-align:right;"/></p>
<p><input type='button' name='add' value='' style="position:absolute;margin-top:571px;margin-left:493px;width:12px;height:12px;opacity:0;"/></p>
<p><input type='button' name='subtract' value='' style="position:absolute;margin-top:586px;margin-left:493px;width:12px;height:12px;opacity:0;"/></p>
</form>
<script type="text/javascript">
with( document.getElementById( 'f4' ) )
incrementButtons( add, subtract, qty );
</script>
<form id="f5" style="position:absolute;">
<p><input class="form-control transparent-input" type='text' name='qty' id='qty' value='0' readonly='readonly' style="position:absolute;font-family:verdana;font-weight:bold;margin-top:574px;margin-left:513px;width:55px;height:40px;border:black;background:black;color:white;text-align:right;"/></p>
<p><input type='button' name='add' value='' style="position:absolute;margin-top:572px;margin-left:580px;width:12px;height:12px;opacity:0;"/></p>
<p><input type='button' name='subtract' value='' style="position:absolute;margin-top:586px;margin-left:580px;width:12px;height:12px;opacity:0;"/></p>
</form>
<script type="text/javascript">
with( document.getElementById( 'f5' ) )
incrementButtons( add, subtract, qty );
</script>
<div id="basic-modal-content" style="position:absolute;margin-top:221px;margin-left:132px;z-index:0;">
<img width="395" height="320" src="assets/img/video1.png" alt="image" />
</div>
<input type="button" id="video" class="buttona" style="margin-top:596px;margin-left:61px;width:80px;height:31px;" value="Video" />
<div id="video" style="position:absolute;margin-top:227px;margin-left:165px;z-index:1;">
<video id="video1" width="330" height="294" autoplay>
<source src="assets/audio/E20.mp4" type="video/mp4" />
<source src="assets/audio/E20.ogg" type="video/ogg" />
<source src="assets/audio/E20.webm" type="video/webm" />
Your browser does not support the video element.
</video></div>
<button id="reset" class="buttona" style="margin-top:596px;margin-left:184px;width:80px;height:31px;">Reset</button>
</div>
</div>
</div>
</div><!--End VLab Container-->
</body>
</html>

Unless the "incomplete work" / "incomplete job" is something that won't compile OR is flagged in the source code with "FIX ME" or "TO DO" tags (or the like), then I don't see how NetBeans or any other tool could distinguish between what is incomplete, and what is not.
There are tools that can detect some kinds of bug by analysing the source code, but I don't expect that that is what you mean by "incomplete".

Related

How to set a object's field using another objects field in thymeleaf

I'm trying to set boxes' elements copied from medicineBox's values like below. Can anyone help me in this. I need to post medicineOrder model to the controller
<tr th:each="medicineBox : ${medicine.medicineBoxes}">
<td class="text-center">
<input type="text" th:field="*{boxes[__${medicineBoxStat.index}__].boxNumber}" th:value="${medicineBox.box.number}" />
</td>
<td class="text-center" th:text="${medicineBox.medicineCount}"></td>
<td><input type="number" th:field="*{boxes[__${medicineBoxStat.index}__].medicineCount}" class="form-control" /></td>
</tr>
I'm using two object here -
medicine and medicineOrder
------------------> Controller method to get the page
#GetMapping("/{medicineId}")
public String loadMedicineDetailPage(#PathVariable("medicineId") long medicineId, Model model) {
model.addAttribute("medicine", service.getMedicineById(medicineId));
model.addAttribute("medicineOrder", new MedicineOrder());
return WebPages.MEDICINE_DETAIL.toString();
}
------------------> thymeleaf html page
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="ISO-8859-1"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Spring Boot Application</title>
</head>
<body>
<div class="container">
<br/>
<a class="btn btn-primary" th:href="#{/mvc/medicine/list}">Back</a>
<br/>
<br/>
<h3 class="text-center alert alert-success">Medicine Details</h3>
<form class="row g-3" action="#" th:action="#{/mvc/medicine/sell}" method="post" th:object="${medicineOrder}">
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="name" class="form-label">Name</label>
<input type="text" style="background-color:#95edea" disabled class="form-control" id="name" th:field="${medicine.name}"/>
</div>
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="company" class="form-label">Company</label>
<input type="text" disabled class="form-control" id="company" th:field="${medicine.companyStringName}"/>
</div>
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="price" class="form-label">Price</label>
<input type="text" disabled class="form-control" id="price" th:field="${medicine.price}"/>
</div>
<!--<div class="col-md-6 col-xs-12 col-sm-12">
<label for="count" class="form-label">Count</label>
<input type="text" class="form-control" id="count" th:field="${medicine.count}"/>
</div>-->
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="volume" class="form-label">ML</label>
<input type="text" disabled class="form-control" id="volume" th:field="${medicine.volume}"/>
</div>
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="purchaseDate" class="form-label">Date Purchased</label>
<input type="text" disabled class="form-control" id="purchaseDate" th:field="${medicine.purchaseDate}"/>
</div>
<!--<div class="col-md-6 col-xs-12 col-sm-12">
<label for="boxNo" class="form-label">Box Number</label>
<input type="text" class="form-control" id="boxNo" th:field="${medicine.boxNumber}"/>
</div>-->
**<input type="hidden" th:field="*{medicineId}" th:value="${medicine.medicineId}"/>**
<table class="table table-bordered">
<tr class="table-primary">
<td>Box Number</td>
<td>Medicine Count</td>
<td>Sell Count</td>
</tr>
<tr th:each="medicineBox : ${medicine.medicineBoxes}">
<td class="text-center">
**<input type="text" th:field="*{boxes[__${medicineBoxStat.index}__].boxNumber}" th:value="${medicineBox.box.number}"** />
</td>
<td class="text-center" th:text="${medicineBox.medicineCount}"></td>
<td><input type="number" th:field="*{boxes[__${medicineBoxStat.index}__].medicineCount}" class="form-control" /></td>
</tr>
</table>
<button class="btn btn-primary" type="submit">Sell</button>
</form>
</div>
</body>
</html>
---------------> Controller method to handle the post request
#PostMapping("/sell")
public String sellMedicine(#ModelAttribute MedicineOrder medicineOrder, BindingResult bindingResult) {
if(bindingResult.hasErrors()){
// error handling
}
service.sellMedicine(medicineOrder);
return "redirect:/mvc/medicine/list";
}
----------------> Class MedicineOrder
package com.example.demo.dto;
import com.example.demo.model.Box;
import java.util.ArrayList;
import java.util.List;
public class MedicineOrder {
private long medicineId;
private List<OrderedBox> boxes = new ArrayList<>();
public long getMedicineId() {
return medicineId;
}
public void setMedicineId(long medicineId) {
this.medicineId = medicineId;
}
public List<OrderedBox> getBoxes() {
return boxes;
}
public void setBoxes(List<OrderedBox> boxes) {
this.boxes = boxes;
}
#Override
public String toString() {
return "MedicineOrder{" +
"medicineId=" + medicineId +
", boxes=" + boxes +
'}';
}
}
package com.example.demo.dto;
public class OrderedBox {
private String boxNumber;
private int medicineCount;
public String getBoxNumber() {
return boxNumber;
}
public void setBoxNumber(String boxNumber) {
this.boxNumber = boxNumber;
}
public int getMedicineCount() {
return medicineCount;
}
public void setMedicineCount(int medicineCount) {
this.medicineCount = medicineCount;
}
#Override
public String toString() {
return "OrderedBox{" +
"boxNumber='" + boxNumber + '\'' +
", medicineCount=" + medicineCount +
'}';
}
}
Not able to get the MedicineOrder.medicineId and medicineBorder.boxes[*].boxNumber from template to model object.
After lot of searching I didn't find any answer which is solving the issue only using thymeleaf.
To solve this issue I had to add two hidden input field for medicineId and boxNumber on medicineOrder object and populate those input field using javascript as below. Anyway if anyone find the solution by only using thymeleaf, please let me know.
Populated those fields using javascript
<script>
function function__02__number__assignment(_element){
var __element = _element.children[0];
var __tElement1 = __element.children[0];
var __tElement2 = __element.children[1];
// Copy value from 2 to 1
__tElement1.value = __tElement2.value;
}
function function__01__box_traverse(){
var rootElement = document.getElementsByClassName('box-stock-details');
for(var __i=0 ; __i < rootElement.length ; __i++) {
function__02__number__assignment(rootElement[__i]);
}
function_01_01_medicineId();
return true;
}
function function_01_01_medicineId(){
var _00_1_id_src = document.getElementById('00-1-id-src');
var _00_1_id_dest = document.getElementById('00-1-id-dest');
_00_1_id_dest.value = _00_1_id_src.value;
}
</script>
updated template file
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="ISO-8859-1"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Spring Boot Application</title>
</head>
<body>
<div class="container">
<br/>
<a class="btn btn-primary" th:href="#{/mvc/medicine/list}">Back</a>
<br/>
<br/>
<h3 class="text-center alert alert-success">Medicine Details</h3>
<form class="row g-3" action="#" th:action="#{/mvc/medicine/sell}" method="post" th:object="${medicineOrder}">
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="name" class="form-label">Name</label>
<input type="text" style="background-color:#95edea" disabled class="form-control" id="name" th:field="${medicine.name}"/>
</div>
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="company" class="form-label">Company</label>
<input type="text" disabled class="form-control" id="company" th:field="${medicine.companyStringName}"/>
</div>
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="price" class="form-label">Price</label>
<input type="text" disabled class="form-control" id="price" th:field="${medicine.price}"/>
</div>
<!--<div class="col-md-6 col-xs-12 col-sm-12">
<label for="count" class="form-label">Count</label>
<input type="text" class="form-control" id="count" th:field="${medicine.count}"/>
</div>-->
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="volume" class="form-label">ML</label>
<input type="text" disabled class="form-control" id="volume" th:field="${medicine.volume}"/>
</div>
<div class="col-md-6 col-xs-12 col-sm-12">
<label for="purchaseDate" class="form-label">Date Purchased</label>
<input type="text" disabled class="form-control" id="purchaseDate" th:field="${medicine.purchaseDate}"/>
</div>
<!--<div class="col-md-6 col-xs-12 col-sm-12">
<label for="boxNo" class="form-label">Box Number</label>
<input type="text" class="form-control" id="boxNo" th:field="${medicine.boxNumber}"/>
</div>-->
<!-- Hidden input to get the value of medicineId from Medicine object -->
<input id="00-1-id-src" type="hidden" th:value="${medicine.medicineId}"/>
<!-- Hidden input to set the medicineId on MedicineOrder object -->
<input id="00-1-id-dest" type="hidden" th:field="*{medicineId}" />
<table class="table table-bordered">
<tr class="table-primary">
<td>Box Number</td>
<td>Medicine Count</td>
<td>Sell Count</td>
</tr>
<tr class="box-stock-details" th:each="medicineBox : ${medicine.medicineBoxes}">
<td class="text-center">
<input hidden th:field="*{boxes[__${medicineBoxStat.index}__].boxNumber}" />
<input disabled class="form-control" type="text" th:value="${medicineBox.box.number}" />
</td>
<td class="text-center" th:text="${medicineBox.medicineCount}"></td>
<td><input type="number" th:field="*{boxes[__${medicineBoxStat.index}__].medicineCount}" class="form-control" /></td>
</tr>
</table>
<button class="btn btn-primary" type="submit" onclick="return function__01__box_traverse()">Sell</button>
</form>
</div>
</body>
<script>
function function__02__number__assignment(_element){
var __element = _element.children[0];
var __tElement1 = __element.children[0];
var __tElement2 = __element.children[1];
// Copy value from 2 to 1
__tElement1.value = __tElement2.value;
}
function function__01__box_traverse(){
var rootElement = document.getElementsByClassName('box-stock-details');
for(var __i=0 ; __i < rootElement.length ; __i++) {
function__02__number__assignment(rootElement[__i]);
}
function_01_01_medicineId();
return true;
}
function function_01_01_medicineId(){
var _00_1_id_src = document.getElementById('00-1-id-src');
var _00_1_id_dest = document.getElementById('00-1-id-dest');
_00_1_id_dest.value = _00_1_id_src.value;
}
</script>
</html>

Freemarker wrong page view

I meet a problem.
I download Bootstrap design for my project. When I unzip design to package and run a page everything is displayed correctly.
Then I copy html's pages and resources(css, js, images) to my project. Then I refactor index.html to index.ftl and run my project, the index page displayed a wrong view.
I haven't got any errors and warnings in Console and Network(in Chrome).
Freemarker can't displayed page correctly?
MainController.java
#Controller
public class MainController {
#Autowired
CategoryService categoryService;
#RequestMapping("/")
public String home() {
return "redirect:/index";
}
#RequestMapping("/index")
public String showIndex(Model model) {
model.addAttribute("categories", categoryService.getAllMainCategories());
return "index";
}
}
index.html (and .ftl)
<!DOCTYPE html>
<html>
<head>
<title>Grocery Store | Home</title>
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- //for-mobile-apps -->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- font-awesome icons -->
<link href="css/font-awesome.css" rel="stylesheet" type="text/css" media="all" />
<!-- //font-awesome icons -->
<!-- js -->
<script src="js/jquery-1.11.1.min.js"></script>
<!-- //js -->
<link href='//fonts.googleapis.com/css?family=Ubuntu:400,300,300italic,400italic,500,500italic,700,700italic' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
<!-- start-smoth-scrolling -->
<script type="text/javascript" src="js/move-top.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
});
});
</script>
<!-- start-smoth-scrolling -->
</head>
<body>
<!-- header -->
<div class="agileits_header">
<div class="w3l_offers">
Today's special Offers !
</div>
<div class="w3l_search">
<form action="#" method="post">
<input type="text" name="Product" value="Search a product..." onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Search a product...';}" required="">
<input type="submit" value=" ">
</form>
</div>
<div class="product_list_header">
<form action="#" method="post" class="last">
<fieldset>
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="display" value="1" />
<input type="submit" name="submit" value="View your cart" class="button" />
</fieldset>
</form>
</div>
<div class="w3l_header_right">
<ul>
<li class="dropdown profile_details_drop">
<i class="fa fa-user" aria-hidden="true"></i><span class="caret"></span>
<div class="mega-dropdown-menu">
<div class="w3ls_vegetables">
<ul class="dropdown-menu drp-mnu">
<li>Login</li>
<li>Sign Up</li>
</ul>
</div>
</div>
</li>
</ul>
</div>
<div class="w3l_header_right1">
<h2>Contact Us</h2>
</div>
<div class="clearfix"> </div>
</div>
<!-- script-for sticky-nav -->
<script>
$(document).ready(function() {
var navoffeset=$(".agileits_header").offset().top;
$(window).scroll(function(){
var scrollpos=$(window).scrollTop();
if(scrollpos >=navoffeset){
$(".agileits_header").addClass("fixed");
}else{
$(".agileits_header").removeClass("fixed");
}
});
});
</script>
<!-- //script-for sticky-nav -->
<div class="logo_products">
<div class="container">
<div class="w3ls_logo_products_left">
<h1><span>Grocery</span> Store</h1>
</div>
<div class="w3ls_logo_products_left1">
<ul class="special_items">
<li>Events<i>/</i></li>
<li>About Us<i>/</i></li>
<li>Best Deals<i>/</i></li>
<li>Services</li>
</ul>
</div>
<div class="w3ls_logo_products_left1">
<ul class="phone_email">
<li><i class="fa fa-phone" aria-hidden="true"></i>(+0123) 234 567</li>
<li><i class="fa fa-envelope-o" aria-hidden="true"></i>store#grocery.com</li>
</ul>
</div>
<div class="clearfix"> </div>
</div>
</div>
<!-- //header -->
<!-- banner -->
<div class="banner">
<div class="w3l_banner_nav_left">
<nav class="navbar nav_bottom">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header nav_2">
<button type="button" class="navbar-toggle collapsed navbar-toggle1" data-toggle="collapse" data-target="#bs-megadropdown-tabs">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-megadropdown-tabs">
<ul class="nav navbar-nav nav_1">
<li>Branded Foods</li>
<li>Households</li>
<li class="dropdown mega-dropdown active">
Veggies & Fruits<span class="caret"></span>
<div class="dropdown-menu mega-dropdown-menu w3ls_vegetables_menu">
<div class="w3ls_vegetables">
<ul>
<li>Vegetables</li>
<li>Fruits</li>
</ul>
</div>
</div>
</li>
<li>Kitchen</li>
<li>Short Codes</li>
<li class="dropdown">
Beverages<span class="caret"></span>
<div class="dropdown-menu mega-dropdown-menu w3ls_vegetables_menu">
<div class="w3ls_vegetables">
<ul>
<li>Soft Drinks</li>
<li>Juices</li>
</ul>
</div>
</div>
</li>
<li>Pet Food</li>
<li class="dropdown">
Frozen Foods<span class="caret"></span>
<div class="dropdown-menu mega-dropdown-menu w3ls_vegetables_menu">
<div class="w3ls_vegetables">
<ul>
<li>Frozen Snacks</li>
<li>Frozen Nonveg</li>
</ul>
</div>
</div>
</li>
<li>Bread & Bakery</li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
</div>
<div class="w3l_banner_nav_right">
<section class="slider">
<div class="flexslider">
<ul class="slides">
<li>
<div class="w3l_banner_nav_right_banner">
<h3>Make your <span>food</span> with Spicy.</h3>
<div class="more">
Shop now
</div>
</div>
</li>
<li>
<div class="w3l_banner_nav_right_banner1">
<h3>Make your <span>food</span> with Spicy.</h3>
<div class="more">
Shop now
</div>
</div>
</li>
<li>
<div class="w3l_banner_nav_right_banner2">
<h3>upto <i>50%</i> off.</h3>
<div class="more">
Shop now
</div>
</div>
</li>
</ul>
</div>
</section>
<!-- flexSlider -->
<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="screen" property="" />
<script defer src="js/jquery.flexslider.js"></script>
<script type="text/javascript">
$(window).load(function(){
$('.flexslider').flexslider({
animation: "slide",
start: function(slider){
$('body').removeClass('loading');
}
});
});
</script>
<!-- //flexSlider -->
</div>
<div class="clearfix"></div>
</div>
<!-- banner -->
<div class="banner_bottom">
<div class="wthree_banner_bottom_left_grid_sub">
</div>
<div class="wthree_banner_bottom_left_grid_sub1">
<div class="col-md-4 wthree_banner_bottom_left">
<div class="wthree_banner_bottom_left_grid">
<img src="images/4.jpg" alt=" " class="img-responsive" />
<div class="wthree_banner_bottom_left_grid_pos">
<h4>Discount Offer <span>25%</span></h4>
</div>
</div>
</div>
<div class="col-md-4 wthree_banner_bottom_left">
<div class="wthree_banner_bottom_left_grid">
<img src="images/5.jpg" alt=" " class="img-responsive" />
<div class="wthree_banner_btm_pos">
<h3>introducing <span>best store</span> for <i>groceries</i></h3>
</div>
</div>
</div>
<div class="col-md-4 wthree_banner_bottom_left">
<div class="wthree_banner_bottom_left_grid">
<img src="images/6.jpg" alt=" " class="img-responsive" />
<div class="wthree_banner_btm_pos1">
<h3>Save <span>Upto</span> $10</h3>
</div>
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="clearfix"> </div>
</div>
<!-- top-brands -->
<div class="top-brands">
<div class="container">
<h3>Hot Offers</h3>
<div class="agile_top_brands_grids">
<div class="col-md-3 top_brand_left">
<div class="hover14 column">
<div class="agile_top_brand_left_grid">
<div class="tag"><img src="images/tag.png" alt=" " class="img-responsive" /></div>
<div class="agile_top_brand_left_grid1">
<figure>
<div class="snipcart-item block" >
<div class="snipcart-thumb">
<img title=" " alt=" " src="images/1.png" />
<p>fortune sunflower oil</p>
<h4>$7.99 <span>$10.00</span></h4>
</div>
<div class="snipcart-details top_brand_home_details">
<form action="checkout.html" method="post">
<fieldset>
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="business" value=" " />
<input type="hidden" name="item_name" value="Fortune Sunflower Oil" />
<input type="hidden" name="amount" value="7.99" />
<input type="hidden" name="discount_amount" value="1.00" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="return" value=" " />
<input type="hidden" name="cancel_return" value=" " />
<input type="submit" name="submit" value="Add to cart" class="button" />
</fieldset>
</form>
</div>
</div>
</figure>
</div>
</div>
</div>
</div>
<div class="col-md-3 top_brand_left">
<div class="hover14 column">
<div class="agile_top_brand_left_grid">
<div class="agile_top_brand_left_grid1">
<figure>
<div class="snipcart-item block" >
<div class="snipcart-thumb">
<img title=" " alt=" " src="images/3.png" />
<p>basmati rise (5 Kg)</p>
<h4>$11.99 <span>$15.00</span></h4>
</div>
<div class="snipcart-details top_brand_home_details">
<form action="#" method="post">
<fieldset>
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="business" value=" " />
<input type="hidden" name="item_name" value="basmati rise" />
<input type="hidden" name="amount" value="11.99" />
<input type="hidden" name="discount_amount" value="1.00" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="return" value=" " />
<input type="hidden" name="cancel_return" value=" " />
<input type="submit" name="submit" value="Add to cart" class="button" />
</fieldset>
</form>
</div>
</div>
</figure>
</div>
</div>
</div>
</div>
<div class="col-md-3 top_brand_left">
<div class="hover14 column">
<div class="agile_top_brand_left_grid">
<div class="agile_top_brand_left_grid_pos">
<img src="images/offer.png" alt=" " class="img-responsive" />
</div>
<div class="agile_top_brand_left_grid1">
<figure>
<div class="snipcart-item block">
<div class="snipcart-thumb">
<img src="images/2.png" alt=" " class="img-responsive" />
<p>Pepsi soft drink (2 Ltr)</p>
<h4>$8.00 <span>$10.00</span></h4>
</div>
<div class="snipcart-details top_brand_home_details">
<form action="#" method="post">
<fieldset>
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="business" value=" " />
<input type="hidden" name="item_name" value="Pepsi soft drink" />
<input type="hidden" name="amount" value="8.00" />
<input type="hidden" name="discount_amount" value="1.00" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="return" value=" " />
<input type="hidden" name="cancel_return" value=" " />
<input type="submit" name="submit" value="Add to cart" class="button" />
</fieldset>
</form>
</div>
</div>
</figure>
</div>
</div>
</div>
</div>
<div class="col-md-3 top_brand_left">
<div class="hover14 column">
<div class="agile_top_brand_left_grid">
<div class="agile_top_brand_left_grid_pos">
<img src="images/offer.png" alt=" " class="img-responsive" />
</div>
<div class="agile_top_brand_left_grid1">
<figure>
<div class="snipcart-item block">
<div class="snipcart-thumb">
<img src="images/4.png" alt=" " class="img-responsive" />
<p>dogs food (4 Kg)</p>
<h4>$9.00 <span>$11.00</span></h4>
</div>
<div class="snipcart-details top_brand_home_details">
<form action="#" method="post">
<fieldset>
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="business" value=" " />
<input type="hidden" name="item_name" value="dogs food" />
<input type="hidden" name="amount" value="9.00" />
<input type="hidden" name="discount_amount" value="1.00" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="return" value=" " />
<input type="hidden" name="cancel_return" value=" " />
<input type="submit" name="submit" value="Add to cart" class="button" />
</fieldset>
</form>
</div>
</div>
</figure>
</div>
</div>
</div>
</div>
<div class="clearfix"> </div>
</div>
</div>
</div>
<!-- //top-brands -->
<!-- fresh-vegetables -->
<div class="fresh-vegetables">
<div class="container">
<h3>Top Products</h3>
<div class="w3l_fresh_vegetables_grids">
<div class="col-md-3 w3l_fresh_vegetables_grid w3l_fresh_vegetables_grid_left">
<div class="w3l_fresh_vegetables_grid2">
<ul>
<li><i class="fa fa-check" aria-hidden="true"></i>All Brands</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Vegetables</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Fruits</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Juices</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Pet Food</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Bread & Bakery</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Cleaning</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Spices</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Dry Fruits</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Dairy Products</li>
</ul>
</div>
</div>
<div class="col-md-9 w3l_fresh_vegetables_grid_right">
<div class="col-md-4 w3l_fresh_vegetables_grid">
<div class="w3l_fresh_vegetables_grid1">
<img src="images/8.jpg" alt=" " class="img-responsive" />
</div>
</div>
<div class="col-md-4 w3l_fresh_vegetables_grid">
<div class="w3l_fresh_vegetables_grid1">
<div class="w3l_fresh_vegetables_grid1_rel">
<img src="images/7.jpg" alt=" " class="img-responsive" />
<div class="w3l_fresh_vegetables_grid1_rel_pos">
<div class="more m1">
Shop now
</div>
</div>
</div>
</div>
<div class="w3l_fresh_vegetables_grid1_bottom">
<img src="images/10.jpg" alt=" " class="img-responsive" />
<div class="w3l_fresh_vegetables_grid1_bottom_pos">
<h5>Special Offers</h5>
</div>
</div>
</div>
<div class="col-md-4 w3l_fresh_vegetables_grid">
<div class="w3l_fresh_vegetables_grid1">
<img src="images/9.jpg" alt=" " class="img-responsive" />
</div>
<div class="w3l_fresh_vegetables_grid1_bottom">
<img src="images/11.jpg" alt=" " class="img-responsive" />
</div>
</div>
<div class="clearfix"> </div>
<div class="agileinfo_move_text">
<div class="agileinfo_marquee">
<h4>get <span class="blink_me">25% off</span> on first order and also get gift voucher</h4>
</div>
<div class="agileinfo_breaking_news">
<span> </span>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="clearfix"> </div>
</div>
</div>
</div>
<!-- //fresh-vegetables -->
<!-- newsletter -->
<div class="newsletter">
<div class="container">
<div class="w3agile_newsletter_left">
<h3>sign up for our newsletter</h3>
</div>
<div class="w3agile_newsletter_right">
<form action="#" method="post">
<input type="email" name="Email" value="Email" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email';}" required="">
<input type="submit" value="subscribe now">
</form>
</div>
<div class="clearfix"> </div>
</div>
</div>
<!-- //newsletter -->
<!-- footer -->
<div class="footer">
<div class="container">
<div class="col-md-3 w3_footer_grid">
<h3>information</h3>
<ul class="w3_footer_grid_list">
<li>Events</li>
<li>About Us</li>
<li>Best Deals</li>
<li>Services</li>
<li>Short Codes</li>
</ul>
</div>
<div class="col-md-3 w3_footer_grid">
<h3>policy info</h3>
<ul class="w3_footer_grid_list">
<li>FAQ</li>
<li>privacy policy</li>
<li>terms of use</li>
</ul>
</div>
<div class="col-md-3 w3_footer_grid">
<h3>what in stores</h3>
<ul class="w3_footer_grid_list">
<li>Pet Food</li>
<li>Frozen Snacks</li>
<li>Kitchen</li>
<li>Branded Foods</li>
<li>Households</li>
</ul>
</div>
<div class="col-md-3 w3_footer_grid">
<h3>twitter posts</h3>
<ul class="w3_footer_grid_list1">
<li><label class="fa fa-twitter" aria-hidden="true"></label><i>01 day ago</i><span>Non numquam http://sd.ds/13jklf#
eius modi tempora incidunt ut labore et
http://sd.ds/1389kjklf#quo nulla.</span></li>
<li><label class="fa fa-twitter" aria-hidden="true"></label><i>02 day ago</i><span>Con numquam http://fd.uf/56hfg#
eius modi tempora incidunt ut labore et
http://fd.uf/56hfg#quo nulla.</span></li>
</ul>
</div>
<div class="clearfix"> </div>
<div class="agile_footer_grids">
<div class="col-md-3 w3_footer_grid agile_footer_grids_w3_footer">
<div class="w3_footer_grid_bottom">
<h4>100% secure payments</h4>
<img src="images/card.png" alt=" " class="img-responsive" />
</div>
</div>
<div class="col-md-3 w3_footer_grid agile_footer_grids_w3_footer">
<div class="w3_footer_grid_bottom">
<h5>connect with us</h5>
<ul class="agileits_social_icons">
<li><i class="fa fa-facebook" aria-hidden="true"></i></li>
<li><i class="fa fa-twitter" aria-hidden="true"></i></li>
<li><i class="fa fa-google-plus" aria-hidden="true"></i></li>
<li><i class="fa fa-instagram" aria-hidden="true"></i></li>
<li><i class="fa fa-dribbble" aria-hidden="true"></i></li>
</ul>
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="wthree_footer_copy">
<p>© 2016 Grocery Store. All rights reserved | Design by W3layouts</p>
</div>
</div>
</div>
<!-- //footer -->
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$(".dropdown").hover(
function() {
$('.dropdown-menu', this).stop( true, true ).slideDown("fast");
$(this).toggleClass('open');
},
function() {
$('.dropdown-menu', this).stop( true, true ).slideUp("fast");
$(this).toggleClass('open');
}
);
});
</script>
<!-- here stars scrolling icon -->
<script type="text/javascript">
$(document).ready(function() {
/*
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/
$().UItoTop({ easingType: 'easeOutQuart' });
});
</script>
<!-- //here ends scrolling icon -->
<script src="js/minicart.js"></script>
<script>
paypal.minicart.render();
paypal.minicart.cart.on('checkout', function (evt) {
var items = this.items(),
len = items.length,
total = 0,
i;
// Count the number of each item in the cart
for (i = 0; i < len; i++) {
total += items[i].get('quantity');
}
if (total < 3) {
alert('The minimum order quantity is 3. Please add more to your shopping cart before checking out');
evt.preventDefault();
}
});
</script>
</body>
</html>
Images hosting:
link html page view (correct)
https://ibb.co/frTcaw
ling ftl page view (wrong)
https://ibb.co/fLUpoG
project structure:
-web app
-css
-js
-fonts
-images
-WEB-INF
-view
-ftl
index.ftl
Paths to css, fonts and js in ftl page is true.
How can I make a correct view?

parsing the html code - unable to get the expected data

I am working on JSoup API in java to read the html content and get the link stored in the tag. Below is the html code, i want to get the link stored inside the following tag <a onClick="javascript:RefreshPageTo(event, &quot...)"> near <td class="ms-paging">1 - 15</td>; in the below html code.
html data to read the filenames (readData.html):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
<html dir="ltr" class="ms-isBot" lang="en-US">
<head>
<meta name="GENERATOR" content="Microsoft SharePoint" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>
ALL ELP REPORTS
</title>
<!-- === Favicon / Windows Tile ==================================================================== -->
<link rel="shortcut icon" href=" " type="image/vnd.microsoft.icon" id="favicon" />
<meta name="msapplication-TileImage" content=" " />
<meta name="msapplication-TileColor" content="#0072C6" />
<script type="text/javascript" src=" "></script>
<link rel="stylesheet" type="text/css" href=" " />
<link id="CssRegistration1" rel="stylesheet" type="text/css" href=" " />
<link id="CssRegistration2" rel="stylesheet" type="text/css" href=" 0" />
<script type="text/javascript">CallASP("one.js");
</script>
<script type="text/javascript">RegisterSod("strings.js", "\u002f_layouts\u002f15\u002f1033\u002fstrings.js?rev=cG2ZohQxWuyz1\u00252BF2exRTjA\u00253D\u00253D");RegisterSodDep("strings.js", "initstrings.js");
<link type="text/xml" rel="alternate" href="/_asd.xls" />
<!-- Additional header placeholder =========================== -->
<link rel="alternate" type="application/rss+xml" title="Documents" href="/_layouts/15/listfeed.aspx?List=573d80cd%2D44f6%2D47b4%2D942f%2Da12a5a1841cb" />
<span id="analytics">
<script language="JavaScript" type="text/javascript">
<noscript>
<div class="noindex">
You may be trying to access this site from a secured browser on the server. Please enable scripts and reload this page.
</div>
</noscript>
<!-- ===== SP IDs / Prefetch SP images / SP Form =========================================================================== -->
<div id="imgPrefetch" style="display:none">
<img src="/_layouts/15/images/spcommon.png" />
</div>
<form method="post" action="./AllItems.aspx?RootFolder=%2fShared+Documents%2f08.Test+Report%2fMY20+Test+Reports%2fSanity%2fRaw+Data&FolderCTID=0x0120003C2FB175ACD9FE42B875BA259F53A6E3&View=%7bF8BC514C-49A5-47A2-8A6D-52DF70D61AE7%7d" id="aspnetForm">
<input type="hidden" name="_wpcmWpid" id="_wpcmWpid" value="" />
<input type="hidden" name="wpcmVal" id="wpcmVal" value="" />
<input type="hidden" name="MSOWebPartPage_PostbackSource" id="MSOWebPartPage_PostbackSource" value="" />
</script>
<div id="ctl00_ctl47_asdasd" class="asdaBrandMenu">
<!-- =============Suite Bar Links ======================-->
<div id="DeltaSuiteLinks" class="ms-core-deltaSuiteLinks">
<div id="suiteLinksBox">
<div id="SuiteLinksHidden" style="display: none">
</div>
<div id="launcherIconContainer">
</div>
<span style="display:none">
<menu type="ServerMenu" id="zz1_ID_PersonalActionMenu" hideicons="true">
<ie:menuitem id="zz2_ID_MyProfile" type="option" onmenuclick="" text="My Profile" menugroupid="100"></ie:menuitem>
<ie:menuitem id="zz3_ID_Logout" type="option" onmenuclick="" text="Sign Out" description="Logout of this site." menugroupid="100"></ie:menuitem>
</menu></span>
<span id="zz4_Menu_t" class="ms-menu-althov ms-welcome-root" title="Open Menu" onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)" hoveractive="ms-menu-althov-active ms-welcome-root ms-welcome-hover" hoverinactive="ms-menu-althov ms-welcome-root" onclick=" CoreInvoke('MMU_Open',byid('zz1_ID_PersonalActionMenu'), MMU_GetMenuFromClientId('zz4_Menu'),event,true, null, 0); return false;" foa="MMU_GetMenuFromClientId('zz4_Menu')" oncontextmenu="ClkElmt(this); return false;" style="white-space:nowrap"><a class="ms-core-menu-root" id="zz4_Menu" accesskey="/" href="javascript:;" title="Open Menu" onfocus="MMU_EcbLinkOnFocusBlur(byid('zz1_ID_PersonalActionMenu'), this, true);" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz1_ID_PersonalActionMenu'), MMU_GetMenuFromClientId('zz4_Menu'), event);" onclick=" CoreInvoke('MMU_Open',byid('zz1_ID_PersonalActionMenu'), MMU_GetMenuFromClientId('zz4_Menu'),event,true, null, 0); return false;" oncontextmenu="ClkElmt(this); return false;" menutokenvalues="MENUCLIENTID=zz4_Menu,TEMPLATECLIENTID=zz1_ID_PersonalActionMenu" serverclientid="zz4_Menu">Bhavani Borra<span class="ms-accessible">Use SHIFT+ENTER to open the menu (new window).</span></a><span style="height:4px;width:7px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust ms-viewselector-arrow ms-menu-stdarw ms-core-menu-arrow"><img src="/_catalogs/theme/Themed/EB5E82F/spcommon-B35BB0A9.themedpng?ctag=3" alt="Open Menu" style="position:absolute;left:-95px !important;top:-259px !important;" /></span><span style="height:4px;width:7px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust ms-core-menu-arrow ms-viewselector-arrow ms-menu-hovarw"><img src="/_catalogs/theme/Themed/EB5E82F/spcommon-B35BB0A9.themedpng?ctag=3" alt="Open Menu" style="position:absolute;left:-86px !important;top:-259px !important;" /></span></span>
</div>
<!-- ======== Start: Site Actions menu ============= -->
<div id="suiteBarButtons">
<span class="ms-siteactions-root" id="siteactiontd"> <span style="display:none">
<menu type="ServerMenu" id="zz5_FeatureMenuTemplate1" hideicons="true">
<ie:menuitem id="zz6_MenuItem_ShareThisSite" type="option" onmenuclick="" description="See who's here and invite new people." menugroupid="100"></ie:menuitem>
<ie:menuitem id="zz7_MenuItem_ViewAllSiteContents" type="option" iconsrc="" onmenuclick="STSNavigate2(event,'/_layouts/15/viewlsts.aspx');" text="Site contents" description="View all libraries and lists in this site." menugroupid="200"></ie:menuitem>
</menu></span><span id="zz8_SiteActionsMenu_t" class="ms-siteactions-normal" title="Settings" onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)" hoveractive="ms-siteactions-normal ms-siteactions-hover" hoverinactive="ms-siteactions-normal">
<a class="ms-core-menu-root" id="zz8_SiteActionsMenu" accesskey="/" href="javascript:;" title="Settings" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz5_FeatureMenuTemplate1'), MMU_GetMenuFromClientId('zz8_SiteActionsMenu'));" menutokenvalues="MENUCLIENTID=zz8_SiteActionsMenu,TEMPLATECLIENTID=zz5_FeatureMenuTemplate1" serverclientid="zz8_SiteActionsMenu"><span class="ms-siteactions-imgspan"><img class="ms-core-menu-buttonIcon" src="/_catalogs/theme/Themed/EB5E82F/Settings-white-94FE89A9.themedpng?ctag=3" alt="Settings" title="Settings" /></span><span class="ms-accessible">Use SHIFT+ENTER to open the menu (new window).</span></a></span> </span>
</div>
<!-- ================== End: Site Actions Menu ============================================ -->
<!-- ================== IT Help Link ============================================ -->
<div class="ms-core-listMenu-verticalBox">
</div>
</div>
</div>
</div>
<!-- ===== Main Content ========================================================================================== -->
<tr class="ms-alternating ms-itmhover" iid="47,1430,0">
<td class="ms-vb-itmcbx ms-vb-firstCell"><input type="checkbox" class="s4-itm-cbx" /></td>
<td class="ms-vb-icon"><img border="0" alt="ECS-dailyTask.xls" title="ECS-dailyTask.xls" src="" /></td>
<td height="100%" onmouseover="OnChildItem(this)" class="ms-vb-title">
<div class="ms-vb itx" onmouseover="OnItem(this)" ctxname="ctx47" id="1430" field="LinkFilename" perm="0x1b03c4312ef" eventtype="">
<a onfocus="OnLink(this)" href="/MyDocuments/ECS-dailyTask.xls" onmousedown="">ECS-dailyTask</a>
</div>
<div class="s4-ctx" onmouseover="OnChildItem(this.parentNode); return false;">
<span> </span>
<a onfocus="OnChildItem(this.parentNode.parentNode); return false;" onclick="" href="javascript:;" title="Open Menu"></a>
<span> </span>
</div></td>
<td class="ms-vb2">
<nobr>
3/31/2013 11:04 AM
</nobr></td>
<tr class="ms-alternating ms-itmhover" iid="47,1429,0">
<td class="ms-vb-itmcbx ms-vb-firstCell"><input type="checkbox" class="s4-itm-cbx" /></td>
<td class="ms-vb-icon"><img border="0" alt="ECS-MontlhyTask.xls" title="ECS-MontlhyTask.xls" src="/_layouts/15/images/icxls.png?rev=23" /></td>
<td height="100%" onmouseover="OnChildItem(this)" class="ms-vb-title">
<div class="ms-vb itx" onmouseover="OnItem(this)" ctxname="ctx47" id="1429" field="LinkFilename" perm="0x1b03c4312ef" eventtype="">
<a onfocus="OnLink(this)" href="/MyDocs/ECS-MontlhyTask.xls" onmousedown="">ECS-MontlhyTask</a>
</div>
<div class="s4-ctx" onmouseover="OnChildItem(this.parentNode); return false;">
<span> </span>
<a onfocus="" onclick="" href="javascript:;" title="Open Menu"></a>
<span> </span>
</div></td>
<td class="ms-vb2">
<nobr>
7/24/2016 10:09 PM
</nobr></td>
<td class="ms-vb-user"><span class="ms-noWrap"><span class="ms-imnSpan"><a href="#" onclick="" class="ms-imnlink ms-spimn-presenceLink">
<span class="ms-spimn-presenceWrapper ms-imnImg ms-spimn-imgSize-10x10">
<img name="imnmark" class="" title="" showofflinepawn="1" src="" alt="No presence information" id="imn_16532,type=sip" />
</span></a></span><span class="ms-noWrap ms-imnSpan">
<img name="imnmark" class="ms-hide" title="" showofflinepawn="1" src="" alt=""/>
<a class="ms-subtleLink" onclick="" href="/_layouts/15/userdisp.aspx?ID=113">ASDF</a></span></span></td>
</tr>
..
...
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="ms-bottompaging" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:pcm="urn:PageContentManager" xmlns:ddwrt2="urn:frontpage:internal">
<tbody>
<tr>
<td class="ms-bottompagingline1"><img src="/_images/11/images/blank.gif?rev=40" width="1" height="1" alt="" /></td>
</tr>
<tr>
<td class="ms-bottompagingline2"><img src="/_images/11/images/blank.gif?rev=40" width="1" height="1" alt="" /></td>
</tr>
<tr>
<td class="ms-vb" id="bottomPagingCellWPQ2" align="center">
<table>
<tbody>
<tr>
<td class="ms-paging">1 - 15</td>
<td><a onclick="javascript:RefreshPageTo(event, "/sites/myAppDetail/My%20Documents/Forms/AllApplicationss.aspx?Paged=TRUE&p_SortBehavior=0&p_FileLeafRef=LT%5fSW%20TEAM%5fNatural%5fItemCode%5f20170909%5fvstatus%2epdf&p_ID=85&RootFolder=%2fmyData%2fFolder3%2fCommon%20Docs%2fdaily%20Report%2f2017&PageFirstRow=16&&View={05465DFA-110E-21FC-8AD6-8B9846567FF8B}");javascript:return false;" href="javascript:"><img src="/_layouts/15/1011/images/next.gif" border="0" alt="Next" /></a></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
sample java code(not giving the expected output):
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.File;
import java.io.IOException;
public class ReadFileNamesFromHTMLContent {
public static void main(String args[]) throws IOException {
File input = new File("readData.html");
Document doc = Jsoup.parse(input, "UTF-8");
Elements links = doc.select(".ms-paging > td > a"); //get the value stored inside <a onClick="javascript:RefreshPageTo(event, &quot...)"> near <td class="ms-paging">1 - 15</td>;
System.out.println("size : "+ links.size()); //0
for (Element link : links) {
System.out.println(link);//empty, it should print the link
}
}
}
Output for the above code:
size:0
Expected output:
"/sites/myAppDetail/My%20Documents/Forms/AllApplicationss.aspx?Paged=TRUE&p_SortBehavior=0&p_FileLeafRef=LT%5fSW%20TEAM%5fNatural%5fItemCode%5f20170909%5fvstatus%2epdf&p_ID=85&RootFolder=%2fmyData%2fFolder3%2fCommon%20Docs%2fdaily%20Report%2f2017&PageFirstRow=16&&View={05465DFA-110E-21FC-8AD6-8B9846567FF8B}&quot
Any suggestions on how to get the expected output would be helpful.
PS: Should not modify the html code.
Here is your HTML:
<td class="ms-paging">1 - 15</td>
<td><a onclick="javascript:RefreshPageTo(event, "/sites/myAppDetail/My%20Documents/Forms/AllApplicationss.aspx?Paged=TRUE&p_SortBehavior=0&p_FileLeafRef=LT%5fSW%20TEAM%5fNatural%5fItemCode%5f20170909%5fvstatus%2epdf&p_ID=85&RootFolder=%2fmyData%2fFolder3%2fCommon%20Docs%2fdaily%20Report%2f2017&PageFirstRow=16&&View={05465DFA-110E-21FC-8AD6-8B9846567FF8B}");javascript:return false;" href="javascript:"><img src="/_layouts/15/1011/images/next.gif" border="0" alt="Next" /></a></td>
But your selector is
Elements links = doc.select(".ms-paging > td > a");
However, the td element with the javascript onclick attribute is not a child of the td that you select. So you need to select only the links. Maybe try something like this:
Elements links = doc.select("td > a[onclick]");

Ajax not working when I am trying to save data

When I press the save button ajax does not work.The page reloads.Here is my indx page and my Controller function.
URL is --- http://localhost:8082/spring-test/index
Controller
#RequestMapping(value = "/saveUser", method = RequestMethod.POST)
public String saveUser(#Valid #ModelAttribute("User") User user, BindingResult bindingResult,
ModelMap model, HttpServletRequest request, RedirectAttributes redirectAttrs) {
System.out.println("user: " + user.getUserId());
String type = request.getParameter("update") != null ? request.getParameter("update") : "";
String delete = request.getParameter("delete") != null ? request.getParameter("delete") : "";
if (type.equalsIgnoreCase("update") || delete.equalsIgnoreCase("delete")) {
User userDb = userService.getUserById(user.getUserId());
user.setUserId(userDb.getUserId());
}
if (bindingResult.hasErrors()) {
System.out.println("=====================error======================" + bindingResult.getFieldErrors());
return "index";
}
if (delete.equalsIgnoreCase("delete")) {
userService.deleteUser(user.getUserId());
} else {
userService.saveUser(user);
}
//model.clear();
model.clear();
return "redirect:/index";
}
index.html
<html xmlns:th="http://www.thymeleaf.org" xmlns:tiles="http://www.thymeleaf.org" class="no-js">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css" />
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function() {
$('#myTable').DataTable();
$('#btnSave').click(function(e) {
var dataUser = $("#name").val();
var dataPass = $("#pwd").val();
var userDdata = {
"name": dateUser,
"pass": dataPass
}
$.ajax({
type: "POST",
url: "/spring-test/saveUser",
data: userData,
success: function(response) {
alert(1)
},
error: function(e) {
alert('Error: ' + e);
}
});
}
});
</script>
</head>
<body>
<div class="container col-sm-12 col-md-12" style="height:20px;background:#85a3e0;">
</div>
<div class="container col-sm-12 col-md-12">
<h3 class="text-center">Super Admin</h3>
<div class="col-md-4 col-sm-4" style="margin-left: 6%;">
<form class="form-horizontal" role="form" th:action="#{/saveUser}" th:object="${user}" method="post">
<div class="form-group">
<label class="control-label col-sm-3" for="pwd">Username:</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="name" placeholder="Enter Name" th:field="*{userName}" />
<input type="hidden" th:field="*{userId}" />
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="pwd">Password:</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="pwd" placeholder="Enter password" th:field="*{password}" />
</div>
</div>
<div class="form-group">
<div class=" col-sm-12 text-right">
<button type="submit" class="btn btn-default" name="cancel" value="cancel">Cancel</button>
<button id="btnSave" type="submit" class="btn btn-primary" name="save" value="save">Save</button>
<button type="submit" class="btn btn-primary" name="update" value="update">Update</button>
<button type="submit" class="btn btn-primary" name="delete" value="delete">Delete</button>
</div>
</div>
</form>
</div>
</div>
</body>
</html>
Whats the problem here.
After adding the ajax function my dataTable is not appearing also.
Since you already have an action( th:action="#{/saveUser}") for the form submit, it will send the data directly, not via AJAX. In order to make it worked, you need to prevent this default behavior as like below.
$('#btnSave').click(function(e) {
e.preventDefault()
//Then do your stuff
});
It is not working because you have submit button and it directly submits the form.
What you can do it simply remove type="submit" from button and then try.
Vinod
Just try the below
<html xmlns:th="http://www.thymeleaf.org" xmlns:tiles="http://www.thymeleaf.org" class="no-js">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css" />
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function() {
$('#myTable').DataTable();
$('#btnSave').click(function(e) {
var userData = $("#form1").serializeArray();
$.ajax({
type: "POST",
url: "/spring-test/saveUser",
data: userData,
success: function(response) {
alert(1)
},
error: function(e) {
alert('Error: ' + e);
}
});
}
});
</script>
</head>
<body>
<div class="container col-sm-12 col-md-12" style="height:20px;background:#85a3e0;">
</div>
<div class="container col-sm-12 col-md-12">
<h3 class="text-center">Super Admin</h3>
<div class="col-md-4 col-sm-4" style="margin-left: 6%;">
<form class="form-horizontal" role="form" id="form1" th:action="#{/saveUser}" th:object="${user}" method="post">
<div class="form-group">
<label class="control-label col-sm-3" for="pwd">Username:</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="name" placeholder="Enter Name" th:field="*{userName}" />
<input type="hidden" th:field="*{userId}" />
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="pwd">Password:</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="pwd" placeholder="Enter password" th:field="*{password}" />
</div>
</div>
</form>
<div class="form-group">
<div class=" col-sm-12 text-right">
<button type="submit" class="btn btn-default" name="cancel" value="cancel">Cancel</button>
<button id="btnSave" type="button" class="btn btn-primary" name="save" value="save">Save</button>
<button type="submit" class="btn btn-primary" name="update" value="update">Update</button>
<button type="submit" class="btn btn-primary" name="delete" value="delete">Delete</button>
</div>
</div>
</div>
</div>
</body>
</html>

Struts 1 ActionForm - retrieving a collection from pure HTML

Hi all I have (just like the rest) inherited some struts 1 code. I have had need to add a few more pages to this project.
What I cannot figure out is how to map several distinct but similarly natured input elements to my ActionForm.
Let me elaborate. I create a new <Input> element dynamically as the user inputs more and more items (I use the YUI autocomplete form element and for each entered input I add it as an input element to my form and draw a new YUI autocomplete - complex sounding, I know)
So... My form looks a bit like (... after some prettifying and some such...):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>My Cool App - Test Case Builder</title>
<link rel="stylesheet" type="text/css" href="../script/yui/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="../skins/myCoolApp/button/button.css" />
<link rel="stylesheet" type="text/css" href="../script/yui/autocomplete/assets/skins/sam/autocomplete.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../skins/myCoolApp/testcase.css" />
<!-- YUI JAVA SCRIPTS -->
<script type="text/javascript" src="../script/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="../script/yui/element/element-min.js"></script>
<script type="text/javascript" src="../script/yui/button/button-min.js"></script>
<script type="text/javascript" src="../script/yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="../script/yui/autocomplete/autocomplete-min.js"></script>
<!-- APP JAVA SCRIPTS -->
<script type="text/javascript" src="../script/myCoolApp/myCoolApp.js" ></script>
<script type="text/javascript" src="../script/myCoolApp/stack.js" ></script>
<script type="text/javascript" src="../script/myCoolApp/testcase/testcase.js"></script>
<script type="text/javascript" src="../script/myCoolApp/testcase/default-data.js" ></script>
<script type="text/javascript" src="../script/myCoolApp/testcase/data-structs.js" ></script>
<script type="text/javascript" src="../script/myCoolApp/testcase/ui-elements.js" ></script>
</head>
<body class="cf010">
<div id="wrap">
<div id="header">
<div id="main-header">
COOL APP
</div>
</div>
<div id="main-body">
<div id="content">
<div class="col main">
<div id="main">
<form method="post" id="testcaseForm" class="typea" action="">
<fieldset>
<legend>Test Case Builder</legend>
<div id="tk1" class="tabcontrol">
<ul class="tabs">
<li class="first active">
<a href="#">
<span>General</span>
</a>
</li>
<li class="last">
<a href="#">
<span>Parameters</span>
</a>
</li>
</ul>
<div id="tab0" class="tc-panel">
<dl class="cls9">
<dt>
<label for="scenario">Choose Scenario:</label>
</dt>
<dd>
<input type="text" id="scenario" name="scenario" class="text" />
<span id="scenarioToggle"></span>
<div class="auto-complete" id="scenarioContainer"></div>
</dd>
<dt>
<label for="ruleID">Choose Rule ID:</label>
</dt>
<dd>
<input type="text" id="ruleID" name="ruleID" class="text" />
<span id="ruleIDToggle"></span>
<div class="auto-complete" id="ruleIDContainer"></div>
</dd>
<dt>
<label for="Test Case Name" accesskey="t"><span class="accesskey">T</span>est Case Name:</label>
</dt>
<dd>
<input type="text" id="testCaseName" name="testCaseName" class="text" />
</dd>
</dl>
</div>
<div id="tab1" class="tc-panel hidden">
<div class="toolbar" id="action-bar">
<ul>
<li class="first">
<a title="select all" href="#" id="btmSelectAll" class="button">
<span>select all</span>
</a>
</li>
<li>
<a title="remove row" href="#" id="btmRemove" class="button">
<span>remove row</span>
</a>
</li>
<li>
<a title="undo last" href="#" id="btmRollBack" class="button disabled">
<span>undo last</span>
</a>
</li>
<li class="last">
<a title="accept row" href="#" id="btmAccept" class="button disabled">
<span>accept row</span>
</a>
</li>
</ul>
</div>
<div id="param.list" class="gridclip">
<table id='param.list.tbl' class='grid modela' >
<caption>Test Case Summary</caption>
<col/><col/><col/>
<thead>
<tr>
<th class='hl center first'>
<input class='grid-select-all' type='checkbox' />
<th>
<th scope='col'>Row</th>
<th scope='col'>Parameter</th>
<th scope='col' class='last'>Value</th>
</tr>
</thead>
<tfoot>
<tr>
<th scope='row'>Total</th>
<td colspan='3'>2 parameters as Test Case input</td>
</tr>
</tfoot>
<tbody id='param.list.tbl.body'>
<tr class='odd'>
<td class='rowcheck center first'>
<input value='param1###value1' id='cb1' name='SelectedRows' class='grid-select-row' type='checkbox'/>
</td>
<td class='id'>1</td>
<td>param1</td>
<td class='last'>value1</td>
</tr>
<tr class='even'>
<td class='rowcheck center first'>
<input value='param2###value2' id='cb2' name='SelectedRows' class='grid-select-row' type='checkbox'/>
</td>
<td class='id'>2</td>
<td>param2</td>
<td class='last'>value2</td>
</tr>
<tr class='odd'>
<td class='rowcheck center first' />
<td class='id'><em>new</em></td>
<td>
<dl class='clsTable'>
<dt>
<input type='text' id='param' name='param' class='text paramInput' />
</dt>
<dd>
<span id='paramToggle' />
</dd>
<div class='auto-complete' id='paramContainer' />
</dl>
</td>
<td class='last'>
<dl class='clsTable'>
<dt>
<input type='text' id='value' name='value' class='text valueInput' />
</dt>
</dl>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div> <!-- tabcontrol -->
</fieldset>
<div class="submit-box">
<input type="submit" name="formRun" id="formRun" class="form-save"
value="Execute" accesskey="x" title="Run: Press Alt + [Shift] + x" />
<input type="submit" name="formSave" id="formSave"
value="Save" accesskey="s" title="Save: Press Alt + [Shift] + s" />
<input type="submit" name="formLoad" id="formLoad"
value="Load" accesskey="l" title="Load: Press Alt + [Shift] + l" />
<input type="submit" name="formCancel" id="formCancel" class="form-cancel"
value="Cancel" accesskey="c" title="Cancel: Press Alt + [Shift] + c" />
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
As you can see the following is pretty much a duplicate:
<tr class='odd'>
<td class='rowcheck center first'>
<input value='param1###value1' id='cb1' name='SelectedRows' class='grid-select-row' type='checkbox'/>
</td>
<td class='id'>1</td>
<td>param1</td>
<td class='last'>value1</td>
</tr>
<tr class='even'>
<td class='rowcheck center first'>
<input value='param2###value2' id='cb2' name='SelectedRows' class='grid-select-row' type='checkbox'/>
</td>
<td class='id'>2</td>
<td>param2</td>
<td class='last'>value2</td>
</tr>
The relevant part of my stuts-config.xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<data-sources />
<form-beans>
<form-bean name="TestCaseForm" type="com.blahblah.mycoolapp.forms.TestCaseForm" />
</form-beans>
<action-mappings>
<action path="/pages/SaveTestCase" name="TestCaseForm"
type="org.springframework.web.struts.DelegatingActionProxy" scope="request">
</action>
</action-mappings>
<message-resources parameter="MessageResources" />
</struts-config>
I also use spring 2.56 (The relevant part being):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean name="/pages/SaveTestCase" class="com.blahblah.mycoolapp.actions.TestCaseBuilderSaveAction" />
</beans>
My Java ActionForm class (from what I had learned off the net) is:
package com.blahblah.mycoolapp.forms;
import java.util.ArrayList;
import java.util.List;
import org.apache.struts.action.ActionForm;
public class TestCaseForm extends ActionForm {
private static final long serialVersionUID = 2352146257739099766L;
private String scenario;
private String ruleID;
private String testCaseName;
private List<String> SelectedRows = new ArrayList<String>() ;
public String getScenario() {
return scenario;
}
public void setScenario(String scenario) {
this.scenario = scenario;
}
public String getRuleID() {
return ruleID;
}
public void setRuleID(String ruleID) {
this.ruleID = ruleID;
}
public String getTestCaseName() {
return testCaseName;
}
public void setTestCaseName(String testCaseName) {
this.testCaseName = testCaseName;
}
public List<String> getSelectedRows() {
return SelectedRows;
}
public void setSelectedRows(int index, String value) {
this.SelectedRows.add(value);
}
}
The question is why do I get an empty SelectedRows in my TestCaseBuilderSave Action?
Thanks all who have the patience to read such a long question...
and (hopefully) thanks to all you potential saviors :)
EDIT 1:
Due to #ahiru's request I post my action class which - for the time being is just a stripped down. almost do nothing, class:
public class TestCaseBuilderSaveAction extends Action {
#Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition","attachment;filename=superfish.xml");
try
{
ServletOutputStream out = response.getOutputStream();
String contentStr = "<Yaneeve>Has been here...</Yaneeve>";
byte[] bytes = contentStr.getBytes();
out.write(bytes, 0, bytes.length);
out.flush();
out.close();
}catch(Exception e){
e.printStackTrace();
}
return null;
}
}
I'm not a struts master or anything but can struts handle building a List out of the inputs? Would it rather be better to use an array of strings? Also have you tried adding a method in your form?
public void setSelectedRows(List<String> list) { SelectedRows = list;}
I think there is a way to define a indexed input in the struts config.
--update
Could you possibly post your action class where you are trying to get these values?
I know you said that the method above does not work but here is what works for me in a similar situation (I think). Sorry I can't find the exact code but here is what I remember:
-ActionForm
private String[] strings;
public void setStrings(String[] strings) { this.strings = strings;}
public String[] getStrings() { return strings; }
jsp/html/whatever
<input type="text" value="x" name="strings[]">
<input type="text" value="y" name="strings[]">
<input type="text" value="z" name="strings[]">
I'm also curious if spring and struts play together nicely (i've done no research on this)
It seems as if the problem had been that the checkboxes had not been 'checked'.
Only 'checked' checkboxes get their value transferred to the server...
One thing I wish to emphasize is that I had converted my code to be like what #ahiru suggested:
private String[] strings;
public void setStrings(String[] strings) { this.strings = strings;}
public String[] getStrings() { return strings; }

Categories