[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

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

<%@page import="myServletPakage.RanUtilities"%>
<%@page contentType="text/html; charset=ISO-8859-7" language="java" import="java.lang.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%!
int numberToGuess = RanUtilities.randomInt(100);
 %>
 <% boolean win = false;
      int numberOfTries = 0;

 while(win==false && numberOfTries<10){%>
 <form>
EnterNumber:<input type = "text" name = "number">
 </form>
 <%
 String value =request.getParameter("number");

    %>
 <%
 int yourNumber = Integer.parseInt(value ); %>
 <% if(yourNumber == numberToGuess){
            win = true;
            System.out.println("You win this Game");%>
            <P> Your number is <%= yourNumber %>
            <br> You Win This game!!!
            
            <%
      } %>
 <% numberOfTries++; } %>
</body>
</html>
0
Become a Microsoft Certified Solutions Expert
LVL 12
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

I am encountering HTTP Status 404 - Not Found  accessing a http://localhost:8080/sample/ application.
Description: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

I can only assume it is caused by my Apache Tomcat configuration, because I am yet to get it working. I am running version Apache Tomcat/7.0.91 on Redhat 7 in AWS. I have installed and integrated Winbind and the OS is happily talking to my AD domain example.com. It can see groups and users and I have masked the domain format 'example/user1' so it appears as 'user1'.

I have downloaded and installed sample.war from https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/ into my tomcat installation /usr/local.tomcat7/webapps/ directory.

My  /usr/local/tomcat7/conf/server.xml configuration looks like this:
<!-- <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
-->
<Realm className="org.apache.catalina.realm.JNDIRealm"
   debug="99"
   connectionURL="ldap://example.com:389"
   authentication="simple"
   referrals="follow"
   connectionName="cn=user1,ou=users,ou=lab,dc=example,dc=com"
   connectionPassword="**********"
   userSearch="(sAMAccountName={0})"
   userBase="dc=example,dc=com"
   userSubtree="true"
   roleSearch="(member={0})"
   roleName="cn"
   roleSubtree="true"
   roleBase="ou=users,ou=lab,dc=example,dc=com"
  />

Open in new window


My /usr/local/tomcat7/webapps/sample/WEB-INF/web.xml file looks like this:


Open in new window

0
Should I use Netbean or Eclipse for Java development ? Is it better to use JavaFX or Swing for my programming ?

Thx
0
I have problem with this issue related to liferay...

2018-10-03 13:06:18.494 INFO  [http-nio-8080-exec-23][UserProfilePortlet:195] null
java.lang.ClassCastException: com.sun.proxy.$Proxy1003 cannot be cast to org.aspire.tipsonsdeals.service.NotifiesLocalService
      at org.aspire.tipsonsdeals.service.NotifiesLocalServiceUtil.getService(NotifiesLocalServiceUtil.java:253)
      at org.aspire.tipsonsdeals.service.NotifiesLocalServiceUtil.createNotifies(NotifiesLocalServiceUtil.java:198)
      at org.aspire.tipsonsdeals.userprofile.portlet.UserProfilePortlet.updateUser(UserProfilePortlet.java:179)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:189)
      at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:418)
      at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:97)
      at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:260)
      at com.liferay.portlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:77)
      at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:50)
      at …
0
I am trying to pass the object array which each object contain lat and lng from session bean to the javascrip  inside a jsp. however, it sounds like an easy task, but I just got stuck here.

From a w3c testing, it can print the correct string in javascript.
<!DOCTYPE html>
<html>
<body>

<p>Click the button to add a new element to the array.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
var fruits = [];
document.getElementById("demo").innerHTML = fruits;
var lat = 123;
var lng = 456;

function myFunction() {
   
    fruits.push(" lat: "+ lat + ", lng: " + lng);
    
    lat = 789;
    lng = 1012;
    fruits.push(" lat: "+ lat + ", lng: " + lng);
    document.getElementById("demo").innerHTML = fruits;
}
</script>

</body>
</html>

Open in new window


but it does not work the same way when I use the same idea to push the real lat and lng to display the map:

Below, the first block of code  works, but the second block does NOT. the only difference between them is to pass lat and lng into an array and then pass the array element to the location varaible.
<html>
  <head>
    <style>
       /* Set the size of the div element that contains the map */
      #map {
        height: 400px;  /* The height is 400 pixels */
        width: 100%;  /* The width is the width of the web page */
       }
    </style>
  </head>
  <body>
    <h3>My Google Maps Demo</h3>
    <!--The div element for the map -->
    <div id="map"></div>
    <div 

Open in new window

0
HTTP Status 404 ? Not Found
Type Status Report

Message /myapp/WEB-INF/views/verification.jsp

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
0
Hi,

I have problem to make the progress bar be animated. It shows a static progress bar with the green image only but no animation. I placed the code below for your reference. May I know what is the problem? Please help. Thanks.

I embedded all the codes below codes in the jsp (the framework is SpringMVC). How to make the progress bar animated? Also, we are using html4 but not the highest (html5).

HTML:
<div id="pwidget">  
<div id="progressbar">
    <div id="indicator"></div>
</div>
<div id="progressnum">0</div>
</div>
<input type="button" name="Submit" value="Start the progression"
    onclick="itv = setInterval(prog, 100)" />
<input type="button" name="Submit" value="Stop"
    onclick="clearInterval(itv)" />


CSS:

#pwidget
{
  background-color:lightgray;
  width:254px;
  padding:2px;
  -moz-border-radius:3px;
  border-radius:3px;
  text-align:left;
  border:1px solid gray;    
}
#progressbar
{
  width:250px;
  padding:1px;
  background-color:white;
  border:1px solid black;
  height:28px;
}
#indicator
{
  width:0px;
  background-image:url("shaded-green.png");
  height:28px;
  margin:0;
}
#progressnum
{
  text-align:center;
  width:250px;
}

Javascript code:

var maxprogress = 250;   // total to reach
var actualprogress = 0;  // current value
var itv = 0;  // id to setinterval
function prog()
{
  if(actualprogress >= maxprogress)
  {
    clearInterval(itv);    
    return;
  }
  var progressnum = …
0
Hi all,

I have problem to display my PDF file in an existing popup window using spring framework. The workflow is when I click a button from the main page, it popups a new window (child) and showing progress status. After the file finished generating, I set the view in controller and return to jsp. However, the PDF file displays (using DefaultResourceLoader and response.flushBuffer) in the main page instead of the popup window. I want to show in popup. Anything wrong? How can I specify which window the PDF should be displayed?

Please help. Thanks.
0
Dynamic Form/Table from BackEnd for every entities which has CRUD operations

I'm developing a Java Web application.

I need to

1st option list the user clicked entity menu on the UI
2nd search page where user enter values for the fields and we need to publish the search results in a table

Note: the number of columns will differ from entity to entity

In either case, i need to know hoe to define a generic entity, pojo, DAO and DAOimpl, service and controller class and view jsp page

What should be the return type Object for #1, #2

How to create a generic jsp page to display the results for any entity

Please advise

Thanks
0
can any one provide an sample application for tomcat 7.x that can trigger OutOfMemory and hung threads?.
0
OWASP Proactive Controls
LVL 12
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

I am learning spring Boot framework right now, I am trying to apply i18n concept on my simple application. But whenever I run the application, the following error returned: "No message found under code 'label.welcomeMessage' for locale 'en_US'.". I have read about this issue and tried a lot before I getting here to ask but noting have worked with me.

Here is my AppClass configuration:

package com.abed.main.configuration;


import java.util.Locale;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;

@Configuration
public class AppConfig implements WebMvcConfigurer{



    @Bean
    public LocaleResolver localeResolver()
    {
        SessionLocaleResolver slr = new SessionLocaleResolver();
        slr.setDefaultLocale(Locale.US);
        return slr ; 
    }

    @Bean
    public LocaleChangeInterceptor LocaleChangeInterceptor()
    {
        LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
        lci.setParamName("lang");

Open in new window

0
language: Java

 i have one bank statement  in xls format , which i already convert into csv format in java .  and display in jsp  ,but how user can recognized the amount is debit or credit because it come in one column i.e  amount . and  after edit  form jsp it will save in database , where two different column for debit and credit .....

Problem:  In excel File : there is two column Debit Amt. and credit Amount , but the transaction will be debit or credit , but when i convert into csv file ,  it not write null on blank cell . i

 used missing policy ,
 case Cell.CELL_TYPE_BLANK:
                                                                                               
                                  data.append("***" + ",");
                                    break;

 but it work on total blank column , not a every blank cell .

Kindly guide .Thanks  in advance .
0
Hello There ,
 I am new to Spring framework , i started to learn Spring MVC framework , i am currently trying to use internationalization (i18n)and localization (i10n) and every thin is going as expected

but here is my question in my project i have just 3 JSP and i have apply the (i18n) concept on them but i am wondering what if have 100 JSP , do i have to write a code and labels for all 100 JSP or can i make my all of my JSP app internationalized  just by clicking on a link to change between languages i want ???
0
I am new to Spring MVC and I am trying to build a simple web App I am using Hibernate with Spring MVC. I am trying to implement CRUD operations in this web app, all CRUD operates properly except the update although DAO And Service Layers are working properly the problem here is about the JSP's and controllers. whenever I click update from the table it took me to the desired page to enter new book info but from the Update page when I click on update book submit button it stays on the same page and it does not call the desired controller method to take me where I want. I am talking about the last two methods.

Here is the Controller

package com.abed.controllers;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.abed.models.Book;
import com.abed.service.BookService;

@Controller

public class BookController {

    @Autowired
    BookService service;

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public String 

Open in new window

0
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
Receiving error as follows. Please do needful.
HTTP Status 500 - Filter execution threw an exception
exception :
javax.servlet.ServletException: Filter execution threw an exception
root cause :
java.lang.Error: Unresolved compilation problems:
      The import com.opensymphony cannot be resolved
      The import com.opensymphony cannot be resolved
      The import com.opensymphony cannot be resolved
      ActionSupport cannot be resolved to a type
      ValueStack cannot be resolved to a type
      ActionContext cannot be resolved

      com.tutorialspoint.struts2.HelloWorldAction.<init>(HelloWorldAction.java:5)
      sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      java.lang.reflect.Constructor.newInstance(Unknown Source)
      java.lang.Class.newInstance(Unknown Source)
      com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:130)
      com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:161)
      com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)
      com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:120)
      com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:300)
      com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:400)
      com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
      …
0
I have a web application that is deployed in wildfly 12, and I need to precompile the jsp for production, in the forums I saw that jspc is not longer  supported for jboss, also y tried maven plugin with no success.

i tried using management deployment and later do the explode forn the web console but the jsp isn't compiled
Also i couldn't find a command to do it from the hot-deployment, like glassfish --precompilejsp parameter.

how to do the precompilation of the jsp in wildfly?
0
I have a Tomcat app. Recently, I've updated the connection pool, in order to use Tomcat's jdbc-connection pool. In my Windows developing machine, everything works fine, but now that I'm trying to implement this on my Linux Server, I get this exception (see title) when ever my app tries to connect to MySQL.

I'm using "Easy Tomcat 7" which is supposed to be the same as the regular version of Tomcat, only it comes with the CPanel software.

I just need this database to be available for this app (not multiple app's).

This is my java DB class:

public class DBUtil {

static DataSource ds;
static {
    try {
        Context context = new InitialContext();
        ds = (DataSource)context.lookup("java:comp/env/jdbc/rhwebDB");
    } catch (NamingException e) {
        e.printStackTrace();
        System.out.println("DBUtil.NamingException" + e);
    } catch(Exception e) {
        System.out.println(e);
    }
}

public static Connection getConnection() throws SQLException {
    return ds.getConnection();
}

Open in new window


This is my context.xml file, which is located on myAppDirectory/META-INF folder

<?xml version="1.0" encoding="UTF-8"?>

<Context>
<Resource
    name="jdbc/rhwebDB"
    auth="Container"
    type="javax.sql.DataSource"
    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
    testWhileIdle="true"
    testOnBorrow="true"
    testOnReturn="false"
    validationQuery="SELECT 1"
    validationInterval="30000"
    timeBetweenEvictionRunsMillis="30000"
    maxActive="20"
    minIdle="3"
    maxIdle="15"
    maxWait="10000"
    initialSize="3"
    removeAbandonedTimeout="60"
    removeAbandoned="true"
    logAbandoned="true"
    minEvictableIdleTimeMillis="30000"
    username="dbuser"
    password="dbpassword"
    driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://127.0.0.1:3306/rhmexweb_rhweb"/>
</Context>

Open in new window


I don't use WAR files. I just upload files to my server and re-start tomcat when needed, which normally works just fine.

In case this is relevant too, Tomcat's server.xml file has this settings for this website. I've also tried adding parameter copyXML="true", with no luck so far:

<Host name="rhweb.mx" appBase="webapps">
          <Alias>www.rhweb.mx</Alias>
          <Context path="" reloadable="false" docBase="/home/rhmexweb/public_html" debug="1" />

Open in new window


Here's the full stacktrace I get when my app tries to establish a connection with MySQL:


Open in new window

0
Greetings,

I am  working on servlet  project and I  had made a jsp form in my project.  I have fetch the data in my dropdownlist using jsp code.  But the error is that when I select dropdownlist
I  want  to fetch the data in my multiple textbox according to my sql database column.

Please can you help me?
0
JavaScript Best Practices
LVL 12
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

Will not display the image that retrieved from DB (as blob)  in Chrome ? But working fine with Firefox.
0
I downloaded a working demo but when I integrated it with the registration page made by me I am getting an error on adding a new user:

[Field error in object 'user' on field 'userProfiles': rejected value [3]; codes [typeMismatch.user.userProfiles,typeMismatch.userProfiles,typeMismatch.java.util.Set,typeMismatch]; arguments
[org.springframework.context.support.DefaultMessageSourceResolvable: codes [user.userProfiles,userProfiles]; arguments []; default message [userProfiles]]; default message
[Failed to convert property value of type 'java.lang.String' to required type 'java.util.Set' for property 'userProfiles'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type
[com.idev.tpt.model.UserProfile] for property 'userProfiles[0]': no matching editors or conversion strategy found]]

JSP File:

<form:form id="userForm" action="newuser" modelAttribute="user">
    <form:input type="hidden" path="id" id="id" />
    <div class="form-group">
        <form:input type="text" path="firstName" id="firstName" placeholder="First Name" class="form-control input-sm" />
    </div>
    <div class="form-group">
        <form:input type="text" path="lastName" id="lastName" placeholder="Last Name" class="form-control input-sm" />
    </div>
    <div class="form-group">
        <c:choose>
            <c:when test="${edit}">
                <form:input type="text" path="ssoId" id="ssoId" placeholder="SSO ID" 

Open in new window

0
I created one application in netbeans 8.2 now i want to deploy this application in weblogic for that i created weblogic.xml but when i validate its giving me following error at the same time when i deployed as it is then in weblogic it is showing me Unable to access the selected application.,Exception in AppMerge flows' progression,Unmarshaller failed when i validate weblogic.xml its showing me below error,im using apache tom cat in server side weblogic java version is java version "1.7.0_71" where in my windows it is 1.8.0_161

Checking file:/D:/GODBFILES/NETBEANS%20PROJECTS/NetBeansProjects/EmployeeRegistration/web/WEB-INF/weblogic.xml...
schema_reference.4: Failed to read schema document 'file:/C:/Program%20Files/glassfish-4.1.1/glassfish/lib/schemas/weblogic-web-app.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. [2]
cvc-elt.1: Cannot find the declaration of element 'weblogic-web-app'. [2]
schema_reference.4: Failed to read schema document 'file:/C:/Program%20Files/glassfish-4.1.1/glassfish/lib/schemas/weblogic-web-app.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. [3]
schema_reference.4: Failed to read schema document 'file:/C:/Program%20Files/glassfish-4.1.1/glassfish/lib/schemas/weblogic-web-app.xsd', because 1) could not find the document; 2) the document could not be read; 3) the …
0
Here is my html code where i creating dynamic textbox for insert using jsp
function getinput()
{
index ++;
var singleRecord = "";
singleRecord += " Employee_id : <input type='text' READONLY name='txt_Employee_id"+index+"'value='<%=request.getParameter("employee_id")%>'>";
singleRecord += " Project_name : <input type='text' name='txt_project_name"+index+"'>";
singleRecord += "Project/Task : <input type='text' name='txt_Header"+index+"'>";
singleRecord += "Department : <input type='text' name='txt_Department"+index+"'>";
singleRecord += "Description : <input type='text' name='txt_description"+index+"'>";
<!--singleRecord+="Date : <input type='date'  name='datainsertdate"+index+"'>"; --->
singleRecord += "<hr/>";
$("#inputs").append(singleRecord);
$("#count").val(index);
}

</script>

</head>

<body background="123-slideshow\blue_background.jpg">
<form action="EmployeeVendorValidation.jsp" method="post">

   
     <br><br><br><br>    
<input type="hidden" name="count" id="count"/>



<div id="inputs">
</div>
<button type="button" onclick="getinput()" class="button button5">Add</button>

&nbsp;
<button type="submit" class="button button2">Submit</button>

jsp:

 Class.forName("oracle.jdbc.driver.OracleDriver");
          Connection con=DriverManager.getConnection("jdbc:oracle:thin:@172.18.114.213:1821:godb","xe","ex");
       PreparedStatement ps = con.prepareStatement("insert into employee_task values(?,?,?,?,?,?)"); …
0
How to delete products from shopping cart when user session ends (or Logout in ) in jsp web application.When you then add a product to your cart (not logged in) and then decide to login and go to the checkout, I now have 2 products in the basket. Is there a way to not store products in the basket when you logout?

I know that this is a cookies issue, but is there a way to remove products from the cart when logging out?

Following is code what i have tried.




product.jsp
<link href="style.css" rel="stylesheet" type="text/css" media="all" /> 
<div class="cart"> 
						<form action="#" method="post" class="last"> 
							<input type="hidden" name="cmd" value="_cart" />
							<input type="hidden" name="display" value="0" />
							<button class="w3view-cart" type="submit" name="submit" value=""><i class="fa fa-cart-arrow-down" aria-hidden="true">cart</i></button>
						</form>  
					</div>
					
						<div class="item" style="width: 30%">
										<div class="glry-w3agile-grids agileits"> 
											<div class="new-tag"><h6>20% <br>Off</h6></div>
											<a href="products4.jsp"><img src="s3.jpg" alt="img"></a>
											<div class="view-caption agileits-w3layouts">           
												<h4><a href="products4.jsp">Nylon Shuttle</a></h4>
												<p>Lorem ipsum dolor sit amet consectetur</p>
												<h5>$56</h5>
												<form action="#" method="post">
													<input type="hidden" name="cmd" value="_cart" />
													<input 

Open in new window

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

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
>