JSP

JavaServer Pages (JSP) allow the development of dynamically generated web pages. It uses the Java programming language; JSP pages are translated into servlets at runtime, with each servlet being cached and reused until the JSP is modified. JSP allows Java code to be interleaved with static web markup content, so the resulting page can be compiled and executed on the server to deliver the content.

Share tech news, updates, or what's on your mind.

Sign up to Post

Anyone knew...i had an issue .... if i have to save the timer to the server, i'll need the JavaScript to animate and increment the timer.
Have the JavaScript periodically send the value of the timer back to the server for saving so that the user can logout and login back in from anywhere and continue their timers..how????.please explain??
0
Cloud Class® Course: SQL Server Core 2016
LVL 12
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Will not display the image that retrieved from DB (as blob)  in Chrome ? But working fine with Firefox.
0
I have a jsp page using struts tag as below:
<html:form action="/actions/graphics/job/attachFile/confirm">
<html:cancel value="Cancel" styleClass="buttons"></html:cancel>
<html:submit value="Confirm"/>
</html:form>

Open in new window

     
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		ActionForward actionForward = SessionChecking.checkUserBean(mapping, request);
		if (actionForward != null)
			return actionForward;

		if (isCancelled(request))
		{
                 //do something here
                }
               //......
     }//execute

Open in new window

it works very well in production for years, now I am trying to change the looking of the button by integrating with bootstrap.
When I only changed the looking of button confirm, it looks like this:
confirm_button_only.pngat this moment, both buttons are functioning.

however, when I tried to change the looking of both buttons, it looks like this:
confirm_cancel_both.png
             <html:form action="/actions/graphics/job/attachFile/confirm">
		<button type="submit" id="cancel" name="cancel" class="btn btn-default" value="Cancel"  > Cancel</button>
		<button type = "submit" id="submit" class ="btn btn-primary" value="Confirm"> Confirm</button>
		</html:form>		

Open in new window

they both looks good, but the problem is both buttons are doing the same job, which means they both have the CONFIRM function , no more CANCEL function.

then I tried a little modification for experiment:
             <html:form action="/actions/graphics/job/attachFile/confirm">
		<button type="button" id="cancel" name="cancel" class="btn btn-default" value="Cancel"  > Cancel</button>
		<button type = "submit" id="submit" class ="btn btn-primary" value="Confirm"> Confirm</button>
		</html:form>	

Open in new window

the problem for this code is the CANCEL button does NOT work at all regardless how many time I click on it.

can anybody help me on this? all I want is just make the CANCEL button looks as big as the CONFIRM button but keep the original functioning.
I think the real question would be : how to transfer the value of CANCEL button to the HttpServletRequest such that the function isCancelled(request) can return true?
by name="cancel" ?  value="Cancel" ? or type="cancel"?
0
Hi,

I want help on getting data from sql server to Java/JSP page.  I am new to Java/jsp, and need some help with some sample code.

I have a stored proc. [getemployee] which is retrieving FirstName,LastName,EmailAddress. I need to use this stored proc on Java/jsp to show details on jsp page.

Thank you so much for help!
0
If i have a rest controller in spring boot how can I validate the contract that comes in if certain values of the parameters need to have certain values??? ANy code examples are appreciated!
0
What is the best technology to create a new shopping website? Like JSP, bootstrap, aspx, angular, PHP etc…
0
I had this question after viewing Retain the value of Drop down box in jsp.
I tried the below code but i'm getting error : alloc_Type is undefined on refresh.
<%
 String riskTypeValue = request.getParameter("riskType");
if(riskTypeValue == null)riskTypeValue = "0";

String allocTypeValue = request.getParameter("allocType");
if(allocTypeValue == null)allocTypeValue = "0";
%>

<script>
function retainValue(){
      //alert("retainValue "+alloc_Type +" && " +risk_Type);
    var element1 = document.forms[0].allocType;
    for(x = 0; x < element1.length; x++){
            if(element1.options[x].value == "<%=alloc_Type%>")
            {
                  element1.options[x].selected = true;
                  break;
            }
    }
    var element2 = document.forms[0].riskType;
    for(x = 0; x < element2.length; x++){
            if(element2.options[x].value == "<%=risk_Type%>"){
                  element2.options[x].selected = true;
                  break;
            }
    }
}
</script>


<tr>
                        <td>&nbsp;</td>
                        <td class="smalltext" width="150px"><b>Allocation Type:</b></td>
                        <td class="smalltext">
                               <select id="allocType"
                                          class="filter_smalltext" name="allocType">
                                    <c:forEach items="${dataBO.alloc_types}" var="allocTypes">
                                          <option value="${allocTypes.key}" ${ allocTypes.key eq dataBO.alloc_type ? …
0
RequestHandlerInterceptor or AccessDecisionVoter which gets called first

I'm working on spring boot application and would like to know RequestHandlerInterceptor or AccessDecisionVoter which gets invoked first
0
Where i can download a sample or demo application which has the following..Any link would be useful

1. Source code
2. Sample SQL file to populate the data in mysql table or json to populate NoSQL
3. Uses Ajax in the front-end to send and receive responses
0
We have a JSP web app (runs on Tomcat on Windows) that needs to do file read/writes.  We want to distribute the web servers, but need a central file server so we know we're going to introduce latency as it reads/writes to the shared folder (\\server\folder type sharing via SMB).

Is there some sort of document or any good articles on the latency ceiling for this?  I expects it's not a hard limit, but just that at some point the latency/bandwidth leads to the process taking longer and hence more web server resources will be consumed (from the users making the requests that lead to this read/write).  Probably mainly memory for the threads/code running while they're running.  What I'm trying to find is anything about failures.  For instance if reading a 50 k file is making calls and there's 1000 ms or 2000 ms or etc. what's the effect of that.  Is there a point (3000 ms latency) or other things of that sort at which point the read/write will generate errors (in other words timeouts and such).
0
Cloud Class® Course: Amazon Web Services - Basic
LVL 12
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

How to create a BaseDAO class for jdbcTemplate which handles the save, update and delete in generic way so that we can use the same in any entity.

for example, in sales we may have the id column as salesId, in product we have the id column as id, in inventory table we will have the id column as invId.

Assume we need to have one generic method for save which gets something like parameter names and values and inserts it

Example as

https://stackoverflow.com/questions/23830961/jdbctemplate-utilities-for-insert-statement

However the above example doesn't clearly says the or gives the implementation of the BaseObjectMapper and seems pretty big

Need a proper way to define the save, update and delete.
0
Hello all,

Currently, i am using smb server but now I want to change it into afp server.

what will be the exact way to change it and connect using afp server?

currently these library are used in the project:
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;


Thanks in advance.

Regards
Amzad
1
hi am having this error when seting my java home am in window 7
[code]C:\Users\userpc>java -version
Error occurred during initialization of VM
Unable to load native library: Can't find dependent libraries


C:\Users\userpc>java -version
Error occurred during initialization of VM
Unable to load native library: Can't find dependent librarie

C:\Users\userpc>set JAVA_HOME=C:\java6

C:\Users\userpc>SET PATH=PATH%JAVA_HOME%\BIN;

C:\Users\userpc>JAVA -VERSION
'JAVA' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\userpc>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\userpc>set JAVA_HOME=C:\java6

C:\Users\userpc>SET PATH=PATH%JAVA_HOME%/BIN;

C:\Users\userpc>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\userpc>SET PATH=PATH%JAVA_HOME%;

C:\Users\userpc>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.

Open in new window

[/code]
0
I'm following this LDAP authentication code

LDAP Authentication code

replaced parameters with my own parameters to authenticate  with OpenLDAP 2.4.31


public static void main(String[] args)
	{
		String username = "jsmith";
		String password = "password@123"; 
		String base = "ou=people,dc=nodomain";
		String dn = "uid=" + username + "," + base;
		String ldapURL = "ldap://xx.xx.xx.xx:389";

		// Setup environment for authenticating
		
		Hashtable<String, String> environment = 
			new Hashtable<String, String>();
		environment.put(Context.INITIAL_CONTEXT_FACTORY,
				"com.sun.jndi.ldap.LdapCtxFactory");
		environment.put(Context.PROVIDER_URL, ldapURL);
		environment.put(Context.SECURITY_AUTHENTICATION, "simple");
		environment.put(Context.SECURITY_PRINCIPAL, dn);
		environment.put(Context.SECURITY_CREDENTIALS, password);

		try
		{
			DirContext authContext = 
				new InitialDirContext(environment);
			System.out.println("authentication success!");
			
			// user is authenticated
			
		}
		catch (AuthenticationException ex)
		{
			System.out.println("authentication failed!");   // I'm getting this print
			// Authentication failed

		}
		catch (NamingException ex)
		{
			ex.printStackTrace();
		}
	}
}

Open in new window


I am getting authentication failure message . ..what I'm doing wrong ?  ..unable to find the root cause.
Do I need to send password encrypted  ?
0
Dear,
What driver to choose below, when creating Database connection, to connect to SQL server DB?
18r.png
0
Hello,
facing a problem to choose best client side framework for localization with jsp?
I have REST API which i need to consume at client side and display it on jsp will it be safe to use spring mvc for client side?
What is the best practice to integrate client-server ?
0
Hello,

Need to clean cache of client browser,using jsp as front end.
though have already written the below code

 <% response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 
 response.setHeader("Pragma","no-cache"); //HTTP 1.0 
 response.setDateHeader ("Expires", 0); //prevents caching at the proxy server  
%>

Open in new window


But almost 90% of the times we need to ask the client to manually clean the cache,after that only the new changes are reflected in the client browser,say we have created new button on screen, which is not visible but when the user cleans the browser cache manually the button seems to work display.
0
Hi,

I have a requirement in Java script to run the select statements every 3 hours and update those select count(*) counts in a spreadsheet. Kindly share the code snippet to accomplish this request.

Also we are running

1. 2 scripts 3 hours once in a day.
2. 1 Script once in a day.
3. 1 script on particular times like 10.45, 11.15....

please let me know if you need any more details.

Thanks
Venkatesh.
0
Hi - I have the below line in my jsp and i am getting error saying
unterminated &lt;

 
var myString = "<img src='images/clear.gif' width='8' height='5'><mytags:dropdown  fieldID=" +"'"+ extDataID+ "'"+" category= " +  '<%=com.test.myString.GET_VALUE_TEST%>' + " selectedOption='' style='InputFields'/>";
			

Open in new window


so what is wrong in the above syntax is javascript not accepting <%= %>

I can pinpoint the error to this line because when i replace the above line with the below line no issues
var myString = "<img src='images/clear.gif' width='8' height='5'><input type='text' name=" +"'"+ test+ "'"+" maxlength = '40' size='64' value='' class = 'InputFields'>";

Open in new window


Thanks,
0
Get your problem seen by more experts
LVL 12
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Hi All,

I am having Issues trying to access a Tomcat JSP page from AWS ELB I can access it from the localhost,
but ELB isn't allowing me to get access out.

my EC2 Instance has security roles
HTTP 80 ::/0
HTTP 80 0.0.0.0/0
TCP 8095 0.0.0.0/0

The ELB has a listener for HTTP 80 HTTP 8095 with secturiy for
http 80 0.0.0.0/
TCP 8095 0.0.0.0/0
0
I have the following class definition:
class PurchaseData {
    public BigDecimal purchaseYears,
        contribRate,
        milYears,
        lapsedTime, lapsedTime2, lapsedTime3,
        factor,
        purchaseCost, purchaseCost2, purchaseCost3,
        paymentAmount;
    
    PurchaseData(BigDecimal py, BigDecimal cr, BigDecimal my,
        BigDecimal l1, BigDecimal l2, BigDecimal l3,
        BigDecimal f,
        BigDecimal p1, BigDecimal p2, BigDecimal p3,
        BigDecimal pa)
    {
        purchaseYears = py;
        contribRate = cr;  
        milYears = my;   
        lapsedTime = l1; 
        lapsedTime2 = l2;
        lapsedTime3 = l3;
        factor = f;
        purchaseCost = p1; 
        purchaseCost2 = p2;
        purchaseCost3 = p3;
        paymentAmount = pa;
    }
} 

Open in new window

Note that, all by itself, that class definition compiles w/o errors.

In my program I do the following:
PurchaseData rd = new PurchaseData();
//and I've tried:
PurchaseData rd = new PurchaseData(null,null,null,null,null,null,null,null,null,null,null);

Open in new window

when I try to run, I get:
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 2,068 in the jsp file: /purchaseServiceCredit.jsp
The constructor purchaseServiceCredit_jsp.PurchaseData() is undefined

Open in new window

What am I doing wrong?
0
I'm very new to unifi, html and css. Please be gentle with me.
I have the current windows version of the Ubiquiti Unifi controller.
I am able to modify voucher.html and voucher.css to produce custom hotspot vouchers.
I want to print, on the voucher, the date and month the voucher was created.
I have added the following line to voucher.html:
<div class="create_time">Create Time: <unifi var="create_time" /></div>
 
The voucher prints "Create Time:" but does not print the date/time.
Any assistance is much appreciated.
0
Hi - I wrote the below functions/html to create 10 more dropdowns upon clicking the button, but for some reason it is not working.
what am i doing wrong ?

My requirement:
I have 5 dropdowns on left side and right side by default
when i click on add 10 rows button i should see 10 more dropdowns on left side and 10 more  dropdowns on right side (total 15)

<!DOCTYPE html>
<html>
<body>

<script>
function addDataRows(divname) {
   var newDiv=document.createElement('div');
   var html = '<select>
		<option value="volvo">Volvo</option>
		<option value="saab">Saab</option>
		<option value="opel">Opel</option>
		<option value="audi">Audi</option>
		</select>';
   newDiv.innerHTML= html;
   document.getElementById(divname).appendChild(newDiv);
}
function addLRows(divname) {
   var newDiv=document.createElement('div');
   var html = '<select>
				<option value="volvo">Volvo</option>
				  <option value="saab">Saab</option>
				  <option value="opel">Opel</option>
				  <option value="audi">Audi</option>
				</select>';
   newDiv.innerHTML= html;
   document.getElementById(divname).appendChild(newDiv);
}
function add10rows(Container1, Container2){
	var rowCnt;
	for(rowCnt = 1; rowCnt<11; rowCnt++) {
		addDataRows(Container1)
		addLRows(LocContainer)
	}
}
</script>
<table>
<tr>
	<table>
		<td align="left" nowrap width="40%" style="padding-left: 10px; padding-bottom: 10px">
				<select>
				<option value="volvo">Volvo</option>
					<option value="saab">Saab</option>
				  

Open in new window

0
i am new to rest api.
i want to implement REST API for my project which is developed with Spring framework.
i want to implement  REST API in best way.

Please provide sugggistions for design and development.
0
I have my code like below
      response = orch.process(request);

when i mover on to process method and click control and left mouse click it supposed to go to process method implementation but it is not doing in eclipse mars.

it used to work earlier not sure suddenly what happened stops working.

i restarted my laptop still not working.

please advise
0

JSP

JavaServer Pages (JSP) allow the development of dynamically generated web pages. It uses the Java programming language; JSP pages are translated into servlets at runtime, with each servlet being cached and reused until the JSP is modified. JSP allows Java code to be interleaved with static web markup content, so the resulting page can be compiled and executed on the server to deliver the content.

Top Experts In
JSP
<
Monthly
>