Home > Back-end >  About the getAttribute and setAttribute
About the getAttribute and setAttribute

Time:05-09



Web page is probably use A form input user name password do POST to the web page B

But in addition to send a user name and password to send a current time to page B

I won't,,,

Web page I wrote A

<%
The Date uploadDate=new Date ();
SimpleDateFormat f=new SimpleDateFormat (" dd HH - MM yyyy - MM ");
F.f ormat (uploadDate);

Request. SetAttribute (" Date ", uploadDate);

% & gt;

Web B<%

String Date=request. GetAttribute (" Date ");
% & gt;

<% %=Date & gt;


Complains:
Type mismatch: always convert from Object to String


Then I look online to say coercion string

The converted output is null
How can I solve

CodePudding user response:

Request. The setAttribute method of uploadDate with f. format (uploadDate) try

CodePudding user response:

reference 1st floor title brother reply:
request. The setAttribute method of uploadDate with f. format (uploadDate) try


Or tip Type mismatch: always convert from Object to String

CodePudding user response:

Using the setAttribute B must be forwarded to the page?

Because my web page there is A button the user fill in the user name and password after clicking the button will put the user name, password, the current date B sent to the web page

CodePudding user response:

Including my test
Web page A
Request. SetAttribute (" test ", "123");

Web page B
Request. The getAttribute (" test ")

It took less than value
  • Related