Show data in webpage from database [duplicate] - css

This question already has answers here:
Generate an HTML Response in a Java Servlet
(3 answers)
Show JDBC ResultSet in HTML in JSP page using MVC and DAO pattern
(6 answers)
Closed 2 years ago.
Suppose, I have updated my database by which I mean that I have inserted a new row of data in my database. Now, I want to edit my web page by that data how can I do this?
Suppose, I have three columns in my database "name", "picture" and "age" now I want to show the latest row of these columns in my HTML page with CSS applied. How can I do this please tell me the codes in terms of JSP and servlet.

First get that value in your servlets from database and then to show it in webpage
You can do two things :
Use request.setAttribute("id",value)
In the GET method of servlet,
request.setAttribute("name",value)
request.setAttribute("picture",value)
request.setAttribute("age",value)
And in the jsp, you can get these values as
request.getAttribute("name")
request.getAttribute("picture")
request.getAttribute("age")
Model
model.addAttriute("name",value)
Use JSTL library and then you get these values in jsp by:
${name}
${picture}
${age}

Related

Wijimo flex sheet not showing the column - But it shows if the all records have the values

We have a web application, Wijmo flex sheet is used for reporting purposes. One column("AddressLine2") not showing even if the value is in some records. Postgresql(AWS RDS) id our DB and Spring boot is the backend. Actually, I am expecting the column will not shows in the Wijimo report if all values are empty on the corresponding column
Please suggest a solution for this

Firebase: If a value includes a specific text in database [duplicate]

This question already has answers here:
How to perform sql "LIKE" operation on firebase?
(5 answers)
Closed 3 years ago.
I try to filter the list for items that contain a certain text.
database:
{"123":{"cities":"sss"},"445":{"cities":"hello hi dd"}}
And I want to get the items that contains "hi" within the cities value:
{"445":{"cities":"hello hi dd"}}
I tryd this:
https://xxxxx.firebaseio.com/allitems.json?orderBy="cities"&startAt="hi"
But it's not working... It only shows the items that starts with "hi"...
thanks.
At the time of writing, there is no built-in full-text search capability in the Firebase Realtime Database.
The official Cloud Functions samples include an example of full-text search with the Algolia hosted search service.
Note that there is a workaround if you search for a string that starts with some specific characters (which is different than a string which contains some specific characters).
Have a look at the "Range Queries" section of the REST API documentation:
We can combine startAt and endAt to limit both ends of our query. The
following example finds all dinosaurs whose name starts with the
letter "b":
curl
'https://dinosaur-facts.firebaseio.com/dinosaurs.json?orderBy="$key"&startAt="b"&endAt="b\uf8ff"&print=pretty'
The \uf8ff character used in the query above is a very high code point
in the Unicode range. Because it is after most regular characters in
Unicode, the query matches all values that start with a b.
So in your case you would do as follows:
https://xxxxx.firebaseio.com/allitems.json?orderBy="cities"&startAt="hi"&endAt="hi\uf8ff"

Request.ServerVariables in classic Asp [duplicate]

This question already has answers here:
How to get the referer search query from google?
(4 answers)
Closed 3 years ago.
I have this requirement: I need to save the search word made by a user who has come to my site.
The site is made in classic asp.
I have tried with:
Request.ServerVariables ("HTTP_REFERER")
Request.ServerVariables ("ALL_HTTP")
But I don't get the search query (q=) https://www.google.com/search?q=house
How can I get the value of q= ?
The following code will give you what you are looking for:
Response.Write(Split(Split(Request.ServerVariables ("HTTP_REFERER"), "?")(1),"=")(1))
For sure, you will need to adapt it : if you don't have query string, it will fail, and the parameter you are looking for needs to be the first one.

Asp.net DropDownlist with headers [duplicate]

This question already has answers here:
Dropdownlist control with <optgroup>s for asp.net (webforms)?
(12 answers)
Closed 8 years ago.
I need to display drop down list with headers
values are retriving from database
i need to display like
Maharashtra
Mumbai
Nasik
Pune
UttarPradesh
Lucknow
Meerut
Noida
Ghaziabad
Uttrakhand
Dehradun
Rishikesh
Haridwar
<asp:DropDownList> does not directly support the use of <optgroup>. You will need to ether implement your own control or use an adapter. Here is one such example: http://www.codeproject.com/Articles/15505/ASP-NET-DropDownList-with-OptionGroup-support
Another option is to use only <option> elements, but instead add fake-indent by adding extra (visible) whitespace prefixed to the Text of each ListItem.

How do I show "NEXT" x items to the user? [duplicate]

This question already has answers here:
Paging & Sorting grids with ASP.Net MVC
(5 answers)
Closed 9 years ago.
I am learning MVC. I'm creating a simple website for demo, which stores products in Database and shows them to the user 10 per page. Now, how do I fetch "NEXT" 10/20 items from the database? I thought of adding auto-increment column to table and then fetching items on its basis. Is it the right way? Also I am keeping record of how many items have been shown to the user by getting an int value as parameter to the Controller function, Products(int id). Is it the right way? I mean will it work if user is on 5th page(hence id==5) and refreshes the page?(or will it set id back to 0?).
you can use linq queries to fetch number of items in a table. you can pass number of item, start index. then the query will be like this
var nextProduct = myProducts.Skip(100).Take(10);
it will return 10 items from 101 to 110.
Fetching data based on id is not a good idea. because if u delete any record there will be a difference in the count and id. so you can take using the above code concept

Resources