select multiple double side - java

i want to do a select multiple double side
like this : http://www.senamion.com/blog/jmultiselect2side.html (Demo2)
but i don't know how i can retrieve my data when i click submit button..?

It looks like, assuming your select has the name "secondSelect[]" as per the demo page, the two generated selects will have the names "secondSelectms2side__sx" and "secondSelectms2side__dx"
So it is these names you should be looking for in the request object

Related

Hiding information for a particular user

I am using RESTFUL webservices using Spring framework.Some information is displayed on the user interface using the data returned by webservices. There is a webservice, which gets the usernames and their roles from the database. For a particular user , I would like to have all the webservices display data in the form of ####,#### for first name,lastname ; ##/##/#### for date of birth etc. Since I am using JDBC to connect to the database, here's what I was thinking of doing:
Should I consider passing an additional parameter (maybe sending a value 0 or 1 ; 0 for all other users and 1 for user for which I want to hide the information) to each and every GET webservice so that when it comes to getting data from the database in the JDBC code part,I could check whether the flag is set to 1 or 0 and based on this, I could do something like this in the JDBC code :
// Code for a case when flag is set to `0`. Hence retrieving information from the database.
while(rs.next()) {
EmployeeList empList = new EmployeeList();
empList.setEmpId(empId);
empList.setEmployeeName(rs.getString("name"));
employeeList.add(empList);
}
// Code for a case when flag is set to `1`. Hence hiding information and not retrieving information from the database.
while(rs.next()) {
EmployeeList empList = new EmployeeList();
empList.setEmpId(empId);
empList.setEmployeeName("####,######");
employeeList.add(empList);
}
I am wondering, if this is an appropriate way to achieve my task or is there some other way around?
Edit:More clarifications on my requirements:
I am using jqxWidget in the UI to display the information I am getting from a RESTFUL webservice in JSON format. For example, let's consider this example and the screenshot for better understanding of my requirement:
1) Let's say I am getting all the information from the JSON response which I am populating in the jQXWidget as shown in the screenshot above.
2) In the above widget, I would like to hide say for example, First Name, Last Name and Quantity like the following:
First Name = XXXXX
Last Name = XXXXX
Quantity = ####
In my application, if a user clicks on a particular row , a new page is displayed with some additional information. After click, new sets of web services are called and those web services takes First Name, Last Name and Quantity as input parameters. My concern is that, if I somehow replace the First Name with XXXXX, Last Name with XXXXX and Quantity with #### using any approach, when a user clicks on any of the row of the widget, the next set of web services
are going to get XXXX and #### as input and eventually will fail. Please correct me if my understanding until this point is not correct.
Thanks
I am using Spring 4.2.5 version.
This depends on what sort of information hiding you want to achieve. Typically you shouldn't do this manually.
You can use, for example, role-based authorization. Exact details depends on the web-service framework you are using.
For spring MVC, you can use something similar to this:
Custom authorization in Spring MVC

JSP Multiple SQL Selects

I am getting familiar with Java through involvement on a servlet web service project that is now up and running. But the stakeholders want a front end that will allow them to examine the audit table set up in a SQL server database. I am trying to quickly put one together in JSP with initial success but now stuck.
I want a drop down list to provide a list of all the users (Unique). I have acheived this using a JSTL taglib method following the link below with the following SQL;
"SELECT DISTINCT(USER_ID) FROM AUDIT_MESSAGE".
http://www.apekshit.com/t/205/JSTL-SQL-Query-Tag-Example
Now I want, when the user clicks on one of the users names it automatically populates another drop down list with a list of times that user logged in with the following SQL;
SELECT SESSION_ID, EventTIME FROM dbo.AUDIT_MESSAGE
WHERE OPERATION = 'loginResponse' AND RESULTS = 'OK'
AND USER_ID = 'firstdropdownlistselection'
Then when an item from the second drop down list option is selected a third SQL statement of;
Select * FROM dbo.AUDIT_MESSAGE
WHERE SESSION_ID = 'seconddropdownlistselection'
This is then used to populate a list box of the Users events at the selected time.
I have found the following link below offering another method but I am unsure whether to continue with the method I have started with or is there a better way. Can someone please advise me on what method would work best?
Multiple ResultSets
Thanks in advance
AJF
You could display the whole database table information(minus the ids) if this is what they want.
If you want to do it in these steps (select user, select session, display information) what you are doing is correct.

What is the best way to import an XML string into a SQL Server table

I am working with a 3rd product called JPOS and it has an XMLPackager whereby I get a string from this packager that contains a record in an XML format such as:
<MACHINE><B000>STRING_VALUE</B000><B002>STRING_VALUE</B002><B003>STRING_VALUE</B003><B004>STRING_VALUE</B004><B007>STRING_VALUE</B007><B011>STRING_VALUE</B011><B012>STRING_VALUE</B012><B013>STRING_VALUE</B013><B015>STRING_VALUE</B015><B018>STRING_VALUE</B018><B028>STRING_VALUE</B028><B032>STRING_VALUE</B032><B035>STRING_VALUE</B035><B037>STRING_VALUE</B037><B039>STRING_VALUE</B039><B041>STRING_VALUE</B041><B043>STRING_VALUE</B043><B048>STRING_VALUE</B048><B049>STRING_VALUE</B049><B058>STRING_VALUE</B058><B061>STRING_VALUE</B061><B063>STRING_VALUE</B063><B127>STRING_VALUE</B127></MACHINE>
I have a SQL server table that contains a column for each of the listed. Not that it matters but I could potentially have thru defined with specific STRING_VALUEs. I'm not sure what is the best way to go about this in Java. My understanding is that SQL Server can take an XML string (not document) and do an insert. Is it best to parse each value and then put into a list that populate each value into? This is the first time I've used an XML file and therefore trying to get some help/direction.
Thanks.
Sorry, one of my colleagues was able to help and provide a quick answer. I'll try it from my Java code and it looks like it should work great. Thanks anyway.
Here is the SP that she created whereby I can pass in my XML string and bit value:
CREATE PROCEDURE [dbo].[sbssp_InsertArchivedMessages]
(
#doc varchar(max),
#fromTo bit
)
AS
BEGIN
DECLARE #idoc int, #lastId int
EXEC sp_xml_preparedocument #idoc OUTPUT, #doc
INSERT INTO [dbo].[tblArchivedMessages]
SELECT * FROM OPENXML(#idoc, '/MACHINE', 2) WITH [dbo].[tblArchivedMessages]
SET #lastId = (SELECT IDENT_CURRENT('tblArchivedMessages'))
UPDATE [dbo].[tblArchivedMessages]
SET FromToMach = #fromTo
WHERE ID = #lastId
END
GO
Regards.

jqgrid: change value of select

I am developing a web application using JSP & Servlet (IDE: Eclipse, Database: Oracle10). I am using jqGrid to display records in tabular format.
code snippet:
{name:'CITY',index:'CITY', width:70,editable:true,edittype:"select",editoptions: {dataUrl: 'ProfileServ?action=comboCity', dataEvents: [{ type: 'change', fn: function(e) {alert(this.value);city= this.value;}}],}},
{name:'PIN',index:'PIN', width:200,sortable:false,editable:true, edittype:"select",editoptions: {dataUrl: 'ProfileServ?action=comboPin'}},
I want to change values of PIN according to the value selected in CITY. I have used dataEvents and type: 'change' to get the selected value of CITY. I am successfully getting the selected value of CITY.
My question is that how should I update the values of PIN when value of CITY is changed?
Unfortunately there is no easy way to implement dependent selects. One have to update the whole <select> of dependent select manually inside of change callback (update selects of PIN in your case). The only which I can suggest you is examining the code of the demo from the answer. It is not exactly what you need because it don't use dataUrl, but it shows what should be done.

Oracle ADF::How do I pass a parameter to named query via requestScope to another view object

Question::
How can i pass the value to parameter named “userParameter” in a query. using requestScope
Kindly help out with the steps to make a request scope work on the same page.
For now I know the following.
I have a page named UserRoomReservation
I have a data control (UserView)
Drag the first data control as a table.
convert the first column to a link
add actionlistener to that link
from: #{row.userId}
to: #{requestScope.userParameter}
I created another view object via sql query
I put a named parameter ":userParameter"
the sql query is as written below:::
SELECT DISTINCT Fullreservation.USERID,
Meetingrooms."roomName",
Meetingrooms."roomId" ,
COUNT (Fullreservation.roomid) AS countRoomUsage
FROM FULLRESERVATION Fullreservation, "meetingRooms" Meetingrooms
WHERE fullreservation.roomid = Meetingrooms."roomId"
AND Fullreservation.USERID = :userParameter
GROUP BY
Meetingrooms."roomName",
Meetingrooms."roomId",
Fullreservation.USERID
I dragged it to the same page as a graph.
but it doesn't work because the value hasn't been passed to the
You can get value from requestScope
ADFContext.getCurrent().getRequestScope().get(obj);
and then set this value in bind variable using NamedWhereClauseParam method
ViewObjectInstance.setNamedWhereClauseParam("BindVariabbleName",value);
ViewObjectInstance.executeQuery();

Categories