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

Hi,
I wonder how to Use tracing facilities in your browser to check web service request and response.  Please advise on the steps.
0
Hi,

I wonder exact differences between % and /

sometime i will interchange them

/ like - which is how many times we subtract b from a if i say a/b or 15/7...which is 2?
and 15%7 is actual reminder once 7 subtracted twice from 15 which is 1
0
Hi,

Mot of jave programs i saw for strings i see substring, indexOf method 90% of the times. Are there any other important String methods we use in practical java programs apart from these two methods? please advise
0
Hi,

I am trying below example

http://www.mkyong.com/struts/struts-spring-hibernate-integration-example/

When i do maven clean all is fine.
when i do maven install i am getting below error.

[INFO] Scanning for projects...
[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building StrutsExample Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom (7 KB at 5.5 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.369 s
[INFO] Finished at: 2016-06-30T22:33:51-04:00
[INFO] Final Memory: 11M/164M
[INFO] ------------------------------------------------------------------------
Failed to execute goal on project StrutsSpringExample: Could not resolve dependencies for project com.mkyong.common:StrutsSpringExample:war:1.0-SNAPSHOT: Failure to find javax.transaction:jta:jar:1.0.1B in http://download.java.net/maven/2/ was cached in the local repository,
0
Hi,

I am trying below challenge

http://codingbat.com/prob/p141736


Not sure how to approach. please advise
0
Hi,

i am working on below challenge
http://codingbat.com/prob/p192570

i trying to write my code but not sure how to remove RHS text from LHS(left hand side text)

i was trying to follow below
http://crunchify.com/java-program-to-replaceremove-characters-from-string/
but could not proceed.
please advise
0
Hi,

i am working on below challenge
http://codingbat.com/prob/p199171

i wrote my code as below
public int countYZ(String str) {
  int i=0;
  // public static void main(String args[]){
      String Str1 = str;
      char[] Str2 = new char[10];

     // try{
         Str1.getChars(0, 10, Str2, 0);
      //   System.out.print("Copied Value = " );
        // System.out.println(Str2 );
         
  
  for(int j=0;j<Str2.length;j++){
  if(Character.isLetter(str2)==y||Character.isLetter(str2)==z)
  i++;
  }
  return i;
}

Open in new window



i am getting below errors.

Compile problems:


Error:      if(Character.isLetter(str2)==y||Character.isLetter(str2)==z)
                            ^^^^
str2 cannot be resolved


see Example Code to help with compile problems

please advise
0
Hi,

eclipse luna javeEE perspecive missing. I tired as below but no luck. please advise
go to "Help" -> "Install New Software...".

In the new dialog, in the "Work with:" pull-down list, select "Indigo - http://download.eclipse.org/releases/indigo". (Note: Replace Indigo and the download list with download locations for your eclipse version)

Select the following packages to install:

       "Web, XML, Java EE and OSGI Enterprise Development".
       "Programming langauges -> Eclipse Java Development Tools"

http://stackoverflow.com/questions/4747518/how-to-add-java-ee-perspective-to-eclipse
0
Hi,
I ama getting attached error whin i click on market place of eclipse Luna.

as per below link

http://stackoverflow.com/questions/24772674/market-place-not-working-in-eclipse-luna
i went under

7
down vote
accepted
+50
Go to Help/Install new software from the menu, select the Juno update site (http://download.eclipse.org/releases/juno 'try this repository'), and look for the Marketplace client it is in the General Purpose Tools category

But i have not found Marketplace client.
I downloaded eclipse luna from below sit and runing on windows 7 laptop

http://www.eclipse.org/downloads/packages/release/Luna/SR2

i am trying below step

>open (your eclipse luna folder)-->configuration-->config ->open the config file with wordpad and add the below lines at the end.

org.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4

->save the config file ->Now restart the eclipse luna and try to access the market place.

with which eclipse market place came but i am not able to see the SVN Repository view? please advise

please advise on how to resolve
lunaErr.png
lunaErr2.png
0
Hi,
I am trying below example and gettng below error

http://www.javatpoint.com/spring-JdbcTemplate-tutorial

Jun 22, 2016 4:43:41 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@2077d4de: startup date [Wed Jun 22 16:43:41 EDT 2016]; root of context hierarchy
Jun 22, 2016 4:43:41 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Jun 22, 2016 4:43:41 PM org.springframework.context.support.AbstractApplicationContext refresh
WARNING: Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ds' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1514)
	at 

Open in new window

0
Hi,

I am trying below example

http://www.javatpoint.com/steps-to-create-spring-application

//package com.javatpoint;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

public class Test {
public static void main(String[] args) {
	Resource resource=new ClassPathResource("applicationContext.xml");
	//BeanFactory factory=new XmlBeanFactory(resource);
	ApplicationContext factory = new ClassPathXmlApplicationContext("applicationContext.xml");
	
	Student student=(Student)factory.getBean("studentbean");
	student.displayInfo();
}
}

Open in new window


//package com.javatpoint;

public class Student {
private String name;

public String getName() {
	return name;
}

public void setName(String name) {
	this.name = name;
}

public void displayInfo(){
	System.out.println("Hello: "+name);
}
}

Open in new window


<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<bean id="studentbean" class="com.javatpoint.Student">
<property name="name" value="Vimal Jaiswal"></property>
</bean>

</beans>

Open in new window


when i try above example getting below error

0
hi,

what are differences between timeToIdleSeconds vs timeToLiveSeconds in hibernate second level cache. when we use which one and advantages,, disadvantages with practical example. please advise
0
Hi,

what are differences between projection and projection list in hibernate. when to use which one and advantages, disadvantages. practical uses of each. please advise
0
I use a ajax to upload multiple file to strut2 action class, everything works file, files will be uploaded into server, and action return SUCCESS, the next JSP page is supposed to be displayed. however, not able to go to the next page defined in struts.xml

 <result name="success">/goodResult.jsp</result>

Open in new window


The page show some weird error message:
 
SyntaxError: JSON Parse error: Unrecognized token '<' after 

Open in new window


The plugin I used to upload file is copied from this page:

http://plugins.krajee.com/file-input-ajax-demo/1

and the reason of the problem is likely be the problem described here:

http://webtips.krajee.com/question/json-syntax-error-bootstrap-fileinput/

http://plugins.krajee.com/file-input#installation

"Ajax Submission: In this mode, you MUST SET the uploadUrl property to a VALID ajax processing server action/URL. If the uploadUrl is set, then the plugin automatically assumes an ajax upload for the scenario. The plugin offers advanced features for ajax submission that is not available in form submission. Features like drag and drop of files, appending/removing files in preview zone, getting a progress bar for your uploads are all possible ONLY IN THIS mode. Your browser must support HTML5 FormData/XHR2 for this to work and your server code that processes the ajax call must return a valid JSON response."


http://plugins.krajee.com/file-input#async-send

Sending Data (from server)
In synchronous mode as well, the uploadUrl must send data back as a json encoded object. In this case you send these 5 pieces of information.
0
Hi,

I am running below example

http://www.javatpoint.com/hibernate-and-struts-integration

where i get all the related jars to run this example using eclispe. this seems like non maven application.

please advise
0
I have a bizarre problem. I'm running apache-tomcat-8.0.23 and Apache 2.4.16 on Linux Slackware 14.1. I run tomcat as its own user (tomcat), not root. I have a webapps directory webapps/horeb, and all files in that folder are owned by horeb.horeb, example:
> ls -l
drwxrws--- 4 horeb  horeb  4096 Jun 14 18:51 WEB-INF
-rw-rw---- 1 mfoley horeb  1713 Jun  5 15:16 findMember.jsp
-rw-rw---- 1 mfoley horeb  8826 Jun 11 12:10 gallery.jsp

Open in new window

tomcat has permission in the horeb group (/etc/group):

tomcat:x:200:mfoley
horeb:x:1000:tomcat,mfoley,daemon

I'd like to utilize WEB-INF/web.xml, but if I set WEB-INF to group executable, as shown above, tomcat fails to run giving initially "One or more listeners failed to start" as the first SEVERE error in the attached catalina.out log. If I do `chmod g-x WEB-INF`, tomcat start up just fine. I'm clueless as to the problem and don't know where to look.

My not-very-helpfu theory is there is something misconfigured in my WEB-INF folder and, if not listable, tomcat skips looking there, but if listable, it fails to find something it needs. Here is my WEB-INF folder:
> ls -lR WEB-INF/
WEB-INF/:
total 28
drwxrws--- 2 horeb horeb  4096 Jun 14 18:50 classes
drwxrws--- 2 horeb horeb  4096 Jun 14 18:32 lib
-rw-rw---- 1 horeb horeb 14554 Nov  2  2014 web.xml

WEB-INF/classes:
total 0

WEB-INF/lib:
total 0

Open in new window

I have this same version of Tomcat, Apache and Linux running on other servers with no such problems. I've tried stripping WEB-INF down to the same as the running versions. Nothing I've tried for over a week works.
catalina.txt
0
Hi,
what is mask rule in struts validation.xml. what are various struts validations and which one to use when with advantages, disadvantages with sample examples using maven. please advise
0
Hi
I am running below example

http://maksim.sorokin.dk/it/2011/01/20/jax-ws-web-services-maven-tomcat/

i downloaded source code and imported and maven clean, maven install, build and run on tomcat 7 server.

I see below error on pom.xml
Description      Resource      Path      Location      Type
Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:maven-clean-plugin:maven-plugin:2.4.1:runtime Cause: error in opening zip file      pom.xml      /jaxwsExample      line 1      Maven Project Build Lifecycle Mapping Problem
under
C:\Users\zzz\.m2\repository\com\sun\xml\ws\jaxws-rt\2.1.3

i see jaxws-rt-2.1.3.jar created also

please advise
0
hi,

i have imported below maven project to eclipse
http://www.journaldev.com/2623/spring-autowired-annotation

when i clean then maven install where i see all the jars dowloaded to my local repository or laptop.

please advise
0
Hi,

\I installed maven plugin as attached to my eclipse mars. where can i find samples of struts, springs, hibernate, webservices etc independently or as a combined example.

how to import/create maven project.
how to compile and run them too.t.please advise
0
Hi,

i am following below steps to install maven on my windows laptop
http://www.tutorialspoint.com/maven/maven_environment_setup.htm

after all the steps when i try below command i am getting error as below

please advise

my maven is at below location
C:\Program Files\apache-maven-3.3.9-bin\apache-maven-3.3.9

with directories like bin, boot etc


C:\Users\ccc>mvn -version

Error: M2_HOME is set to an invalid directory.
M2_HOME = "C:\Program Files\apache-maven-3.3.9-bin\apache-maven-3.3.9;"
Please set the M2_HOME variable in your environment to match the
location of the Maven installation
maven.png
0
Hi,,

I am trying below spring example at bottom of page

http://www.tutorialspoint.com/spring/spring_autowired_annotation.htm

I am seeing attached errors.

how to resolve them.

i added attached jars still issue not fixed.

this is non maven ecample so i have to download manually jars without conflict.

how to converyt it to maven application?

error description is as below

Description      Resource      Path      Location      Type
The type org.springframework.beans.BeansException cannot be resolved. It is indirectly referenced from required .class files      MainApp.java      /SpringAutoWire/src      line 6      Java Problem
The project was not built since its build path is incomplete. Cannot find the class file for org.springframework.beans.BeansException. Fix the build path then try building this project      SpringAutoWire            Unknown      Java Problem

please advise.

Go i need spring 2.5 jar or spring 3 or spring 4 jar?

where i can download all the right jars with corrcet versioning.
errorsAll.png
errorsAllJArs.png
0
In my Tomcat app I'm getting the message "javax.naming.NameNotFoundException: Name [connURL] is not bound in this Context." I believe I have exactly the same configuration (but apparently not) on a different host and it works fine. My code is:
<%@page import="javax.naming.Context, javax.naming.NamingException" %>
<%
String _dbURL = (String) env.lookup("connURL");
%>

Open in new window

My WEB-INF/web.xml, is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  version="3.1"
  metadata-complete="true">

<env-entry>
  <env-entry-name>connURL</env-entry-name>
  <env-entry-value>jdbc:mysql://localhost/members?</env-entry-value>
  <env-entry-type>java.lang.String</env-entry-type>
</env-entry>

</web-app>

Open in new window

As I said, this works on a different host. What is my problem?
0
Hi dear Experts,

Please tell me using Tomcat as raspberry pi java app server is a good idea ?
I need just run a simple project computing pi on server side by using Leibniz Formula For PI . From the client side on ( PC Win 8.1 Java GUI ) enter input parameters like number iterations and number or threads. And perform computation on server side by using 3 notes ( rpi0 ( master ) rpi1, rpi2 ) . Right now the notes able to compute pi in multi-threading through the MPI.
What should I do in order to connect my laptop to raspberry pi for this purpose ?

Regards,

Sunny
0
Hi,

I read struts supports extension match(in web.xml <url-pattern>*.do</url-patter>), directry match((in web.xml <url-pattern>abc/cde/ghi.do</url-patter>

but  why struts does not support exact match((in web.xml <url-pattern>/pqr</url-patter>

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
>

No Top Experts for this time period. Answer questions to earn the title!