Win a copy of Head First Android this week in the Android forum!

Jamed

Ranch Hand
+ Follow
since Apr 17, 2005
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 Jamed

Hello Everyone

is there DVD, CD or Vedio Tape that I can watch to help me getting the SCWCD?

thanks in advance

mjamed
hallo everyone

i am confused !

What is the difference between EL functions described on chapter 8 of HFSJ and custom tags described in chapter 9 ?

how would i distiguish need for each?

thanks in advance

jamed
hallo,

what does this mean? on page 367 of HFSJ book

note: EL implicit obects are not the same as the implicit objects available to JSP scripting except for page context?

thank in advance
I only need to have jsp's and web.xml for this example.

I don't need a servlet do I ?

thanks
Can you paste your whole web.xml file
this is what i have for the same application and it runs perfectly


package com.example.web;

import com.example.web.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class Test extends HttpServlet{

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{

String[] favoriteMusic= {"Zero 7","tahiti 80","BT","Frou Frou" };
request.setAttribute("musicList",favoriteMusic);

RequestDispatcher view= request.getRequestDispatcher("result.jsp");

view.forward(request,response);

}
}

***********************************************
<html><body>


Music is : ${musicList[1]}

</body></html>
***********************************************
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.4">

<servlet>
<servlet-name>BeansTest</servlet-name>
<servlet-class>com.example.web.Test</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>BeansTest</servlet-name>
<url-pattern>/Tester.do</url-pattern>
</servlet-mapping>

</web-app>
*********************

Test it with this http://localhost:8080/Music/Tester.do

let me know if it works
Accourding to sun you can't change the logo in anyway except resizing it. You can't cut, or play the graphics or add anything to it.

what you can do is have resize it and have it on your buss. card, email, ...etc

hope this helps
thank you very much guys it works now

this is how my servlet looks like

package com.example.web;

import com.example.web.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class Test extends HttpServlet{

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{

String[] favoriteMusic= {"Zero 7","tahiti 80","BT","Frou Frou" };
request.setAttribute("musicList",favoriteMusic);

RequestDispatcher view= request.getRequestDispatcher("result.jsp");

view.forward(request,response);

}
}
I get no error ! but nothing is show on the screen !
This example is not working for me any clue?
******************************************
This is my servlet code: "Test.java"

package com.example.web;

import com.example.web.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class Test extends HttpServlet{

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{

String[] favoriteMusic= {"Zero 7","tahiti 80","BT","Frou Frou" };
request.setAttribute("musicList","favoriteMusic");
}
}
************************************************************
this is my jsp page "result.jsp"

<html><body>

Music is : ${musicList[0]}

</body></html>
************************************************************
This is my xml file: "web.xml"

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.4">

<servlet>
<servlet-name>BeansTest</servlet-name>
<servlet-class>com.example.web.Test</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>BeansTest</servlet-name>
<url-pattern>/Tester.do</url-pattern>
</servlet-mapping>

</web-app>
*****************************
Thank you very much srinath for you help

it did work with me with the solution provided by sushma

the problem was the i didn't use getProperty in my jsp and that's why it wasn't displaying anything when i tested it

but isn't this supposed to dipslay the name ?
"<%=request.getParameter("userName")%>"

thanks srinath and sushma for our hlep
[ June 17, 2005: Message edited by: Jamed ]
i've changed the action to Tester.do

it's still not working !

?
Shri,

i try what you have suggested but it's not working

i've posted my servlet Test.java at the the top

thanks in advance for you help
Hallo everyone,

this example is not working for me The rest of the examples in this chapter depend on this one so basically i am stock overhere

when i run the application i get no outupt and the parameter (user name) is passed in the URL. e.g. if i put "john" this is what i get in the address bar

http://localhost:8080/Beans3/result.jsp?userName=john

any clue?
***************************************
form.html

<html><body>
<form action="result.jsp">

name: <input type = "text" name="userName">
<input type="submit">

</form>
</body></html>
******************************************
result.jsp

<html><body>

<jsp:useBean id="person" class="com.example.web.Person" >

<jsp:setProperty name="person" property="name"
value="<%=request.getParameter("userName")%>" />
</jsp:useBean>
</body></html>
*******************************************************
java bean Person.java

package com.example.web;

public class Person {

private String name;

public void setName(String n)
{
name=n;
}

public String getName()
{
return name;
}
}//Person
**********************************
Test.java

package com.example.web;


import com.example.web.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;


public class Test extends HttpServlet{

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{


Person p = new Person();
p.setName("Evan");
request.setAttribute("person",p);

RequestDispatcher view= request.getRequestDispatcher("result.jsp");
view.forward(request,response);

}

}
**********************************
web.xml

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.4">

<servlet>
<servlet-name>BeansTest</servlet-name>
<servlet-class>com.example.web.Test</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>BeansTest</servlet-name>
<url-pattern>/Tester.do</url-pattern>
</servlet-mapping>

</web-app>

[ June 14, 2005: Message edited by: Jamed ]

[ June 14, 2005: Message edited by: Jamed ]

[ June 14, 2005: Message edited by: Jamed ]
[ June 14, 2005: Message edited by: Jamed ]