<JSP> How to display one data from multiple row - sql

I have a query that gives me 3 data under 1 parameter. Following is query.
Query
SELECT
VQ_CD
, FILE_NM
FROM
TB_POT_ECD_VQ_INFO
WHERE
PRCS_SNO = '1'
When I run the query, the data I get is..
PRCS_SNO VQ_CD FILE_NM
1 500K A
1 1000K B
1 2000K C
And in JSP page, I want to display all three data.
What I did in JSP is this.
Oh, table is being called encVqList.
JSP
<td class="typeFD bgN"">
<c:set var="V500K" value="" />
<c:forEach var="encVqList" items="${encVqList}" >
<input type="text" id="500K" name="500K" value="<c:out value="${encVqList.fileNm}" />"/>
</c:forEach>
<td class="typeFD bgN"">
<c:set var="V1000K" value="" />
<c:forEach var="encVqList" items="${encVqList}" >
<input type="text" id="1000K" name="1000K" value="<c:out value="${encVqList.fileNm}" />"/>
</c:forEach>
<td class="typeFD bgN"">
<c:set var="V2000K" value="" />
<c:forEach var="encVqList" items="${encVqList}" >
<input type="text" id="2000K" name="2000K" value="<c:out value="${encVqList.fileNm}" />"/>
</c:forEach>
And did the same thign for 1000K and 2000K. But it doesn't work.
I think I should distinguish each input box does not recognize which one since it has 3 data under 1 same parameter. So can anyone help?

<td class="typeFD bgN"">
<c:forEach var="encVqList" items="${encVqList}" >
<c:choose>
<c:when test="${encVqList.VQ_CD eq '500K'}">
<input type="text" id="500K" name="500K" value="<c:out value='${encVqList.fileNm}' />" />
</c:when>
<c:when test="${encVqList.VQ_CD eq 'V1000K'}">
<input type="text" id="1000K" name="1000K" value="<c:out value='${encVqList.fileNm}' />" />
</c:when>
<c:otherwise>
<input type="text" id="2000K" name="2000K" value="<c:out value='${encVqList.fileNm}' />" />
<c:otherwise>
</c:choose>
</c:forEach>
</td>

Related

How to find xpath for text contains and select check box in that row using selenium IDE

I've 3 rows in my table and I want to select a check box that contains text 1024.0281. I can find text contains part number like this
xpath=//a[text()='1024.0281']
But I don't know how to select checkbox in that line, How to do that?
I'm trying to do this in Selenium IDE.
Thank you in advance!
<tbody>
<tr class="odd">
<td><input class=RightText name='DHR' type='checkbox' id='Chk_DHR0' value='1^310^0^^^^' onClick=javascript:fnCalcDHRAmt( 'Chk_DHR0',this.form) tabindex="8"><input type=hidden name='hDHRID0' value='GM-DHR-200789551'> <input type=hidden name='hVID0' value='334'> <input type='hidden' value='0' name='hDHRAmtGMDHR200789551'></td>
<td>PS-1876546</td>
<td><a title="7.5mm REVERE HA Monoaxial Screw, 27mm">1024.0131</a></td>
</tr>
<tr class="even">
<td><input class=RightText name='DHR' type='checkbox' id='Chk_DHR1' value='1^465^0^^^^' onClick=javascript:fnCalcDHRAmt( 'Chk_DHR1',this.form) tabindex="9"><input type=hidden name='hDHRID1' value='GM-DHR-200789552'> <input type=hidden name='hVID1' value='334'> <input type='hidden' value='0' name='hDHRAmtGMDHR200789552'></td>
<td>PS-1876546</td>
<td><a title="8.5mm REVERE HA Monoaxial Screw, 25mm">1024.0281</a></td>
</tr>
<tr class="odd">
<td><input class=RightText name='DHR' type='checkbox' id='Chk_DHR2' value='1^1000^0^^^^' onClick=javascript:fnCalcDHRAmt( 'Chk_DHR2',this.form) tabindex="10"><input type=hidden name='hDHRID2' value='GM-DHR-200789553'> <input type=hidden name='hVID2' value='334'> <input type='hidden' value='0' name='hDHRAmtGMDHR200789553'></td>
<td>PS-1876546</td>
<td><a title="REVERE 4.5 Thoracic Lamina Hook, Narrow, Medium">1041.9902</a></td>
</tr>
</tbody>
Use the following xpath which will select the tr based on anchor text and then find the input checkbox.
//tr[.//a[text()='1024.0281']]//input[#class='RightText']
Or use preceding
//a[text()='1024.0281']/preceding::input[#name='DHR'][1]

Jquery dynamically added inputs to form have not POST data PHP

I'm adding <input> fields in form using jquery html() on click event.
$('#container').html('<input type="text" name="ce" value="some" >');
after submitting php POST i'm unable to see index ce with print_r($_POST);
is there any special method to add elements to dom for this ? please advise.
Solved ! Thanks for answering. in my scenario even with append it didn't work. now it's done with my previous code using html(). Problem was wrapping the <form>. my table is large i'm only pointing out the problem. my structure was suppose to like:
<table>
<tr>
<form id="myform">
<td><input type="text" name="name" ></td>
<td>
<div id="container">
<!-- dynamically generated inside this div against it's id (which didn't work) -->
<input type="text" name="ce" >
</div>
</td>
</form>
</tr>
</table>
i simply Put the entire table into the 'form' tags
<form id="myform">
<table>
<tr>
<td><input type="text" name="name" ></td>
<td>
<div id="container">
<input type="text" name="ce" > <!-- dynamically generated inside div (works!) -->
</div>
</td>
</tr>
</table>
</form>
it worked perfectly with both append() and html(). hope will be helpful for someone.
When you do $('#container').html you are not adding a new input, you are replacing all your content with this new input..
try $('#container').append tag
Look at this example -> https://jsfiddle.net/660a3t1g/
$('#myInputs').append('<input type="text" placeholder="LastName: " name="some" >');

wamp local server, blank page returned after submitting button

Input code:
<form method="post" action="input.php" enctype="multipart/form-data">
<tr align="center">
<td><input required="required" type="text" class="inp" name="nume" size="30" style="text-align: center" placeholder="Introdu aici numele tău">
</td>
</tr>
<tr align="center">
<td><br /><br /><font face ="Impact" size="6">Selectaţi una din opţiunile de mai jos:<br/></font>
<br /><br /><br /><select name="motiv" class="inp2">
<option class="inp2" value="ridicare produs">Vreau să ridic un produs</option>
<option class="inp2" value="predare produs" selected>Vreau să predau un produs</option>
<option class="inp2" value="factura storno">Vreau să ridic factura storno</option>
<option class="inp2" value="reclamatie">Vreau să fac o sesizare</option>
<option class="inp2" value="informatii">Vreau să adresez o întrebare</option>
</select>
</td>
</tr>
<tr align="center">
<td><br /><br /><br /><input type="submit" name="submit" class="buttons" value="MĂ ÎNREGISTREZ"></td> </tr>
</table>
</form>
input.php code:
<? //the example of inserting data with variable from HTML form //input.php
require 'db.php';
$nume = $_POST['nume']; $motiv = $_POST['motiv']; //inserting data order $order = "INSERT INTO flux_receptie (motiv, nume_client) VALUES ('$motiv', '$nume')";
//declare in the order variable $result = mysql_query($order); //order executes if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=index2.php\">"; } else { echo "<meta http-equiv=\"refresh\" content=\"0;URL=www.sss.ro\">"; } ?>
If I press submit button, it shows me a blank page with:
; } else { echo ""; } ?>
I am using Wamp web local server. Does anyone know what is the problem? Thank you :)

How to Get Ticket In Gatling using Correlation

This is the Gatling recorder script.
val httpProtocol = http
// LaunchURL
.baseURL("https://mywebsite/instance")
.acceptHeader("*/*")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("en-US,en;q=0.5")
.connection("keep-alive")
.userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:26.0) Gecko/20100101 Firefox/26.0")
// Login
.exec(http("request_6")
.post("""/cas/login;jsessionid=cN7KK9FvXzsqWjmLxL2M5xjk.undefined?service=https://mywebsite/instance/index.jsp""")
.headers(headers_6)
.param("""username""", """abc""")
.param("""password""", """abcpwd""")
.param("""lt""", """LT-828-wppjtrEoGU6gj9UVFt3soVqQ3mLMwe""")
.param("""execution""", """e1s1""")
.param("""_eventId""", """submit""")
.param("""submit""", """LOGIN"""))
.pause(10)
If we see these three lines:
.param("""username""", """abc""")
.param("""password""", """abcpwd""")
.param("""lt""", """LT-828-wppjtrEoGU6gj9UVFt3soVqQ3mLMwe""")
We will use parametrization for username and password. these are input values we can get from a csv file while running the test. Here "lt" is the parameter for ticket. it was generated by CAS when we Launch the URL.
The following code is the portion of BaseURL response.
<table width="100%">
<tr>
<td>
<label for="username" class="fl-label"><span class="accesskey">U</span>sername:</label>
<input id="username" name="username" class="required" tabindex="1" accesskey="u" type="text" value="" size="25" autocomplete="false"/>
</td>
</tr>
<tr>
<td>
<label for="password" class="fl-label"><span class="accesskey">P</span>assword:</label>
<input id="password" name="password" class="required" tabindex="2" accesskey="p" type="password" value="" size="25" autocomplete="off"/>
</td>
</tr>
<tr>
<td>
<input id="warn" name="warn" value="true" tabindex="3" accesskey="w" type="checkbox" />
<label for="warn"><span class="accesskey">W</span>arn me before logging me into other sites.</label>
<input type="hidden" name="lt" value="LT-828-wppjtrEoGU6gj9UVFt3soVqQ3mLMwe" />
<input type="hidden" name="execution" value="e1s1" />
<input type="hidden" name="_eventId" value="submit" />
</td>
</tr>
<tr>
<td>
<input class="btn-submit" name="submit" accesskey="l" value="LOGIN" tabindex="4" type="submit" />
<input class="btn-reset" name="reset" accesskey="c" value="CLEAR" tabindex="4" type="reset" />
</td>
</tr>
</table>
Here CAS generated ticket "LT-828-wppjtrEoGU6gj9UVFt3soVqQ3mLMwe" in BaseURL Response. Here, I need to extract ticket from the BaseURL Response and use this ticket in Login request.
Previous i extracted ticket using regular expression in Jmeter as name="lt" value="(.*?)" from BaseURL Response.
Please help me how to extract ticket in Gatling.
and can u please tell me how to correlate View states also.
Thanks & Regards
Narasimha
First of all, you will need to make a first GET request to your service as such:
http("getLogin")
.get(casUrl)
Considering the casUrl val contains the path to your actual service, then, and only then, will you be able to retrieve the information you need, let's say, with a css expression:
http("getLogin")
.get(casUrl)
.check(css("input[name='lt']", "value").saveAs("lt"))
Checkers are used to extract data from the body of a request. The saveAs is the important part. It will allow you to record data into gatling's session.
You can reuse it this way:
http("postLogin")
.post(...)
...
.param("lt", "${lt}")
The brackets are also mandatory : it notices Gatling to try and search in the session the value associated with the key lt.
Here is a full example based on your script:
val casUrl = "/cas/login;jsessionid=cN7KK9FvXzsqWjmLxL2M5xjk.undefined?service=https://mywebsite/instance/index.jsp"
val httpProtocol = http
// LaunchURL
.baseURL("https://mywebsite/instance")
.acceptHeader("*/*")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("en-US,en;q=0.5")
.connection("keep-alive")
.userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:26.0) Gecko/20100101 Firefox/26.0")
// Login
.exec(
http("getLogin")
.get(casUrl)
.check(css("input[name='lt']", "value").saveAs("lt")))
.exec(
http("postLogin")
.post(casUrl)
.headers(headers_6)
.param("username", "abc")
.param("password", "abcpwd")
.param("lt", "${lt}")
.param("execution", "e1s1")
.param("_eventId", "submit")
.param("submit", "LOGIN"))
I took the liberty to remove the triple quotes, which are not necessary in this use case.

How to render a Zend_Form_Element_MultiCheckbox form an array?

I need to render a MultiCheckbox like below:
Wanted:
<label>
<input type="checkbox" name="privacy[read_only]" value="1" /> Just for read only
</label>
<label>
<input type="checkbox" name="privacy[is_pulic]" value="1" /> Is public
</label>
How can I do that? I just can do with:
Unwanted:
<label>
<input type="checkbox" name="privacy[]" value="read_only" /> Just for read only
</label>
<label>
<input type="checkbox" name="privacy[]" value="is_pulic" /> Is public
</label>
Thanks so much for any your ideas.
If there was nothing else in your form, or you didn't mind each form element having the same format, you could use setElementsBelongTo($array) which is a method on a Zend_Form.
You might also then have to use individual checkboxes to acheive the desired markup, so this may or may not work in your scenario.