1

How can i convert the following code into JSP. I tried "${}" and <%= on the last line to get the customer Id but no success.

        out.println("<td>");
        out.println("<form action=\"week05_portfolio_servlet\" method=\"post\">");
        out.println("<input type=\"submit\" value=\"View\">");
        out.println("<input type=\"hidden\" name=\"command\" value=\"viewVehicles\">");
        out.println("<input type=\"hidden\" name=\"customerId\" value=\"" + cust.getId()  + "\">");

1 Answer 1

2

Wow- you got a long way to go, huh? I'm not sure what part you are having difficulty with but you need to remove the "out.println" statements since JSP will just render this out as basic html. You may also need to make sure that you are declaring the proper header for your JSP file. Once you do that something like:

<input type="hidden" name="customerId" value="<%=cust.getId() %>" />

will work just fine.

Sign up to request clarification or add additional context in comments.

2 Comments

I have tried that one but then it will just bring the blank page.but if I use this ( "${param.Id} ) then at least it goes to the error page to say the customer Id is not an integer.
You need to be more specific with your question. It sounds like you perhaps are just beginning with Java and JSP, correct? If so, you need to learn the basics there first, otherwise, post your JSP page here.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.