EL and parameters

I seem to be having some problems while using expression language and a parameter being submitted to a form. The page displays the value of a parameter(passed to the page) called name. The user is given a text field to enter a new name and a button to submit name back to page for next greeting. The code should , I guess be fine as the form is displayed correctly, however in code (a) after entering the name in the text box and hitting submit button nothing happens. In another application ie in code (b) again the form is dispalyed as needed and on entering values in the 2 text boxes and hitting submit, it says requested resource is not available.

Code (a)

templateText.jsp

<html>

<head>

</head>

<body>

<h2>EL and Template Text</h2>

<table border="1">

<tr>

<td colspan="2">Hello ${param['name']}</td>

</tr>

<tr>

<form action="templateText.jsp" method="post">

<td><input type="text" name="name"></td>

<td><input type="submit"></td>

</form>

</tr>

</table>

</body>

</html>

The deployment descriptor for this is

web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

version="2.5">

</web-app>

The other application is code (b)

simpleBean.jsp

<jsp:useBean id="person" class="com.apress.projsp.Person" scope="request">

<jsp:setProperty name="person" property="*"/>

</jsp:useBean>

<html>

<head>

<link rel="stylesheet" href="projsp.css">

</head>

<body>

<h2>EL and Simple JavaBeans</h2>

<table border="1">

<tr>

<td>${person.name}</td>

<td>${person.age}</td>

<td> </td>

</tr>

<tr>

<form action="simplebean.jsp" method="post">

<td><input type="text" name="name"></td>

<td><input type="text" name="age"></td>

<td><input type="submit"></td>

</form>

<tr>

</table>

The JavaBean for this is:

Person.java

package com.apress.projsp;

public class Person {

private String name;

private int age;

public Person() {

setName("A N Other");

setAge(21);

}

public void setName(String name) {

this.name = name;

}

public String getName() {

return name;

}

public void setAge(int age) {

this.age = age;

}

public int getAge() {

return age;

}

}

Any help in this would be appreciated. Has it anything to do with intranet settings? How do I go about with this issue? Thanks.

[3166 byte] By [m_minia] at [2007-11-27 6:33:39]
# 1

HI boss..

I just read your long story..ur code a and code b looks pretty fine..are these jsps a part of diffretn applications as such? resource nto found error comes when the request jsps/html or servlet is not found....

Tell us exactly where u are getting this error..? on code a or code b?

mshanua at 2007-7-12 17:59:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

The problem isnt EL related. It's with the address of the resource that you specify in your form's action. Where exactly is this jsp located in your web application? How do you acess it first time when it displays correctly and brings up the form?

Will you append ?name=mini to the end of the url before you access the form jsp the first time and tell us what you see?

ram.

Madathil_Prasada at 2007-7-12 17:59:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Code (a) and code (b) are totally DIFFERENT projects, these jsps are part of different applications altogether. I just listed out 2 examples of code from two applications. When I started the server again after shutting it down, entered a value in input box and hit submit button it said IE cannot display the webpage, any idea why? Is it something to do with the IE settings? Also the top text box should display just Hello it displays Hello ${param['name']}. Also with several examples I found the form is getting displayed but that the EL is getting printed out as such, not getting evaluated. Any suggestions please?

m_minia at 2007-7-12 17:59:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

For the 1st appli ie code (a) it is under WEB-INF and I run this appli by:

http://localhost:8080/template/templateText.jsp. For the 2nd appli also under WEB-INF and it displays the form correctly. If I type in as per your suggestion

http://localhost:8080/template?name=mini the message is IE cannot display the webpage.

Code (a) and code (b) are totally DIFFERENT projects, these jsps are part of different applications altogether. When I started the server again after shutting it down, entered a value in input box and hit submit button it said IE cannot display the webpage, any idea why? Is it something to do with the IE settings? Also the top text box should display just Hello it displays Hello ${param['name']}. Also with several examples I found the form is getting displayed but that the EL is getting printed out as such, not getting evaluated. Any suggestions please?

m_minia at 2007-7-12 17:59:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Sorry just realized the server was shut down, that was dumb on my part. Instead of IE cant display webpage it says requested resource is not available. Rest of the problems as in my response (my earlier mail)to your suggestion remain. Also http://localhost:8080/template1/?name=mini says resource not available.Any help wud be appreciated.

m_minia at 2007-7-12 17:59:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

Sorry just realized the server was shut down, that was dumb on my part. Instead of IE cant display webpage it says requested resource is not available. Rest of the problems as in my response (my earlier mail)to your suggestion remain. Would you Pl. see my earlier mail for the details of the problem .Any help wud be appreciated.

m_minia at 2007-7-12 17:59:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...