Trying to log info from jsp file to console

Avatar

Avatar
Validate 1
Level 1
AEMnewbie
Level 1

Likes

0 likes

Total Posts

86 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
AEMnewbie
Level 1

Likes

0 likes

Total Posts

86 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile
AEMnewbie
Level 1

17-02-2021

A little new to these jsp files .. I see a jsp file which has a variable .. I am trying to find out what the variable value is ,by logging it to the console .. Is there any easy way to. do this ..I tried exploring the options in here https://javabeat.net/how-to-debug-jsp/ But when i load the page which eventually calls this jsp ..its failing with 500 error. 

Caused by: org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP: 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Ignite 1
MVP
SureshDhulipudi
MVP

Likes

163 likes

Total Posts

174 posts

Correct reply

49 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
MVP
SureshDhulipudi
MVP

Likes

163 likes

Total Posts

174 posts

Correct reply

49 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
SureshDhulipudi
MVP

17-02-2021

That might be syntax error

can you please provide the asp code here.

Look any jsp files in arm OOB for reference.

 

"text":"<%= jsp_variable%>"

Answers (1)

Answers (1)

Avatar

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

275 likes

Total Posts

320 posts

Correct reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

275 likes

Total Posts

320 posts

Correct reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
Anudeep_Garnepudi
MVP

17-02-2021

@AEMnewbie 

You can do any of the following

  1. To print on page, use JSP expression <%= variableName %>
  2. To print in log file, use JSP scriptlet <% log.info(variableName) %>. Must include global.jsp and you can only print String values
  3. To print in server console, do System.out.println(variableName). Start instance using start.bat