Questions tagged [scriptlet]

A Scriptlet is a piece of raw Java code embedded in a JSP file which gets executed in line with the JSP output.

A Scriptlet is a piece of raw Java code embedded in a JSP file which get executed in line with the JSP output (which is usually HTML). It's recognizeable by the Java code between the <% and %> tags. Its use is since JSP 2.0 (2003) as per the JSP coding conventions discouraged in favor of tag libraries like JSTL and expression language EL to control the flow of JSP output. The real business job such as preprocessing (e.g. loading data from DB) and postprocessing (e.g. saving submitted form) should be done in a servlet.

Scriptlets are these days considered old school and a bad practice. They are however still useful for quick prototyping and testing, for example to quickly prepare/stub values in top of JSP so that JSTL tags and EL expressions further down in the JSP page can quickly be prototyped/tested.

411 questions
-2
votes
2 answers

How do I store multiple column values in single String?

I want multiple column data inn single string variable ,I tried But I only get Single column Data,What should I do.here Is my coding ImageAnd my query is"select PRODUCT_ID_LIST from ORDERS where USER_ID=?" and code iamge is here my table image is…
Yogesh Raut
  • 5
  • 1
  • 6
-2
votes
2 answers

Can't find the way to send attribute from a jsp page to a Struts2 action

In my jsp i use the line

albumid ${param.id}

which show on the web page "albumid 2" where 2 is the id of the current album but when i try to send the albumid to a action file upload package ca.qc.bdeb.p55.actions; import…
lenon bob
  • 25
  • 8
-3
votes
1 answer

Why can't I reach my servlet from this form?

You don't have to go through the complete code. Just look at the first table assigning and document.write() inside body tag. I created the complete page using document.write() inside one script. At the end of the code you can see there is submit…
Pavel
  • 138
  • 2
  • 4
  • 16
-3
votes
1 answer

How to print the numbers in a perticular order

I want the dynamic output for a particular condition, and my condition is : size = 3; countersize = 8; //can be anything based on the user input. If I got the countersize as 4 or 5 or 8, then my output should be any one of these 0 or 1 or 2 for a…
Sthita
  • 1,750
  • 2
  • 19
  • 38
-3
votes
1 answer

Scriptlet in a JSP

I have two radio buttons. Information will pop out when one of the radio button is selected. How can I check if a radio button is selected using a scriptlet?
user1924543
  • 15
  • 1
  • 1
  • 3
-4
votes
1 answer

How to search for a duplicate in a given string using scriptlet?

How can I search for a duplicate in a given string using a scriptlet? ScripletInput= a,b,c,a Here the letter 'a' is repeating. If it is repeating more than once, then it should exit, else it can go ahead.
Vibes
  • 33
  • 6
1 2 3
27
28