Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7830013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:02:15+00:00 2026-06-02T11:02:15+00:00

I got this program, that I made: http://www.2shared.com/file/73q6K9Yy/testv.html The Login.java is the servlet, that

  • 0

I got this program, that I made: http://www.2shared.com/file/73q6K9Yy/testv.html
The Login.java is the servlet, that should use the login.vm template, and modify it. It doesn’t do anything, and I don’t understand why.
In the function:

public Template handleRequest(HttpServletRequest request,HttpServletResponse response, Context ctx )

If I put:

 error= (String) request.getAttribute("error");
 ctx.put("error", error);

It doesn’t do anything.
IF I put:

 error= request.getAttribute("error").toString();
 ctx.put("error", error);

I get a Java null pointer exception.
BUT if I put:

 ctx.put("error","this is a string");

It changes the variable of the template login.vm into that string.
Why doesn’t it get the Attribute from the request, what I’m a doing wrong.

PS: If I press the Register button, it should redirect me to the “/reg.jsp” page. I made this only to see if it works, and it doesn’t. Made the same program in MVC, with jsp’s but I need to make it with velocity, for my internship.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T11:02:17+00:00Added an answer on June 2, 2026 at 11:02 am

    My best guess is that there is no attribute under the “error” key in your request. It has nothing to do with Velocity itself. If you check the line number the null exception occurs at, it should be the first line of your code excerpt.

    Note that in a web context, you should use the VelocityViewServlet, from the velocity-tools subproject, rather than the deprecated VelocityServlet that will disappear in next versions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While compiling a program in Java I got this big WARNING warning: [unchecked] unchecked
I've got a C++ program that internally uses java (via my C++ dll that
Okay, I got this small program which tags (as in ID3v2.4 etc.) some music
I got this error Unhandled exception at 0x0049b946 in Program.exe: 0xC0000005: Access violation reading
I'm new to C programming and I just came across this program and got
I made a simple program that allows the user to pick a number of
I've come this far without asking for help, but I've got a problem that
So here I got this little program which everyone obviously understands. include <iostream> include
I was testing a program I am writing and I got this error message:
I got a weird problem. I have a program that (does many things but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.