munish sharma

Greenhorn
+ Follow
since Jul 16, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by munish sharma

i have created a new JSP page which uses jstl/core and formating message functionality !
The project is made in netbeans 7.3, it is a maven web appplication ( with pom.xml )
when i run the page the label is formatted around ??? viz "???label???"..
what possibly am i missing ??


******************************************************************************
pom.xml :


<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">;
<modelVersion>4.0.0</modelVersion>

<groupId>com.mycompany</groupId>
<artifactId>Hello</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Hello</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>


***************************************************************************************

****************************************************************************************
index.jsp:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"; %>
<html>
<head>
<title>JSTL fmt:message Tag</title>
</head>
<body>

<fmt:setLocale value="en"/>
<fmt:setBundle basename="com.tutorialspoint.Example" var="lang"/>

<fmt:message key="count.one" bundle="${lang}"/><br/>
<fmt:message key="count.two" bundle="${lang}"/><br/>
<fmt:message key="count.three" bundle="${lang}"/><br/>

</body>
</html>

******************************************************************************


*******************************************************************************
OUTPUT:

???count.one???
???count.two???
???count.three???

*******************************************************************************

Expected OUTPUT:

One
Two
Three
5 years ago
hi

I created 2 web applications in netbeans using servlets . Now when i right click on one application to run it , the server starts other web app too !!

Though this is not a problem , but would anybody tell me why this happens and how do i stop it.
I appreciate your help, thank you people !

getResourceAsStream() worked, and now i will try this code with ServletContext.getRealPath() ;)
7 years ago
Hey hi again

I made my code run fine . I have a little doubt though.

When i created a Web Application Listener to load a file ......... i could only load my file from D:\Test\text.txt
instead i want this file to be placed in WEB-INF folder !!

For this to happen i have tried editing web.xml like this
<context-param>
<param-name>abc</param-name>
<param-value>/WEB-INF/text.txt</param-value>
</context-param>

But this does not work ..... only when <param-value> is D:\Test\text.txt the application responds



text.txt exists in both directories...!!
what to do ??
7 years ago
no every things is running fine without exception .

i want to update the view ! How should i continue ??
i am i missing something ??
7 years ago
Exactly !!
web app runs fine , but as you say nothing happens as MyList is not there

what should i do to create a file and populate it ?

7 years ago
I have recently started developing web applications, and thats why i am using text files
Herein Admin and user are involved , so instead of HTTPSession i think context would serve my purpose better.

InitializeProject ( a web apllication listner ) implementation goes like this :


deployment descriptor looks like this :

<context-param>
<param-name>My-File</param-name>
<param-value>/WEB_INF/data/demofile.txt</param-value>
</context-param>
<listener>
<listener-class>..........web.InitializeProject</listener-class>
</listener>

I need suggestions.....!!
do i need to mannualy create this data file (demofile.txt) in WEB-INF ?
my view servlet is not getting updated!
7 years ago
hi.

I was working on a web app wherein i have stuck. !
In This webapp i have a controller servlet, 2 view servlets ( one of which fills the form & other servlet displays the information)
i tried to create a text file that will contain the data (model data !!) . This is data which is generated by form_servlet, and it has to be displayed by display_servlet

i used web application listner , could anybody write a small working application demonstrating this, because i don't know where i am stuck.
7 years ago