Linked Questions
25 questions linked to/from How to avoid using scriptlets in my JSP page?
1773 votes
31 answers
323k views
How can I avoid Java code in JSP files, using JSP 2?
I know that something like the following three lines <%= x+1 %> <%= request.getParameter("name") %> <%! counter++; %> is an old school way of coding and in JSP version 2 ...
214 votes
9 answers
617k views
How to get parameters from the URL with JSP
In JSP how do I get parameters from the URL? For example I have a URL www.somesite.com/Transaction_List.jsp?accountID=5 I want to get the 5. Is there a request.getAttribute( "accountID" ) like there ...
24 votes
3 answers
56k views
How to URL encode a URL in JSP / JSTL?
I want to create an encoded URL for my site. Say for example, for this URL: "http://google.com/index.html" I want to give this URL to the client by URL encoding it.
14 votes
3 answers
96k views
How to call Java class in Jsp
Hi i am trying to call regular java class in jsp page and want to print some on jsp page when i am trying to do i am not getting any output Here is my code MyClass.java package Demo; public ...
3 votes
5 answers
6k views
My jsp printing 'null' instead of null
I am reading a String value from database and printing it onto a jsp page through a servlet. The Problem is that on the Jsp the String 'null' is getting printed in case the field in the database is ...
2 votes
2 answers
32k views
Date cannot be resolved to a type
I am learning debugging and I am getting the following error when running tomcat through my browser. I am using Texpad to write and I guess tomcat after. An error occurred at line: 18 in the jsp ...
0 votes
2 answers
26k views
retrieve data from database table and display it in atable with html
i am a beginer and am currently working on my final school project which require retrieving data from a database table and displaying the datas in an html page. i have searched alot but still no ...
1 vote
3 answers
3k views
What is the different between the JSP syntax and XML syntax in .jsp?
I want to ask a question about the .jsp. What is the different between using the jsp syntax (e.g. <%! .. %>) and the XML syntax (e.g. <jsp:declaration>...</jsp:declaration>). Is ...
1 vote
2 answers
3k views
How to iterate list in JSTL?
<c:forEach items="<% EasyLookUp.lookUpList(EasyLookUp.PriceSources); %>" var="priceSourceItem"> ${priceSourceItem } </...
3 votes
2 answers
3k views
How to call a javascript in HttpClient or Html Unit
I am using http client POST method to perform specific action in a website , for that it uses javascript of ajax connection which produces a requestID i.e var reqID = Math.floor(Math.random()*1000001)...
1 vote
1 answer
1k views
Detecting Key Press in jsp
I have a menu bar on a web based program that is built using jsp. Usually, my company uses java scriplets to add functionality, but I have been reading about JSTL and was wondering if there was a way ...
0 votes
1 answer
822 views
Positioning the error message in Login jsp
Am new to JSP and Servlets so please bear with me for my simple question I have designed a login page (Login.jsp) which validates the credentials entered by the user in the database and if the ...
1 vote
1 answer
998 views
assigning unique ID to HTML tag in JSP by java code
I'm creating an HTML table dynamically in a JSP using Java for loop. But when I'm trying to assign a unique id to each TD by its position in table, I get a compilation error. what I would like to do ...
1 vote
1 answer
993 views
Is there any difference between <jsp:scriptlet> and <% %>
Case 1 <% request.getParameter(""); %> Enter code here Case 2 jsp Scriptlet tag begin <jsp:scriptlet> request.getParameter(""); </jsp:scriptlet&...
0 votes
2 answers
576 views
send java class instance from javascript (via ajax) to jsp or servlet
I am trying to send the JAVA CLASS INSTANCE from my javascript code to the JSP file via ajax . How can i send ? I tried sending the instance like this : data = {} data['my_instance'] = ...