can't read parameter in a jsp

P

pluto

Hello I have a post form in a jsp with some html links and an action=
some.jsp
To each link I have associated an hidden field with a name and a
value.
In some.jsp I should read the parameter with
<%=request.getParameter("name hidden field");%>

But I get a null, could anyone tell me why

TIA
 
B

Ben_

Because no parameter named "name hidden field" was received. Either you made
a mistake in the java code (check the name in the call to getParameter()
method) or in the html code (check the form code).
 
C

Chris Smith

pluto said:
Hello I have a post form in a jsp with some html links and an action=
some.jsp
To each link I have associated an hidden field with a name and a
value.
In some.jsp I should read the parameter with
<%=request.getParameter("name hidden field");%>

But I get a null, could anyone tell me why

I can't make heads or tails of your description of the initial JSP page.
How about you post a simple example here that you think should work, but
that doesn't work? Please remove any style/design bits of the page and
just provide a minimal example.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
C

carlo

Well I try.....

1) my first.jsp has an html link inside a form, because i have to send
a parameter within a link I added an Hidden Field:

<form name="myform" method="POST" action="second.jsp">
<a href="second.jsp" TARGET="variable"> <FONT COLOR="#3539CF"> Comunications
</FONT> </a>
<input type="hidden" name="Title" value="Comunications">
</form>

2) second.jsp

Now I have to read the parameter and to assign it to the html tag title of
the page, so...

<title> <%=request.getParameter("Title");%>

I put the hidden field name to get "Comunications"

as I told you I get null instead of "Comunications"

Can you hel me?
 
C

Chris Smith

carlo said:
Well I try.....

1) my first.jsp has an html link inside a form, because i have to send
a parameter within a link I added an Hidden Field:

<form name="myform" method="POST" action="second.jsp">
<a href="second.jsp" TARGET="variable"> <FONT COLOR="#3539CF"> Comunications
</FONT> </a>
<input type="hidden" name="Title" value="Comunications">
</form>

That won't work. Form fields only show up when a form is submitted.
Hyperlinks are just hyperlinks, not form submit buttons.

Instead, just do this:

<a href="second.jsp?Title=Communications" target="variable"> ... </a>

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
P

pluto

Chris Smith said:
That won't work. Form fields only show up when a form is submitted.
Hyperlinks are just hyperlinks, not form submit buttons.

Instead, just do this:

<a href="second.jsp?Title=Communications" target="variable"> ... </a>
It Works THANKS !!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top